Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace "endpoint_url" parameter in PurviewCollectionsClient class for "account_name" parameter #235

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions pyapacheatlas/core/collections/purview.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ class PurviewCollectionsClient(AtlasBaseClient):

"""

def __init__(self, endpoint_url: str, authentication, **kwargs):
def __init__(self, account_name: str, authentication, **kwargs):
"""
:param str endpoint_url:
Base URL for purview account, e.g. "https://{account}.purview.azure.com/" .
:param str account_name:
The name of your Microsoft Purview account.
"""
super().__init__(**kwargs)
self.endpoint_url = endpoint_url
self.account_name = account_name
self.authentication = authentication

def upload_single_entity(
Expand All @@ -45,8 +45,7 @@ def upload_single_entity(
:rtype: dict
"""

atlas_endpoint = self.endpoint_url + \
f"catalog/api/collections/{collection}/entity"
atlas_endpoint = f"https://{self.account_name}.purview.azure.com/catalog/api/collections/{collection}/entity"

if isinstance(entity, AtlasEntity):
payload = {"entity": entity.to_json(), "referredEntities": {}}
Expand Down Expand Up @@ -92,8 +91,8 @@ def upload_entities(
:rtype: dict
"""

atlas_endpoint = self.endpoint_url + \
f"catalog/api/collections/{collection}/entity/bulk"
atlas_endpoint = f"https://{self.account_name}.purview.azure.com/" \
f"catalog/api/collections/{collection}/entity/bulk"

payload = PurviewCollectionsClient._prepare_entity_upload(batch)
results = []
Expand Down Expand Up @@ -182,8 +181,8 @@ def move_entities(
:rtype: dict
"""

atlas_endpoint = self.endpoint_url + \
f"catalog/api/collections/{collection}/entity/moveHere"
atlas_endpoint = f"https://{self.account_name}.purview.azure.com/" \
f"catalog/api/collections/{collection}/entity/moveHere"

moveEntityResponse = self._post_http(
atlas_endpoint,
Expand Down Expand Up @@ -234,8 +233,8 @@ def list_collections(
:return: A generator that pages through the list collections
:rtype: List[dict]
"""
atlas_endpoint = self.endpoint_url + \
f"collections?api-version={api_version}"

atlas_endpoint = f"https://{self.account_name}.purview.azure.com/collections?api-version={api_version}"
if skipToken:
atlas_endpoint = atlas_endpoint + f"&$skipToken={skipToken}"

Expand Down Expand Up @@ -277,7 +276,7 @@ def create_or_update_collection(
if description:
payload["description"] = description

collection_endpoint = self.endpoint_url + f"collections/{name}"
collection_endpoint = f"https://{self.account_name}.purview.azure.com/collections/{name}"
cruCollection = self._put_http(
collection_endpoint,
params={"api-version": api_version},
Expand Down