| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 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) |