def delete_credential(credential_id: str): api_client = get_swagger_client() api_instance = swagger_client.CredentialServiceApi(api_client=api_client) try: api_instance.delete_credential(credential_id) except ApiException as e: print("Exception when calling CredentialServiceApi -> delete_credential: %s\n" % e, file=stderr)
def get_credential(credential_id: str) -> ApiCredential: api_client = get_swagger_client() api_instance = swagger_client.CredentialServiceApi(api_client=api_client) try: api_credential: ApiCredential = api_instance.get_credential(credential_id) pprint(api_credential, indent=2) return api_credential except ApiException as e: print("Exception when calling CredentialServiceApi -> get_credential: %s\n" % e, file=stderr) return None
def create_credential(pipeline_id: str, project_id: str, data_assets: [str] = []) -> ApiCredential: api_client = get_swagger_client() api_instance = swagger_client.CredentialServiceApi(api_client=api_client) try: api_credential = ApiCredential(pipeline_id=pipeline_id, project_id=project_id, data_assets=data_assets) api_response: ApiCredential = api_instance.create_credential(api_credential) return api_response except ApiException as e: print("Exception when calling CredentialServiceApi -> create_credential: %s\n" % e, file=stderr) return []
def list_credentials(filter_dict: dict = {}, sort_by: str = None) -> [ApiCredential]: api_client = get_swagger_client() api_instance = swagger_client.CredentialServiceApi(api_client=api_client) try: filter_str = json.dumps(filter_dict) if filter_dict else None api_response: ApiListCredentialsResponse = api_instance.list_credentials(filter=filter_str, sort_by=sort_by) for c in api_response.credentials: print("%s %s pl:%s pr:%s" % (c.id, c.created_at.strftime("%Y-%m-%d %H:%M:%S"), c.pipeline_id, c.project_id)) return api_response.credentials except ApiException as e: print("Exception when calling CredentialServiceApi -> list_credentials: %s\n" % e, file=stderr) return []