cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
error.py
Go to the documentation of this file.
1 # -*- coding: utf-8 -*-
2 # @COPYRIGHT_begin
3 #
4 # Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 # @COPYRIGHT_end
19 
20 ##
21 # @package src.ec2.error
22 # EC2 API exceptions
23 #
24 # @copyright Copyright (c) 2012 Institute of Nuclear Physics PAS <http://www.ifj.edu.pl/>
25 # @author Oleksandr Gituliar <gituliar@gmail.com>
26 # @author Łukasz Chrząszcz <l.chrzaszcz@gmail.com>
27 #
28 
29 from ec2 import lookup
30 
31 ##
32 # Superclass for EC2 API exceptions.
33 class EC2Exception(BaseException):
34 
35  ##
36  # Store `context` used to build an error `message` in `to_xml`.
37  def __init__(self, **context):
38  self.context = context
39 
40  ##
41  # Return XML with error details compatible with Amazon EC2 WSDL.
42  def to_xml(self):
43  template = lookup.get_template('error.xml')
44  return template.render(
45  code=self.code,
46  message=self.message % self.context,
47  )
48 
50  code = "AuthFailure"
51  message = "AWS was not able to validate the provided access credentials."
52  #The address '%(address)s' does not belong to you
53 
55  code = "InsufficientAddressCapacity"
56  message = "Not enough available addresses to satisfy your minimum request."
57 
59  code = "InvalidAction"
60  message = "The action %(action)s is not valid for this web service."
61 
62 class InvalidAMIID(object):
64  code = "InvalidAMIID.NotFound"
65  message = "The AMI ID '%(image_id)s' does not exist"
67  code = "InvalidAMIID.Malformed"
68  message = "Specified AMI ID is malformed"
70  code = "InvalidAMIID.Unavailable"
71  message = "Specified AMI is temporarily unavailable"
72 
73 class InvalidInstanceID(object):
75  code = "InvalidInstanceID.Malformed"
76  message = "The Instance ID '%(image_id)s' is not valid"
78  code = "InvalidInstanceID.NotFound"
79  message = "The Instance ID '%(image_id)s' does not exist"
80 
81 class InvalidKeyPair(object):
83  code = "InvalidKeyPair.Duplicate"
84  message = "The keypair '%(key_name)s' already exists."
86  code = "InvalidKeyPair.NotFound"
87  message = "The key pair '%(key_name)s' does not exist"
88 
89 class InvalidZone(object):
91  code = "InvalidZone.NotFound"
92  message = "The zone '%(zone_name)s' does not exist."
93 
95  code = "MissingParameter"
96  message = "The request must contain the parameter %(parameter)s"
97 
99  code = "UndefinedError"
100  message = "There is no dedicated error to describe this situation. Contact developers if you need more information."
101 
102 
104  code = "UnknownParameter"
105  message = "The parameter %(parameter)s is not recognized"
106 
107 # Łukasz Chrząszcz : Amazon
109  code = "VolumeInUse"
110  message = "Specified volume is attached to VM"
111 
112 class InvalidVolume(object):
114  code = "InvalidVolume"
115  message = "Specified volume does not exist"
116 
117 class InvalidVolumeID(object):
119  code = ""
120  message = ""
122  code = "InvalidVolumeID.Malformed"
123  message = "Specified Volume ID is malformed, use only digits"
124 
126  code = "DiskImageSizeTooLarge"
127  message = "Quota exceeded"
128 
130  code = "InvalidParameterValue"
131  message = "A value specified in a parameter is not valid"
132 
134  code = "InvalidParameter"
135  message = "Invalid parameter"
136 
138  code = "InternalError"
139  message = "An internal error has occurred. Try again later. If the problem persists, contact administrator"
140 
141 class InvalidAddress(object):
143  code = "InvalidAddress.NotFound"
144  message = "Couldn't find specified Elastic IP address"
145 
147  code = "CannotDelete"
148  message = "Can't delete default security group"
149 
150 class InvalidGroup(object):
152  code = "InvalidGroup.NotFound"
153  message = "The specified security group does not exist"
154 
155 class InvalidIPAddress(object):
157  code = "InvalidIPAddress"
158  message = "Specified IP Address is already in use. You must first disassociate it from the instance"
159 
161  code = "InvalidFilter"
162  message = "The specified filter is not correct or it is not supported"
163 
165  code = "InvalidID"
166  message = "ID you've given is not valid or you cannot create tag for given resource."
167 
168 class InvalidAttachment(object):
170  code = "InvalidAttachment"
171  message = "Volume not attached"
172 
174  code = "ResourceLimitExceeded"
175  message = "You've exceeded limit assigned to your account. Exceeded limit: %(resource)s"
176 
177 # =================== S3 Errors ===================
178 
180  code = "MethodNotAllowed"
181  message = "The specified method is not allowed for given resource"
182 
184  code = "InvalidArgument"
185  message = "The specified argument is not valid"
186 
188  code = "InvalidURI"
189  message = "Couldn't parse the specified URI"
190 
192  code = "InvalidAccessKeyId"
193  message = "The access key ID you provided is not valid"
194 
196  code = "InvalidManifest"
197  message = "The specified manifest is unparsable"
198 
200  code = "EntityTooLarge"
201  message = "You don't have enough disk space"
202 
204  code = "IncompleteBody"
205  message = "The size of body is not equal to the provided Content-Length header value"
206