1# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#    http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15from openstack import exceptions
16
17OpenStackCloudException = exceptions.SDKException
18OpenStackCloudTimeout = exceptions.ResourceTimeout
19
20
21class OpenStackCloudCreateException(OpenStackCloudException):
22
23    def __init__(self, resource, resource_id, extra_data=None, **kwargs):
24        super(OpenStackCloudCreateException, self).__init__(
25            message="Error creating {resource}: {resource_id}".format(
26                resource=resource, resource_id=resource_id),
27            extra_data=extra_data, **kwargs)
28        self.resource_id = resource_id
29
30
31class OpenStackCloudUnavailableExtension(OpenStackCloudException):
32    pass
33
34
35class OpenStackCloudUnavailableFeature(OpenStackCloudException):
36    pass
37
38
39# Backwards compat
40OpenStackCloudHTTPError = exceptions.HttpException
41OpenStackCloudBadRequest = exceptions.BadRequestException
42OpenStackCloudURINotFound = exceptions.NotFoundException
43OpenStackCloudResourceNotFound = OpenStackCloudURINotFound
44