LOG = logging.getLogger(__name__)
USER_AGENT = 'python-muranoclient'
CHUNKSIZE = 1024 * 64  # 64kB
def get_system_ca_file():
    def __init__(self, endpoint, **kwargs):
    def _safe_header(self, name, value):
    def log_curl_request(self, url, method, kwargs):
    def log_http_response(resp):
    def request(self, url, method, log=True, **kwargs):
    def strip_endpoint(self, location):
    def credentials_headers(self):
    def json_request(self, url, method, content_type='application/json',
                     **kwargs):
    def json_patch_request(self, url, method='PATCH', **kwargs):
    def head(self, url, **kwargs):
    def get(self, url, **kwargs):
    def post(self, url, **kwargs):
    def put(self, url, **kwargs):
    def delete(self, url, **kwargs):
    def patch(self, url, **kwargs):
    def request(self, url, method, **kwargs):
    def json_request(self, url, method, **kwargs):
    def json_patch_request(self, url, method='PATCH', **kwargs):
def _construct_http_client(*args, **kwargs):
def _set_data(kwargs):
class HTTPClient(object):
class SessionClient(keystone_adapter.Adapter): class ActionManager(object):
    def __init__(self, api):
    def call(self, environment_id, action_id, arguments=None):
    def get_result(self, environment_id, task_id): def rewrap_http_exceptions(func):
    def inner(*args, **kwargs):
    def __init__(self, client, tenant=None):
    def create(self, fqn, data, **kwargs):
    def _get_local_inheritance(classes, resolvers):
    def _keywords_from_display_name(display_name):
    def list(self,
             sort_field='name',
             sort_dir='asc',
             type=None,
             tags=None,
             limit=None,
             page_size=None,
             **filters):
    def get(self, app_id):
    def delete(self, app_id):
    def update(self, app_id, props_to_remove=None, **new_props):
    def toggle_active(self, app_id):
    def toggle_public(self, app_id):
    def download(self, app_id):
    def get_ui(self, app_id, loader_cls=None):
    def get_logo(self, app_id):
    def __init__(self, legacy, glare):
    def categories(self):
    def create(self, data, files):
    def filter(self, **kwargs):
    def list(self, include_disabled=False):
    def delete(self, app_id):
    def get(self, app_id):
    def update(self, app_id, body, operation='replace'):
    def toggle_active(self, app_id):
    def toggle_public(self, app_id):
    def download(self, app_id):
    def get_logo(self, app_id):
    def get_ui(self, app_id, loader_cls=None):
    def __init__(self, item):
    def updated(self):
    def created(self):
    def is_public(self):
    def name(self):
    def fully_qualified_name(self):
    def owner_id(self):
    def __getstate__(self):
    def __setstate__(self, state):
    def __getattr__(self, name):
    def to_dict(self):
class ArtifactRepo(object):
class PackageManagerAdapter(object):
class PackageWrapper(object): class Category(base.Resource):
class CategoryManager(base.Manager):
    def __repr__(self):
    def data(self, **kwargs):
    def list(self, **kwargs):
    def get(self, id):
    def add(self, data):
    def delete(self, id): class Deployment(base.Resource):
class Status(base.Resource):
class DeploymentManager(base.Manager):
    def __repr__(self):
    def data(self, **kwargs):
    def __repr__(self):
    def data(self, **kwargs):
    def list(self, environment_id, all_environments=False):
    def reports(self, environment_id, deployment_id, *service_ids): class Environment(base.Resource):
class Status(base.Resource):
class EnvironmentManager(base.ManagerWithFind):
    def __repr__(self):
    def data(self, **kwargs):
    def __repr__(self):
    def data(self, **kwargs):
    def list(self, all_tenants=False, tenant_id=None):
    def create(self, data):
    def update(self, environment_id, name):
    def delete(self, environment_id, abandon=False):
    def get(self, environment_id, session_id=None):
    def last_status(self, environment_id, session_id):
    def get_model(self, environment_id, path, session_id=None):
    def update_model(self, environment_id, data, session_id): class InstanceStatistics(base.Resource):
class InstanceStatisticsManager(base.Manager):
    def __repr__(self):
    def data(self, **kwargs):
    def get(self, environment_id, instance_id=None):
    def get_aggregated(self, environment_id): DEFAULT_PAGE_SIZE = 20
class Package(base.Resource):
class PackageManager(base.Manager):
    def __repr__(self):
    def data(self, **kwargs):
    def create(self, data, files):
    def get(self, app_id):
    def filter(self, **kwargs):
        def construct_url(params):
        def paginate(_url):
    def list(self, include_disabled=False, limit=20):
    def delete(self, app_id):
    def update(self, app_id, body, operation='replace'):
    def download(self, app_id):
    def toggle_active(self, app_id):
    def toggle_public(self, app_id):
    def get_ui(self, app_id, loader_cls=None):
    def get_logo(self, app_id):
    def get_supplier_logo(self, app_id): class RequestStatistics(base.Resource):
class RequestStatisticsManager(base.Manager):
    def __repr__(self):
    def data(self, **kwargs):
    def list(self): class Schema(base.Resource):
class SchemaManager(base.Manager):
    def __repr__(self):
    def data(self):
    def get(self, class_name, method_names=None,
            class_version=None, package_name=None): def normalize_path(f):
    def f_normalize_path(*args, **kwargs):
    def __repr__(self):
    def data(self, **kwargs):
    def _add_details(self, info):
    def list(self, environment_id, session_id=None):
    def get(self, environment_id, path, session_id=None):
    def post(self, environment_id, path, data, session_id):
    def put(self, environment_id, path, data, session_id):
    def delete(self, environment_id, path, session_id):
class Service(base.Resource):
class ServiceManager(base.Manager): class Session(base.Resource):
class SessionManager(base.Manager):
    def __repr__(self):
    def data(self, **kwargs):
    def get(self, environment_id, session_id):
    def configure(self, environment_id):
    def deploy(self, environment_id, session_id):
    def delete(self, environment_id, session_id): class StaticActionResult(object):
class StaticActionManager(object):
    def __init__(self, result, exception=None):
    def get_result(self):
    def check_result(self):
    def __init__(self, api):
    def call(self, arguments): class Template(base.Resource):
class EnvTemplateManager(base.Manager):
    def __repr__(self):
    def data(self, **kwargs):
    def list(self):
    def create(self, data):
    def update(self, env_template_id, name):
    def delete(self, env_template_id):
    def get(self, env_template_id):
    def create_app(self, env_template_id, data):
    def delete_app(self, env_template_id, app_id):
    def create_env(self, env_template_id, data):
    def clone(self, env_template_id, name):
from muranoclient.common import http
from muranoclient.v1 import actions
from muranoclient.v1 import artifact_packages
from muranoclient.v1 import categories
from muranoclient.v1 import deployments
from muranoclient.v1 import environments
from muranoclient.v1 import instance_statistics
from muranoclient.v1 import packages
from muranoclient.v1 import request_statistics
from muranoclient.v1 import schemas
from muranoclient.v1 import services
from muranoclient.v1 import sessions
from muranoclient.v1 import static_actions
from muranoclient.v1 import templates
#    Copyright (c) 2013 Mirantis, Inc.
#
#    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 Murano v1 API.

    :param string endpoint: A user-supplied endpoint URL for the service.
    :param string token: Token for authentication.
    :param integer timeout: Allows customization of the timeout for client
                            http requests. (optional)
    """

    def __init__(self, *args, **kwargs):
        """Initialize a new client for the Murano v1 API."""
        self.glance_client = kwargs.pop('glance_client', None)
        tenant = kwargs.pop('tenant', None)
        artifacts_client = kwargs.pop('artifacts_client', None)
        self.http_client = http._construct_http_client(*args, **kwargs)
        self.environments = environments.EnvironmentManager(self.http_client)
        self.env_templates = templates.EnvTemplateManager(self.http_client)
        self.sessions = sessions.SessionManager(self.http_client)
        self.services = services.ServiceManager(self.http_client)
        self.deployments = deployments.DeploymentManager(self.http_client)
        self.schemas = schemas.SchemaManager(self.http_client)
        self.request_statistics = \
            request_statistics.RequestStatisticsManager(self.http_client)
        self.instance_statistics = \
            instance_statistics.InstanceStatisticsManager(self.http_client)
        pkg_mgr = packages.PackageManager(self.http_client)
        if artifacts_client:
            artifact_repo = artifact_packages.ArtifactRepo(artifacts_client,
                                                           tenant)

            self.packages = artifact_packages.PackageManagerAdapter(