示例#1
0
def make_client(service_key, constructor=None, options=None, **kwargs):
    """Simple wrapper for getting a client instance from a client lib.

    OpenStack Client Libraries all have a fairly consistent constructor
    interface which os-client-config supports. In the simple case, there
    is one and only one right way to construct a client object. If as a user
    you don't want to do fancy things, just use this. It honors OS_ environment
    variables and clouds.yaml - and takes as **kwargs anything you'd expect
    to pass in.
    """
    cloud = get_config(service_key=service_key, options=options, **kwargs)
    if not constructor:
        constructor = cloud_config._get_client(service_key)
    return cloud.get_legacy_client(service_key, constructor)
示例#2
0
def make_client(service_key, constructor=None, options=None, **kwargs):
    """Simple wrapper for getting a client instance from a client lib.

    OpenStack Client Libraries all have a fairly consistent constructor
    interface which os-client-config supports. In the simple case, there
    is one and only one right way to construct a client object. If as a user
    you don't want to do fancy things, just use this. It honors OS_ environment
    variables and clouds.yaml - and takes as **kwargs anything you'd expect
    to pass in.
    """
    cloud = get_config(service_key=service_key, options=options, **kwargs)
    if not constructor:
        constructor = cloud_config._get_client(service_key)
    return cloud.get_legacy_client(service_key, constructor)
示例#3
0
 def _get_client(self, service_key):
     constructor = cloud_config._get_client(service_key)
     return self.cloud.get_legacy_client(service_key, constructor)