def __init__(self, api, name=None, secrets=None, consumers=None, container_ref=None, created=None, updated=None, status=None, secret_refs=None): self._api = api self._secret_manager = secret_manager.SecretManager(api) self._name = name self._container_ref = container_ref self._secret_refs = secret_refs self._cached_secrets = dict() self._initialize_secrets(secrets) if container_ref: self._consumers = consumers if consumers else list() self._created = parse_isotime(created) if created else None self._updated = parse_isotime(updated) if updated else None self._status = status else: self._consumers = list() self._created = None self._updated = None self._status = None self._acl_manager = acl_manager.ACLManager(api) self._acls = None
def __init__(self, session=None, *args, **kwargs): """ Barbican client object used to interact with barbican service. :param session: An instance of keystoneclient.session.Session that can be either authenticated, or not authenticated. When using a non-authenticated Session, you must provide some additional parameters. When no session is provided it will default to a non-authenticated Session. :param endpoint: Barbican endpoint url. Required when a session is not given, or when using a non-authenticated session. When using an authenticated session, the client will attempt to get an endpoint from the session. :param project_id: The project ID used for context in Barbican. Required when a session is not given, or when using a non-authenticated session. When using an authenticated session, the project ID will be provided by the authentication mechanism. :param verify: When a session is not given, the client will create a non-authenticated session. This parameter is passed to the session that is created. If set to False, it allows barbicanclient to perform "insecure" TLS (https) requests. The server's certificate will not be verified against any certificate authorities. WARNING: This option should be used with caution. :param service_type: Used as an endpoint filter when using an authenticated keystone session. Defaults to 'key-management'. :param service_name: Used as an endpoint filter when using an authenticated keystone session. :param interface: Used as an endpoint filter when using an authenticated keystone session. Defaults to 'public'. :param region_name: Used as an endpoint filter when using an authenticated keystone session. """ LOG.debug("Creating Client object") if not session: session = ks_session.Session(verify=kwargs.pop('verify', True)) if session.auth is None and kwargs.get('auth') is None: if not kwargs.get('endpoint'): raise ValueError('Barbican endpoint url must be provided when ' 'not using auth in the Keystone Session.') if kwargs.get('project_id') is None: raise ValueError('Project ID must be provided when not using ' 'auth in the Keystone Session') httpclient = _HTTPClient(session=session, *args, **kwargs) self.secrets = secrets.SecretManager(httpclient) self.orders = orders.OrderManager(httpclient) self.containers = containers.ContainerManager(httpclient) self.cas = cas.CAManager(httpclient) self.acls = acls.ACLManager(httpclient)