def __init__(self, session=None, adapter_options=None, session_options=None): """Initialize a new client for the Gnocchi v1 API.""" session_options = session_options or {} adapter_options = adapter_options or {} adapter_options.setdefault('service_type', "metric") if session is None: session = keystoneauth1.session.Session(**session_options) else: if session_options: raise ValueError("session and session_options are exclusive") self.api = client.SessionClient(session, **adapter_options) self.resource = resource.ResourceManager(self) self.resource_type = resource_type.ResourceTypeManager(self) self.archive_policy = archive_policy.ArchivePolicyManager(self) self.archive_policy_rule = ( archive_policy_rule.ArchivePolicyRuleManager(self)) self.metric = metric.MetricManager(self) self.aggregates = aggregates.AggregatesManager(self) self.capabilities = capabilities.CapabilitiesManager(self) self.status = status.StatusManager(self) self.build = build.BuildManager(self)
def __init__(self, session=None, service_type='metric', **kwargs): """Initialize a new client for the Gnocchi v1 API.""" self.api = client.SessionClient(session, service_type=service_type, **kwargs) self.resource = resource.ResourceManager(self) self.archive_policy = archive_policy.ArchivePolicyManager(self) self.archive_policy_rule = ( archive_policy_rule.ArchivePolicyRuleManager(self)) self.metric = metric.MetricManager(self) self.capabilities = capabilities.CapabilitiesManager(self) self.status = status.StatusManager(self)
def __init__(self, session=None, service_type=None, adapter_options=None, session_options=None, **kwargs): """Initialize a new client for the Gnocchi v1 API.""" session_options = session_options or {} adapter_options = adapter_options or {} adapter_options.setdefault('service_type', "metric") # NOTE(sileht): Backward compat stuff if kwargs: for key in kwargs: debtcollector.deprecate( "Using the '%s' argument is deprecated" % key, message="Please use 'adapter_options=dict(%s=...)' " "instead" % key) adapter_options.update(kwargs) if service_type is not None: adapter_options['service_type'] = service_type if session is None: session = keystoneauth1.session.Session(**session_options) else: if session_options: raise ValueError("session and session_options are exclusive") self.api = client.SessionClient(session, **adapter_options) self.resource = resource.ResourceManager(self) self.resource_type = resource_type.ResourceTypeManager(self) self.archive_policy = archive_policy.ArchivePolicyManager(self) self.archive_policy_rule = ( archive_policy_rule.ArchivePolicyRuleManager(self)) self.metric = metric.MetricManager(self) self.capabilities = capabilities.CapabilitiesManager(self) self.status = status.StatusManager(self)