LOG = logging.getLogger(__name__)
USER_AGENT = 'python-glanceclient'
CHUNKSIZE = 1024 * 64  # 64kB
REQ_ID_HEADER = 'X-OpenStack-Request-ID'
TOKEN_HEADERS = ['X-Auth-Token', 'X-Service-Token']
def encode_headers(headers):
    def _chunk_body(body):
    def _set_common_request_kwargs(self, headers, kwargs):
    def _handle_response(self, resp):
    def __init__(self, endpoint, **kwargs):
    def __del__(self):
    def parse_endpoint(endpoint):
    def log_curl_request(self, method, url, headers, data, kwargs):
    def log_http_response(resp):
    def _request(self, method, url, **kwargs):
    def head(self, url, **kwargs):
    def get(self, url, **kwargs):
    def post(self, url, **kwargs):
    def put(self, url, **kwargs):
    def patch(self, url, **kwargs):
    def delete(self, url, **kwargs):
def _close_after_stream(response, chunk_size):
    def __init__(self, session, **kwargs):
    def request(self, url, method, **kwargs):
def get_http_client(endpoint=None, session=None, **kwargs):
class _BaseHTTPClient(object):
class HTTPClient(_BaseHTTPClient):
class SessionClient(adapter.Adapter, _BaseHTTPClient): SENSITIVE_HEADERS = ('X-Auth-Token', )
REQUIRED_FIELDS_ON_DATA = ('disk_format', 'container_format')
def arg(*args, **kwargs):
    def _decorator(func):
def on_data_require_fields(data_fields, required=REQUIRED_FIELDS_ON_DATA):
    def args_decorator(func):
        def prepare_fields(fields):
        def func_wrapper(gc, args):
def schema_args(schema_getter, omit=None):
    def _decorator(func):
def pretty_choice_list(l):
def has_version(client, version):
def print_cached_images(cached_images):
def print_dict_list(objects, fields):
def print_list(objs, fields, formatters=None, field_settings=None):
def _encode(src):
def unicode_key_value_to_string(src):
def print_dict(d, max_column_width=80):
def find_resource(manager, name_or_id):
def env(*vars, **kwargs):
def exit(msg='', exit_code=1):
def print_err(msg):
def save_image(data, path):
def make_size_human_readable(size):
def get_file_size(file_obj):
def get_data_file(args):
def strip_version(endpoint):
def print_image(image_obj, human_readable=False, max_col_width=None):
def integrity_iter(iter, checksum):
def serious_integrity_iter(iter, hasher, hash_value):
def memoized_property(fn):
    def _memoized_property(self):
def safe_header(name, value):
def endpoint_version_from_url(endpoint, default_version=None):
def debug_enabled(argv):
    def __init__(self, iterable, length):
    def __iter__(self):
    def next(self):
    def __len__(self):
    def __init__(self, wrapped):
    def request_ids(self):
    def wrapped(self):
    def next(self):
    def __init__(self, wrapped):
    def _set_request_ids(self, resp):
    def _next(self):
    def next(self):
    def __next__(self):
    def __iter__(self):
    def request_ids(self):
    def wrapped(self):
def add_req_id_to_object():
    def inner(wrapped, instance, args, kwargs):
def add_req_id_to_generator():
    def inner(wrapped, instance, args, kwargs):
def _extract_request_id(resp):
class IterableWithLength(object):
class RequestIdProxy(wrapt.ObjectProxy):
class GeneratorProxy(wrapt.ObjectProxy): TARGET_VALUES = ('both', 'cache', 'queue')
class Controller(object):
    def __init__(self, http_client):
    def is_supported(self, version):
    def list(self):
    def delete(self, image_id):
    def clear(self, target):
    def queue(self, image_id): MEMBER_STATUS_VALUES = ('accepted', 'rejected', 'pending')
class Controller(object):
    def __init__(self, http_client, schema_client):
    def model(self):
    def list(self, image_id):
    def get(self, image_id, member_id):
    def delete(self, image_id, member_id):
    def update(self, image_id, member_id, member_status):
    def create(self, image_id, member_id): class Controller(object):
    def __init__(self, http_client, schema_client):
    def model(self):
    def update(self, image_id, tag_value):
    def delete(self, image_id, tag_value): DEFAULT_PAGE_SIZE = 20
SORT_DIR_VALUES = ('asc', 'desc')
SORT_KEY_VALUES = ('name', 'status', 'container_format', 'disk_format',
                   'size', 'id', 'created_at', 'updated_at')
class Controller(object):
    def __init__(self, http_client, schema_client):
    def model(self):
    def unvalidated_model(self):
    def _wrap(value):
    def _validate_sort_param(sort):
    def list(self, **kwargs):
        def paginate(url, page_size, limit=None):
    def _get(self, image_id, header=None):
    def get(self, image_id):
    def get_associated_image_tasks(self, image_id):
    def data(self, image_id, do_checksum=True, allow_md5_fallback=False):
    def upload(self, image_id, image_data, image_size=None, u_url=None,
               backend=None):
    def get_import_info(self):
    def get_stores_info(self):
    def get_stores_info_detail(self):
    def delete_from_store(self, store_id, image_id):
    def stage(self, image_id, image_data, image_size=None):
    def image_import(self, image_id, method='glance-direct', uri=None,
                     backend=None, stores=None, allow_failure=True,
                     all_stores=None):
    def delete(self, image_id):
    def create(self, **kwargs):
    def deactivate(self, image_id):
    def reactivate(self, image_id):
    def update(self, image_id, remove_props=None, **kwargs):
    def _get_image_with_locations_or_fail(self, image_id):
    def _send_image_update_request(self, image_id, patch_body):
    def add_location(self, image_id, url, metadata, validation_data=None):
    def delete_locations(self, image_id, url_set):
    def update_location(self, image_id, url, metadata): class Controller:
    def __init__(self, http_client, schema_client):
    def get_usage(self, **kwargs): DEFAULT_PAGE_SIZE = 20
SORT_DIR_VALUES = ('asc', 'desc')
SORT_KEY_VALUES = ('created_at', 'namespace')
class NamespaceController(object):
class ResourceTypeController(object):
class PropertyController(object):
class ObjectController(object):
class TagController(object):
    def __init__(self, http_client, schema_client):
    def model(self):
    def create(self, **kwargs):
    def update(self, namespace_name, **kwargs):
    def get(self, namespace, **kwargs):
    def _get(self, namespace, header=None, **kwargs):
    def list(self, **kwargs):
        def paginate(url):
    def delete(self, namespace):
    def __init__(self, http_client, schema_client):
    def model(self):
    def associate(self, namespace, **kwargs):
    def deassociate(self, namespace, resource):
    def list(self):
    def get(self, namespace):
    def __init__(self, http_client, schema_client):
    def model(self):
    def create(self, namespace, **kwargs):
    def update(self, namespace, prop_name, **kwargs):
    def get(self, namespace, prop_name):
    def _get(self, namespace, prop_name, header=None):
    def list(self, namespace, **kwargs):
    def delete(self, namespace, prop_name):
    def delete_all(self, namespace):
    def __init__(self, http_client, schema_client):
    def model(self):
    def create(self, namespace, **kwargs):
    def update(self, namespace, object_name, **kwargs):
    def get(self, namespace, object_name):
    def _get(self, namespace, object_name, header=None):
    def list(self, namespace, **kwargs):
    def delete(self, namespace, object_name):
    def delete_all(self, namespace):
    def __init__(self, http_client, schema_client):
    def model(self):
    def create(self, namespace, tag_name):
    def create_multiple(self, namespace, **kwargs):
    def update(self, namespace, tag_name, **kwargs):
    def get(self, namespace, tag_name):
    def _get(self, namespace, tag_name, header=None):
    def list(self, namespace, **kwargs):
    def delete(self, namespace, tag_name):
    def delete_all(self, namespace): class SchemaBasedModel(warlock.Model):
class SchemaProperty(object):
class Schema(object):
class Controller(object):
    def _make_custom_patch(self, new, original):
    def patch(self):
    def __init__(self, name, **kwargs):
def translate_schema_properties(schema_properties):
    def __init__(self, raw_schema):
    def is_core_property(self, property_name):
    def is_base_property(self, property_name):
    def _check_property(self, property_name, allow_non_base):
    def raw(self):
    def __init__(self, http_client):
    def get(self, schema_name): DEFAULT_PAGE_SIZE = 20
SORT_DIR_VALUES = ('asc', 'desc')
SORT_KEY_VALUES = ('id', 'type', 'status')
class Controller(object):
    def __init__(self, http_client, schema_client):
    def model(self):
    def list(self, **kwargs):
        def paginate(url):
    def get(self, task_id):
    def create(self, **kwargs):
from glanceclient.common import http
from glanceclient.common import utils
from glanceclient.v2 import cache
from glanceclient.v2 import image_members
from glanceclient.v2 import image_tags
from glanceclient.v2 import images
from glanceclient.v2 import info
from glanceclient.v2 import metadefs
from glanceclient.v2 import schemas
from glanceclient.v2 import tasks
from glanceclient.v2 import versions
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.




class Client(object):
    """Client for the OpenStack Images v2 API.

    :param string endpoint: A user-supplied endpoint URL for the glance
                            service.
    :param string token: Token for authentication.
    :param integer timeout: Allows customization of the timeout for client
                            http requests. (optional)
    :param string language_header: Set Accept-Language header to be sent in
                                   requests to glance.
    """

    def __init__(self, endpoint=None, **kwargs):
        self.endpoint_provided = endpoint is not None
        endpoint, self.version = utils.endpoint_version_from_url(endpoint, 2.0)
        self.http_client = http.get_http_client(endpoint=endpoint, **kwargs)
        self.schemas = schemas.Controller(self.http_client)


        self.images = images.Controller(self.http_client, self.schemas)