Debian Codegraph @

glanceclient/v2/client.py

raw symbols SCIP
1 # Copyright 2012 OpenStack Foundation
2 # All Rights Reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
5 # not use this file except in compliance with the License. You may obtain
6 # a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations
14 # under the License.
15
16
17 from glanceclient.common import http
18 from glanceclient.common import utils
19 from glanceclient.v2 import cache
20 from glanceclient.v2 import image_members
21 from glanceclient.v2 import image_tags
22 from glanceclient.v2 import images
23 from glanceclient.v2 import info
24 from glanceclient.v2 import metadefs
25 from glanceclient.v2 import schemas
26 from glanceclient.v2 import tasks
27 from glanceclient.v2 import versions
28
29
30 class Client(object):
31 """Client for the OpenStack Images v2 API.
32
33 :param string endpoint: A user-supplied endpoint URL for the glance
34 service.
35 :param string token: Token for authentication.
36 :param integer timeout: Allows customization of the timeout for client
37 http requests. (optional)
38 :param string language_header: Set Accept-Language header to be sent in
39 requests to glance.
40 """
41
42 def __init__(self, endpoint=None, **kwargs):
43 self.endpoint_provided = endpoint is not None
44 endpoint, self.version = utils.endpoint_version_from_url(endpoint, 2.0)
45 self.http_client = http.get_http_client(endpoint=endpoint, **kwargs)
46 self.schemas = schemas.Controller(self.http_client)
47
48 self.images = images.Controller(self.http_client, self.schemas)
49 self.image_tags = image_tags.Controller(self.http_client,
50 self.schemas)
51 self.image_members = image_members.Controller(self.http_client,
52 self.schemas)
53
54 self.info = info.Controller(self.http_client, self.schemas)
55
56 self.tasks = tasks.Controller(self.http_client, self.schemas)
57
58 self.metadefs_resource_type = (
59 metadefs.ResourceTypeController(self.http_client, self.schemas))
60
61 self.metadefs_property = (
62 metadefs.PropertyController(self.http_client, self.schemas))
63
64 self.metadefs_object = (
65 metadefs.ObjectController(self.http_client, self.schemas))
66
67 self.metadefs_tag = (
68 metadefs.TagController(self.http_client, self.schemas))
69
70 self.metadefs_namespace = (
71 metadefs.NamespaceController(self.http_client, self.schemas))
72
73 self.versions = versions.VersionController(self.http_client)
74
75 self.cache = cache.Controller(self.http_client)