def __init__(self, **kwargs): """Initialize a new client for the vnfsvc v2.0 API.""" super(Client, self).__init__() self.retries = kwargs.pop('retries', 0) self.raise_errors = kwargs.pop('raise_errors', True) self.httpclient = client.construct_http_client(**kwargs) self.version = '1.0' self.format = 'json' self.action_prefix = "/v%s" % (self.version) self.retry_interval = 1
def initialize(self): if not self._url: httpclient = client.construct_http_client( username=self._username, user_id=self._user_id, tenant_name=self._tenant_name, tenant_id=self._tenant_id, password=self._password, region_name=self._region_name, auth_url=self._auth_url, service_type=self._service_type, endpoint_type=self._endpoint_type, insecure=self._insecure, ca_cert=self._ca_cert, timeout=self._timeout, session=self._session, auth=self._auth, log_credentials=self._log_credentials) httpclient.authenticate() # Populate other password flow attributes self._token = httpclient.auth_token self._url = httpclient.endpoint_url