Esempio n. 1
0
    def __init__(self,
                 username=None,
                 password=None,
                 project_id=None,
                 auth_url=None,
                 insecure=False,
                 timeout=None,
                 proxy_tenant_id=None,
                 proxy_token=None,
                 region_name=None,
                 endpoint_type='publicURL',
                 extensions=None,
                 service_type='computev3',
                 service_name=None,
                 volume_service_name=None,
                 timings=False,
                 bypass_url=None,
                 os_cache=False,
                 no_cache=True,
                 http_log_debug=False,
                 auth_system='keystone',
                 auth_plugin=None,
                 auth_token=None,
                 cacert=None,
                 tenant_id=None,
                 user_id=None,
                 connection_pool=False,
                 session=None,
                 auth=None,
                 completion_cache=None):
        # NOTE(cyeoh): In the novaclient context (unlike Nova) the
        # project_id is not the same as the tenant_id. Here project_id
        # is a name (what the Nova API often refers to as a project or
        # tenant name) and tenant_id is a UUID (what the Nova API
        # often refers to as a project_id or tenant_id).

        self.projectid = project_id
        self.tenant_id = tenant_id
        self.user_id = user_id
        self.os_cache = os_cache or not no_cache
        #TODO(bnemec): Add back in v3 extensions
        self.agents = agents.AgentsManager(self)
        self.aggregates = aggregates.AggregateManager(self)
        self.availability_zones = \
            availability_zones.AvailabilityZoneManager(self)
        self.certs = certs.CertificateManager(self)
        self.list_extensions = list_extensions.ListExtManager(self)
        self.hosts = hosts.HostManager(self)
        self.flavors = flavors.FlavorManager(self)
        self.flavor_access = flavor_access.FlavorAccessManager(self)
        self.hypervisors = hypervisors.HypervisorManager(self)
        self.images = images.ImageManager(self)
        self.keypairs = keypairs.KeypairManager(self)
        self.quotas = quotas.QuotaSetManager(self)
        self.servers = servers.ServerManager(self)
        self.services = services.ServiceManager(self)
        self.usage = usage.UsageManager(self)
        self.volumes = volumes.VolumeManager(self)

        # Add in any extensions...
        if extensions:
            for extension in extensions:
                if extension.manager_class:
                    setattr(self, extension.name,
                            extension.manager_class(self))

        self.client = client._construct_http_client(
            username=username,
            password=password,
            user_id=user_id,
            project_id=project_id,
            tenant_id=tenant_id,
            auth_url=auth_url,
            auth_token=auth_token,
            insecure=insecure,
            timeout=timeout,
            auth_system=auth_system,
            auth_plugin=auth_plugin,
            proxy_token=proxy_token,
            proxy_tenant_id=proxy_tenant_id,
            region_name=region_name,
            endpoint_type=endpoint_type,
            service_type=service_type,
            service_name=service_name,
            volume_service_name=volume_service_name,
            timings=timings,
            bypass_url=bypass_url,
            os_cache=self.os_cache,
            http_log_debug=http_log_debug,
            cacert=cacert,
            connection_pool=connection_pool,
            session=session,
            auth=auth)

        self.completion_cache = completion_cache
    def __init__(self, username, password, project_id, auth_url=None,
                  insecure=False, timeout=None, proxy_tenant_id=None,
                  proxy_token=None, region_name=None,
                  endpoint_type='publicURL', extensions=None,
                  service_type='computev3', service_name=None,
                  volume_service_name=None, timings=False,
                  bypass_url=None, os_cache=False, no_cache=True,
                  http_log_debug=False, auth_system='keystone',
                  auth_plugin=None, auth_token=None,
                  cacert=None, tenant_id=None, user_id=None,
                  connection_pool=False):
        self.projectid = project_id
        self.tenant_id = tenant_id
        self.user_id = user_id
        self.os_cache = os_cache or not no_cache
        #TODO(bnemec): Add back in v3 extensions
        self.agents = agents.AgentsManager(self)
        self.aggregates = aggregates.AggregateManager(self)
        self.availability_zones = \
            availability_zones.AvailabilityZoneManager(self)
        self.certs = certs.CertificateManager(self)
        self.list_extensions = list_extensions.ListExtManager(self)
        self.hosts = hosts.HostManager(self)
        self.flavors = flavors.FlavorManager(self)
        self.flavor_access = flavor_access.FlavorAccessManager(self)
        self.hypervisors = hypervisors.HypervisorManager(self)
        self.images = images.ImageManager(self)
        self.keypairs = keypairs.KeypairManager(self)
        self.quotas = quotas.QuotaSetManager(self)
        self.quota_classes = quota_classes.QuotaClassSetManager(self)
        self.servers = servers.ServerManager(self)
        self.services = services.ServiceManager(self)
        self.usage = usage.UsageManager(self)
        self.volumes = volumes.VolumeManager(self)

        # Add in any extensions...
        if extensions:
            for extension in extensions:
                if extension.manager_class:
                    setattr(self, extension.name,
                            extension.manager_class(self))

        self.client = client.HTTPClient(username,
                                    password,
                                    user_id=user_id,
                                    projectid=project_id,
                                    tenant_id=tenant_id,
                                    auth_url=auth_url,
                                    insecure=insecure,
                                    timeout=timeout,
                                    auth_system=auth_system,
                                    auth_plugin=auth_plugin,
                                    auth_token=auth_token,
                                    proxy_token=proxy_token,
                                    proxy_tenant_id=proxy_tenant_id,
                                    region_name=region_name,
                                    endpoint_type=endpoint_type,
                                    service_type=service_type,
                                    service_name=service_name,
                                    volume_service_name=volume_service_name,
                                    timings=timings,
                                    bypass_url=bypass_url,
                                    os_cache=os_cache,
                                    http_log_debug=http_log_debug,
                                    cacert=cacert,
                                    connection_pool=connection_pool)