Revision e440e835 snf-cyclades-app/synnefo/api/faults.py

b/snf-cyclades-app/synnefo/api/faults.py
1
# Copyright 2011 GRNET S.A. All rights reserved.
2
# 
1
# Copyright 2011, 2012, 2013 GRNET S.A. All rights reserved.
2
#
3 3
# Redistribution and use in source and binary forms, with or
4 4
# without modification, are permitted provided that the following
5 5
# conditions are met:
6
# 
6
#
7 7
#   1. Redistributions of source code must retain the above
8 8
#      copyright notice, this list of conditions and the following
9 9
#      disclaimer.
10
# 
10
#
11 11
#   2. Redistributions in binary form must reproduce the above
12 12
#      copyright notice, this list of conditions and the following
13 13
#      disclaimer in the documentation and/or other materials
14 14
#      provided with the distribution.
15
# 
15
#
16 16
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17 17
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 18
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
......
25 25
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 26
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 27
# POSSIBILITY OF SUCH DAMAGE.
28
# 
28
#
29 29
# The views and conclusions contained in the software and
30 30
# documentation are those of the authors and should not be
31 31
# interpreted as representing official policies, either expressed
32 32
# or implied, of GRNET S.A.
33 33

  
34

  
34 35
def camelCase(s):
35 36
    return s[0].lower() + s[1:]
36 37

  
......
42 43
        self.details = details
43 44
        self.name = name or camelCase(self.__class__.__name__)
44 45

  
46

  
45 47
class BadRequest(Fault):
46 48
    code = 400
47 49

  
50

  
48 51
class Unauthorized(Fault):
49 52
    code = 401
50 53

  
54

  
51 55
class ResizeNotAllowed(Fault):
52 56
    code = 403
53 57

  
58

  
54 59
class Forbidden(Fault):
55 60
    code = 403
56 61

  
62

  
57 63
class ItemNotFound(Fault):
58 64
    code = 404
59 65

  
66

  
60 67
class BuildInProgress(Fault):
61 68
    code = 409
62 69

  
70

  
63 71
class OverLimit(Fault):
64 72
    code = 413
65 73

  
74

  
66 75
class BadMediaType(Fault):
67 76
    code = 415
68 77

  
78

  
69 79
class NetworkInUse(Fault):
70 80
    code = 421
71 81

  
82

  
72 83
class ServiceUnavailable(Fault):
73 84
    code = 503

Also available in: Unified diff