def __init__(self): self.clusters = clusters.ClusterManager(None) self.cluster_templates = cluster_templates.ClusterTemplateManager(None) self.node_group_templates = ( node_group_templates.NodeGroupTemplateManager(None)) self.plugins = plugins.PluginManager(None) self.images = images.ImageManager(None) self.data_sources = data_sources.DataSourceManager(None) self.jobs = jobs.JobsManager(None) self.job_executions = job_executions.JobExecutionsManager(None) self.job_binaries = job_binaries.JobBinariesManager(None) self.job_binary_internals = ( job_binary_internals.JobBinaryInternalsManager(None))
def _register_managers(self, client): self.clusters = clusters.ClusterManagerV1(client) self.cluster_templates = ( cluster_templates.ClusterTemplateManagerV1(client)) self.node_group_templates = ( node_group_templates.NodeGroupTemplateManagerV1(client)) self.plugins = plugins.PluginManagerV1(client) self.images = images.ImageManagerV1(client) self.data_sources = data_sources.DataSourceManagerV1(client) self.jobs = jobs.JobsManagerV1(client) self.job_executions = job_executions.JobExecutionsManager(client) self.job_binaries = job_binaries.JobBinariesManagerV1(client) self.job_binary_internals = ( job_binary_internals.JobBinaryInternalsManager(client)) self.job_types = job_types.JobTypesManager(client)
def __init__(self, username=None, api_key=None, project_id=None, project_name=None, auth_url=None, sahara_url=None, endpoint_type='publicURL', service_type='data_processing', input_auth_token=None): if not input_auth_token: keystone = self.get_keystone_client(username=username, api_key=api_key, auth_url=auth_url, project_id=project_id, project_name=project_name) input_auth_token = keystone.auth_token if not input_auth_token: raise RuntimeError("Not Authorized") sahara_catalog_url = sahara_url if not sahara_url: keystone = self.get_keystone_client(username=username, api_key=api_key, auth_url=auth_url, token=input_auth_token, project_id=project_id, project_name=project_name) catalog = keystone.service_catalog.get_endpoints(service_type) if service_type in catalog: for e_type, endpoint in catalog.get(service_type)[0].items(): if str(e_type).lower() == str(endpoint_type).lower(): sahara_catalog_url = endpoint break if not sahara_catalog_url: raise RuntimeError("Could not find Sahara endpoint in catalog") self.client = httpclient.HTTPClient(sahara_catalog_url, input_auth_token) self.clusters = clusters.ClusterManager(self) self.cluster_templates = cluster_templates.ClusterTemplateManager(self) self.node_group_templates = (node_group_templates. NodeGroupTemplateManager(self)) self.plugins = plugins.PluginManager(self) self.images = images.ImageManager(self) self.data_sources = data_sources.DataSourceManager(self) self.jobs = jobs.JobsManager(self) self.job_executions = job_executions.JobExecutionsManager(self) self.job_binaries = job_binaries.JobBinariesManager(self) self.job_binary_internals =\ job_binary_internals.JobBinaryInternalsManager(self)
def __init__(self, username=None, api_key=None, project_id=None, project_name=None, auth_url=None, sahara_url=None, endpoint_type='publicURL', service_type='data-processing', input_auth_token=None, session=None, auth=None, insecure=False, cacert=None, region_name=None, **kwargs): if not session: warnings.simplefilter('once', category=DeprecationWarning) warnings.warn( 'Passing authentication parameters to saharaclient ' 'is deprecated. Please construct and pass an ' 'authenticated session object directly.', DeprecationWarning) warnings.resetwarnings() if input_auth_token: auth = token_endpoint.Token(sahara_url, input_auth_token) else: auth = self._get_keystone_auth(auth_url=auth_url, username=username, api_key=api_key, project_id=project_id, project_name=project_name) verify = True if insecure: verify = False elif cacert: verify = cacert session = keystone_session.Session(verify=verify) if not auth: auth = session.auth # NOTE(Toan): bug #1512801. If sahara_url is provided, it does not # matter if service_type is orthographically correct or not. # Only find Sahara service_type and endpoint in Keystone catalog # if sahara_url is not provided. if not sahara_url: service_type = self._determine_service_type( session, auth, service_type, endpoint_type) kwargs['user_agent'] = USER_AGENT kwargs.setdefault('interface', endpoint_type) kwargs.setdefault('endpoint_override', sahara_url) client = HTTPClient(session=session, auth=auth, service_type=service_type, region_name=region_name, **kwargs) self.clusters = clusters.ClusterManager(client) self.cluster_templates = ( cluster_templates.ClusterTemplateManager(client)) self.node_group_templates = ( node_group_templates.NodeGroupTemplateManager(client)) self.plugins = plugins.PluginManager(client) self.images = images.ImageManager(client) self.data_sources = data_sources.DataSourceManager(client) self.jobs = jobs.JobsManager(client) self.job_executions = job_executions.JobExecutionsManager(client) self.job_binaries = job_binaries.JobBinariesManager(client) self.job_binary_internals = ( job_binary_internals.JobBinaryInternalsManager(client)) self.job_types = job_types.JobTypesManager(client)