From caf3e1abbebc4070b448daa777c24224dbd79076 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 28 Nov 2023 06:11:42 +0000 Subject: [PATCH] CodeGen from PR 26702 in Azure/azure-rest-api-specs Merge 2d1cd1b7ba8a4fd7d009c469936ce5fad054e45c into 58561151bac45fcd686dec2bae22b95bba5e5186 --- .../CHANGELOG.md | 5 + .../azure-analytics-purview-datamap/LICENSE | 21 + .../MANIFEST.in | 8 + .../azure-analytics-purview-datamap/README.md | 80 + .../_meta.json | 6 + .../azure/__init__.py | 1 + .../azure/analytics/__init__.py | 1 + .../azure/analytics/purview/__init__.py | 1 + .../analytics/purview/datamap/__init__.py | 36 + .../analytics/purview/datamap/_client.py | 492 + .../purview/datamap/_configuration.py | 305 + .../analytics/purview/datamap/_model_base.py | 826 ++ .../purview/datamap/_operations/__init__.py | 29 + .../datamap/_operations/_operations.py | 11945 ++++++++++++++++ .../purview/datamap/_operations/_patch.py | 20 + .../azure/analytics/purview/datamap/_patch.py | 20 + .../purview/datamap/_serialization.py | 2004 +++ .../analytics/purview/datamap/_vendor.py | 78 + .../analytics/purview/datamap/_version.py | 9 + .../analytics/purview/datamap/aio/__init__.py | 33 + .../analytics/purview/datamap/aio/_client.py | 504 + .../purview/datamap/aio/_configuration.py | 305 + .../datamap/aio/_operations/__init__.py | 29 + .../datamap/aio/_operations/_operations.py | 9423 ++++++++++++ .../purview/datamap/aio/_operations/_patch.py | 20 + .../analytics/purview/datamap/aio/_patch.py | 20 + .../analytics/purview/datamap/aio/_vendor.py | 78 + .../purview/datamap/models/__init__.py | 183 + .../purview/datamap/models/_enums.py | 213 + .../purview/datamap/models/_models.py | 4846 +++++++ .../purview/datamap/models/_patch.py | 20 + .../azure/analytics/purview/datamap/py.typed | 1 + .../dev_requirements.txt | 5 + .../sdk_packaging.toml | 2 + .../azure-analytics-purview-datamap/setup.py | 72 + .../tsp-location.yaml | 5 + sdk/purview/ci.yml | 2 + 37 files changed, 31648 insertions(+) create mode 100644 sdk/purview/azure-analytics-purview-datamap/CHANGELOG.md create mode 100644 sdk/purview/azure-analytics-purview-datamap/LICENSE create mode 100644 sdk/purview/azure-analytics-purview-datamap/MANIFEST.in create mode 100644 sdk/purview/azure-analytics-purview-datamap/README.md create mode 100644 sdk/purview/azure-analytics-purview-datamap/_meta.json create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/__init__.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/__init__.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/__init__.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/__init__.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_client.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_configuration.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_model_base.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_operations/__init__.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_operations/_operations.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_operations/_patch.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_patch.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_serialization.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_vendor.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_version.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/__init__.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_client.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_configuration.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_operations/__init__.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_operations/_operations.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_operations/_patch.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_patch.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_vendor.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/models/__init__.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/models/_enums.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/models/_models.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/models/_patch.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/py.typed create mode 100644 sdk/purview/azure-analytics-purview-datamap/dev_requirements.txt create mode 100644 sdk/purview/azure-analytics-purview-datamap/sdk_packaging.toml create mode 100644 sdk/purview/azure-analytics-purview-datamap/setup.py create mode 100644 sdk/purview/azure-analytics-purview-datamap/tsp-location.yaml diff --git a/sdk/purview/azure-analytics-purview-datamap/CHANGELOG.md b/sdk/purview/azure-analytics-purview-datamap/CHANGELOG.md new file mode 100644 index 0000000000000..628743d283a92 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0b1 (1970-01-01) + +- Initial version diff --git a/sdk/purview/azure-analytics-purview-datamap/LICENSE b/sdk/purview/azure-analytics-purview-datamap/LICENSE new file mode 100644 index 0000000000000..63447fd8bbbf7 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/purview/azure-analytics-purview-datamap/MANIFEST.in b/sdk/purview/azure-analytics-purview-datamap/MANIFEST.in new file mode 100644 index 0000000000000..ac3c79dec544c --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/MANIFEST.in @@ -0,0 +1,8 @@ +include *.md +include LICENSE +include azure/analytics/purview/datamap/py.typed +recursive-include tests *.py +recursive-include samples *.py *.md +include azure/__init__.py +include azure/analytics/__init__.py +include azure/analytics/purview/__init__.py \ No newline at end of file diff --git a/sdk/purview/azure-analytics-purview-datamap/README.md b/sdk/purview/azure-analytics-purview-datamap/README.md new file mode 100644 index 0000000000000..2b9bdfa59ef09 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/README.md @@ -0,0 +1,80 @@ + + +# Azure Analytics Purview Datamap client library for Python + + +## Getting started + +### Installating the package + +```bash +python -m pip install azure-analytics-purview-datamap +``` + +#### Prequisites + +- Python 3.7 or later is required to use this package. +- You need an [Azure subscription][azure_sub] to use this package. +- An existing Azure Analytics Purview Datamap instance. +#### Create with an Azure Active Directory Credential +To use an [Azure Active Directory (AAD) token credential][authenticate_with_token], +provide an instance of the desired credential type obtained from the +[azure-identity][azure_identity_credentials] library. + +To authenticate with AAD, you must first [pip][pip] install [`azure-identity`][azure_identity_pip] + +After setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use. +As an example, [DefaultAzureCredential][default_azure_credential] can be used to authenticate the client: + +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: +`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET` + +Use the returned token credential to authenticate the client: + +```python +>>> from azure.analytics.purview.datamap import EntityClient +>>> from azure.identity import DefaultAzureCredential +>>> client = EntityClient(endpoint='', credential=DefaultAzureCredential()) +``` + +## Examples + +```python +>>> from azure.analytics.purview.datamap import EntityClient +>>> from azure.identity import DefaultAzureCredential +>>> from azure.core.exceptions import HttpResponseError + +>>> client = EntityClient(endpoint='', credential=DefaultAzureCredential()) +>>> try: + + except HttpResponseError as e: + print('service responds error: {}'.format(e.response.json())) + +``` + +## Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information, +see the Code of Conduct FAQ or contact opencode@microsoft.com with any +additional questions or comments. + + +[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/ +[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials +[azure_identity_pip]: https://pypi.org/project/azure-identity/ +[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential +[pip]: https://pypi.org/project/pip/ +[azure_sub]: https://azure.microsoft.com/free/ + diff --git a/sdk/purview/azure-analytics-purview-datamap/_meta.json b/sdk/purview/azure-analytics-purview-datamap/_meta.json new file mode 100644 index 0000000000000..57f8dbb0fe396 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/_meta.json @@ -0,0 +1,6 @@ +{ + "commit": "e2d12f2c2352e634cbb405b7ceca438ead8b53fd", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "typespec_src": "specification/purview/Azure.Analytics.Purview.DataMap", + "@azure-tools/typespec-python": "0.15.14" +} \ No newline at end of file diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/__init__.py b/sdk/purview/azure-analytics-purview-datamap/azure/__init__.py new file mode 100644 index 0000000000000..d55ccad1f573f --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/__init__.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/__init__.py new file mode 100644 index 0000000000000..d55ccad1f573f --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/__init__.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/__init__.py new file mode 100644 index 0000000000000..d55ccad1f573f --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/__init__.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/__init__.py new file mode 100644 index 0000000000000..4980794b1038f --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/__init__.py @@ -0,0 +1,36 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._client import EntityClient +from ._client import GlossaryClient +from ._client import DiscoveryClient +from ._client import LineageClient +from ._client import RelationshipClient +from ._client import TypeClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "EntityClient", + "GlossaryClient", + "DiscoveryClient", + "LineageClient", + "RelationshipClient", + "TypeClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_client.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_client.py new file mode 100644 index 0000000000000..315c5e9875005 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_client.py @@ -0,0 +1,492 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core import PipelineClient +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse + +from ._configuration import ( + DiscoveryClientConfiguration, + EntityClientConfiguration, + GlossaryClientConfiguration, + LineageClientConfiguration, + RelationshipClientConfiguration, + TypeClientConfiguration, +) +from ._operations import ( + DiscoveryClientOperationsMixin, + EntityClientOperationsMixin, + GlossaryClientOperationsMixin, + LineageClientOperationsMixin, + RelationshipClientOperationsMixin, + TypeClientOperationsMixin, +) +from ._serialization import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class EntityClient(EntityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword + """EntityClient. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{endpoint}/datamap/api" + self._config = EntityClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + + def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "EntityClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) + + +class GlossaryClient(GlossaryClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword + """GlossaryClient. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{endpoint}/datamap/api" + self._config = GlossaryClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + + def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "GlossaryClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) + + +class DiscoveryClient(DiscoveryClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword + """DiscoveryClient. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{endpoint}/datamap/api" + self._config = DiscoveryClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + + def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "DiscoveryClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) + + +class LineageClient(LineageClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword + """LineageClient. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{endpoint}/datamap/api" + self._config = LineageClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + + def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "LineageClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) + + +class RelationshipClient(RelationshipClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword + """RelationshipClient. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{endpoint}/datamap/api" + self._config = RelationshipClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + + def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "RelationshipClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) + + +class TypeClient(TypeClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword + """TypeClient. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: + _endpoint = "{endpoint}/datamap/api" + self._config = TypeClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + + def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "TypeClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_configuration.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_configuration.py new file mode 100644 index 0000000000000..c6c32375229b0 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_configuration.py @@ -0,0 +1,305 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.pipeline import policies + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class EntityClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for EntityClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2023-09-01") + + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.endpoint = endpoint + self.credential = credential + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["user_impersonation"]) + kwargs.setdefault("sdk_moniker", "analytics-purview-datamap/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy( + self.credential, *self.credential_scopes, **kwargs + ) + + +class GlossaryClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for GlossaryClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2023-09-01") + + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.endpoint = endpoint + self.credential = credential + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["user_impersonation"]) + kwargs.setdefault("sdk_moniker", "analytics-purview-datamap/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy( + self.credential, *self.credential_scopes, **kwargs + ) + + +class DiscoveryClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for DiscoveryClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2023-09-01") + + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.endpoint = endpoint + self.credential = credential + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["user_impersonation"]) + kwargs.setdefault("sdk_moniker", "analytics-purview-datamap/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy( + self.credential, *self.credential_scopes, **kwargs + ) + + +class LineageClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for LineageClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2023-09-01") + + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.endpoint = endpoint + self.credential = credential + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["user_impersonation"]) + kwargs.setdefault("sdk_moniker", "analytics-purview-datamap/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy( + self.credential, *self.credential_scopes, **kwargs + ) + + +class RelationshipClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for RelationshipClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2023-09-01") + + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.endpoint = endpoint + self.credential = credential + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["user_impersonation"]) + kwargs.setdefault("sdk_moniker", "analytics-purview-datamap/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy( + self.credential, *self.credential_scopes, **kwargs + ) + + +class TypeClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for TypeClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2023-09-01") + + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.endpoint = endpoint + self.credential = credential + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["user_impersonation"]) + kwargs.setdefault("sdk_moniker", "analytics-purview-datamap/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_model_base.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_model_base.py new file mode 100644 index 0000000000000..19345476efdc0 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_model_base.py @@ -0,0 +1,826 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, arguments-differ, signature-differs, broad-except +# pyright: reportGeneralTypeIssues=false + +import calendar +import functools +import sys +import logging +import base64 +import re +import copy +import typing +import email +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] # pylint: disable=protected-access + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") +_VALID_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _VALID_DATE.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + return date_obj + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): # pylint: disable=unsubscriptable-object + def __init__(self, data: typing.Dict[str, typing.Any]) -> None: + self._data = copy.deepcopy(data) + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + try: + return self[key] + except KeyError: + return default + + @typing.overload # type: ignore + def pop(self, key: str) -> typing.Any: # pylint: disable=no-member + ... + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: + ... + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> typing.Tuple[str, typing.Any]: + return self._data.popitem() + + def clear(self) -> None: + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: + self._data.update(*args, **kwargs) + + @typing.overload # type: ignore + def setdefault(self, key: str) -> typing.Any: + ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: + ... + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field( + attr_to_rest_field: typing.Dict[str, "_RestField"], rest_name: str +) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + return _deserialize(rf._type, value) if (rf and rf._is_model) else _serialize(value, rf._format if rf else None) + + +class Model(_MyMutableMapping): + _is_model = True + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass = { + rest_field._rest_name: rest_field._default + for rest_field in self._attr_to_rest_field.values() + if rest_field._default is not _UNSET + } + if args: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + super().__init__(dict_to_pass) + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> "Model": # pylint: disable=unused-argument + # we know the last three classes in mro are going to be 'Model', 'dict', and 'object' + mros = cls.__mro__[:-3][::-1] # ignore model, dict, and object parents, and reverse the mro order + attr_to_rest_field: typing.Dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") # pylint: disable=no-member + for k, v in mro_class.__annotations__.items() # pylint: disable=no-member + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items()) + + return super().__new__(cls) # pylint: disable=no-value-for-parameter + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): # pylint: disable=no-member + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore # pylint: disable=no-member + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional[str]: + for v in cls.__dict__.values(): + if ( + isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators + ): # pylint: disable=protected-access + return v._rest_name # pylint: disable=protected-access + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): # pylint: disable=no-member + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + exist_discriminators.append(discriminator) + mapped_cls = cls.__mapping__.get(data.get(discriminator), cls) # pylint: disable=no-member + if mapped_cls == cls: + return cls(data) + return mapped_cls._deserialize(data, exist_discriminators) # pylint: disable=protected-access + + def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]: + """Return a dict that can be JSONify using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore[reportUnboundVariable] + continue + result[k] = Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return [Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v] + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915, R0912 + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation or annotation in [int, float]: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + return functools.partial(_deserialize_model, annotation) + except Exception: + pass + + # is it a literal? + try: + if sys.version_info >= (3, 8): + from typing import ( + Literal, + ) # pylint: disable=no-name-in-module, ungrouped-imports + else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + + if annotation.__origin__ == Literal: + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a for a in annotation.__args__ if a == type(None)): + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a != type(None)), module, rf + ) + + def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + except AttributeError: + pass + + if getattr(annotation, "__origin__", None) is typing.Union: + deserializers = [_get_deserialize_callable_from_annotation(arg, module, rf) for arg in annotation.__args__] + + def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + return functools.partial(_deserialize_with_union, deserializers) + + try: + if annotation._name == "Dict": + key_deserializer = _get_deserialize_callable_from_annotation(annotation.__args__[0], module, rf) + value_deserializer = _get_deserialize_callable_from_annotation(annotation.__args__[1], module, rf) + + def _deserialize_dict( + key_deserializer: typing.Optional[typing.Callable], + value_deserializer: typing.Optional[typing.Callable], + obj: typing.Dict[typing.Any, typing.Any], + ): + if obj is None: + return obj + return { + _deserialize(key_deserializer, k, module): _deserialize(value_deserializer, v, module) + for k, v in obj.items() + } + + return functools.partial( + _deserialize_dict, + key_deserializer, + value_deserializer, + ) + except (AttributeError, IndexError): + pass + try: + if annotation._name in ["List", "Set", "Tuple", "Sequence"]: + if len(annotation.__args__) > 1: + + def _deserialize_multiple_sequence( + entry_deserializers: typing.List[typing.Optional[typing.Callable]], + obj, + ): + if obj is None: + return obj + return type(obj)( + _deserialize(deserializer, entry, module) + for entry, deserializer in zip(obj, entry_deserializers) + ) + + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) for dt in annotation.__args__ + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers) + deserializer = _get_deserialize_callable_from_annotation(annotation.__args__[0], module, rf) + + def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + obj, + ): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + return functools.partial(_deserialize_sequence, deserializer) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + annotation, + deserializer_from_mapping, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(annotation, obj) + except Exception: + pass + return _deserialize_with_callable(deserializer_from_mapping, obj) + + return functools.partial(_deserialize_default, annotation, get_deserializer(annotation, rf)) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): + try: + if value is None: + return None + if deserializer is None: + return value + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value) + except ValueError: + # for unknown value, return raw value + return value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[typing.List[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._default = default + self._format = format + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + item = obj.get(self._rest_name) + if item is None: + return item + if self._is_model: + return item + return _deserialize(self._type, _serialize(item, self._format), rf=self) + + def __set__(self, obj: Model, value) -> None: + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[typing.List[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, +) -> typing.Any: + return _RestField(name=name, type=type, visibility=visibility, default=default, format=format) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True) diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_operations/__init__.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_operations/__init__.py new file mode 100644 index 0000000000000..203123c1f4b63 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_operations/__init__.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import EntityClientOperationsMixin +from ._operations import GlossaryClientOperationsMixin +from ._operations import DiscoveryClientOperationsMixin +from ._operations import LineageClientOperationsMixin +from ._operations import RelationshipClientOperationsMixin +from ._operations import TypeClientOperationsMixin + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "EntityClientOperationsMixin", + "GlossaryClientOperationsMixin", + "DiscoveryClientOperationsMixin", + "LineageClientOperationsMixin", + "RelationshipClientOperationsMixin", + "TypeClientOperationsMixin", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_operations/_operations.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_operations/_operations.py new file mode 100644 index 0000000000000..7d4eed9b33395 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_operations/_operations.py @@ -0,0 +1,11945 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import json +import sys +from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from .. import models as _models +from .._model_base import SdkJSONEncoder, _deserialize +from .._serialization import Serializer +from .._vendor import ( + DiscoveryClientMixinABC, + EntityClientMixinABC, + GlossaryClientMixinABC, + LineageClientMixinABC, + RelationshipClientMixinABC, + TypeClientMixinABC, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +_Unset: Any = object() +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_entity_create_or_update_request( + *, + business_attribute_update_behavior: Optional[Union[str, _models.BusinessAttributeUpdateBehavior]] = None, + collection_id: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/entity" + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if business_attribute_update_behavior is not None: + _params["businessAttributeUpdateBehavior"] = _SERIALIZER.query( + "business_attribute_update_behavior", business_attribute_update_behavior, "str" + ) + if collection_id is not None: + _params["collectionId"] = _SERIALIZER.query("collection_id", collection_id, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_list_by_guids_request( + *, guid: List[str], min_ext_info: Optional[bool] = None, ignore_relationships: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/entity/bulk" + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["guid"] = [_SERIALIZER.query("guid", q, "str") if q is not None else "" for q in guid] + if min_ext_info is not None: + _params["minExtInfo"] = _SERIALIZER.query("min_ext_info", min_ext_info, "bool") + if ignore_relationships is not None: + _params["ignoreRelationships"] = _SERIALIZER.query("ignore_relationships", ignore_relationships, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_bulk_create_or_update_request( # pylint: disable=name-too-long + *, + collection_id: Optional[str] = None, + business_attribute_update_behavior: Optional[Union[str, _models.BusinessAttributeUpdateBehavior]] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/entity/bulk" + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if collection_id is not None: + _params["collectionId"] = _SERIALIZER.query("collection_id", collection_id, "str") + if business_attribute_update_behavior is not None: + _params["businessAttributeUpdateBehavior"] = _SERIALIZER.query( + "business_attribute_update_behavior", business_attribute_update_behavior, "str" + ) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_bulk_delete_request(*, guid: List[str], **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/entity/bulk" + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["guid"] = [_SERIALIZER.query("guid", q, "str") if q is not None else "" for q in guid] + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_add_classification_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/entity/bulk/classification" + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_get_request( + guid: str, *, min_ext_info: Optional[bool] = None, ignore_relationships: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/entity/guid/{guid}" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if min_ext_info is not None: + _params["minExtInfo"] = _SERIALIZER.query("min_ext_info", min_ext_info, "bool") + if ignore_relationships is not None: + _params["ignoreRelationships"] = _SERIALIZER.query("ignore_relationships", ignore_relationships, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_partial_update_attribute_by_guid_request( # pylint: disable=name-too-long + guid: str, *, name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/entity/guid/{guid}" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["name"] = _SERIALIZER.query("name", name, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_delete_request(guid: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/entity/guid/{guid}" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_get_classification_request(guid: str, classification_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/entity/guid/{guid}/classification/{classificationName}" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + "classificationName": _SERIALIZER.url("classification_name", classification_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_remove_classification_request( # pylint: disable=name-too-long + guid: str, classification_name: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/entity/guid/{guid}/classification/{classificationName}" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + "classificationName": _SERIALIZER.url("classification_name", classification_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_entity_get_classifications_request(guid: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/entity/guid/{guid}/classifications" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_add_classifications_request(guid: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/entity/guid/{guid}/classifications" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_update_classifications_request( # pylint: disable=name-too-long + guid: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/entity/guid/{guid}/classifications" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_get_by_unique_attributes_request( # pylint: disable=name-too-long + type_name: str, + *, + min_ext_info: Optional[bool] = None, + ignore_relationships: Optional[bool] = None, + attr: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/entity/uniqueAttribute/type/{typeName}" + path_format_arguments = { + "typeName": _SERIALIZER.url("type_name", type_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if min_ext_info is not None: + _params["minExtInfo"] = _SERIALIZER.query("min_ext_info", min_ext_info, "bool") + if ignore_relationships is not None: + _params["ignoreRelationships"] = _SERIALIZER.query("ignore_relationships", ignore_relationships, "bool") + if attr is not None: + _params["attr:qualifiedName"] = _SERIALIZER.query("attr", attr, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_partial_update_by_unique_attributes_request( # pylint: disable=name-too-long + type_name: str, *, attr: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/entity/uniqueAttribute/type/{typeName}" + path_format_arguments = { + "typeName": _SERIALIZER.url("type_name", type_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if attr is not None: + _params["attr:qualifiedName"] = _SERIALIZER.query("attr", attr, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_delete_by_unique_attribute_request( # pylint: disable=name-too-long + type_name: str, *, attr: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/entity/uniqueAttribute/type/{typeName}" + path_format_arguments = { + "typeName": _SERIALIZER.url("type_name", type_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if attr is not None: + _params["attr:qualifiedName"] = _SERIALIZER.query("attr", attr, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_remove_classification_by_unique_attribute_request( # pylint: disable=name-too-long + type_name: str, classification_name: str, *, attr: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/entity/uniqueAttribute/type/{typeName}/classification/{classificationName}" + path_format_arguments = { + "typeName": _SERIALIZER.url("type_name", type_name, "str"), + "classificationName": _SERIALIZER.url("classification_name", classification_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if attr is not None: + _params["attr:qualifiedName"] = _SERIALIZER.query("attr", attr, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_entity_add_classifications_by_unique_attribute_request( # pylint: disable=name-too-long + type_name: str, *, attr: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/entity/uniqueAttribute/type/{typeName}/classifications" + path_format_arguments = { + "typeName": _SERIALIZER.url("type_name", type_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if attr is not None: + _params["attr:qualifiedName"] = _SERIALIZER.query("attr", attr, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_update_classifications_by_unique_attribute_request( # pylint: disable=name-too-long + type_name: str, *, attr: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/entity/uniqueAttribute/type/{typeName}/classifications" + path_format_arguments = { + "typeName": _SERIALIZER.url("type_name", type_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if attr is not None: + _params["attr:qualifiedName"] = _SERIALIZER.query("attr", attr, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_bulk_set_classifications_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/entity/bulk/setClassifications" + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_list_by_unique_attributes_request( # pylint: disable=name-too-long + type_name: str, + *, + min_ext_info: Optional[bool] = None, + ignore_relationships: Optional[bool] = None, + attr_n_qualified_name: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/entity/bulk/uniqueAttribute/type/{typeName}" + path_format_arguments = { + "typeName": _SERIALIZER.url("type_name", type_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if min_ext_info is not None: + _params["minExtInfo"] = _SERIALIZER.query("min_ext_info", min_ext_info, "bool") + if ignore_relationships is not None: + _params["ignoreRelationships"] = _SERIALIZER.query("ignore_relationships", ignore_relationships, "bool") + if attr_n_qualified_name is not None: + _params["attr_N:qualifiedName"] = _SERIALIZER.query("attr_n_qualified_name", attr_n_qualified_name, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_get_header_request(guid: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/entity/guid/{guid}/header" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_remove_business_metadata_request( # pylint: disable=name-too-long + guid: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/entity/guid/{guid}/businessmetadata" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_add_or_update_business_metadata_request( # pylint: disable=name-too-long + guid: str, *, is_overwrite: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/entity/guid/{guid}/businessmetadata" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if is_overwrite is not None: + _params["isOverwrite"] = _SERIALIZER.query("is_overwrite", is_overwrite, "bool") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_remove_business_metadata_attributes_request( # pylint: disable=name-too-long + bm_name: str, guid: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/entity/guid/{guid}/businessmetadata/{bmName}" + path_format_arguments = { + "bmName": _SERIALIZER.url("bm_name", bm_name, "str"), + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_add_or_update_business_metadata_attributes_request( # pylint: disable=name-too-long + bm_name: str, guid: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/entity/guid/{guid}/businessmetadata/{bmName}" + path_format_arguments = { + "bmName": _SERIALIZER.url("bm_name", bm_name, "str"), + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_get_sample_business_metadata_template_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/entity/businessmetadata/import/template" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_import_business_metadata_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: str = kwargs.pop("content_type") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/entity/businessmetadata/import" + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_remove_labels_request(guid: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/entity/guid/{guid}/labels" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_set_labels_request(guid: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/entity/guid/{guid}/labels" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_add_label_request(guid: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/entity/guid/{guid}/labels" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_remove_labels_by_unique_attribute_request( # pylint: disable=name-too-long + type_name: str, *, attr: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/entity/uniqueAttribute/type/{typeName}/labels" + path_format_arguments = { + "typeName": _SERIALIZER.url("type_name", type_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if attr is not None: + _params["attr:qualifiedName"] = _SERIALIZER.query("attr", attr, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_set_labels_by_unique_attribute_request( # pylint: disable=name-too-long + type_name: str, *, attr: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/entity/uniqueAttribute/type/{typeName}/labels" + path_format_arguments = { + "typeName": _SERIALIZER.url("type_name", type_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if attr is not None: + _params["attr:qualifiedName"] = _SERIALIZER.query("attr", attr, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_add_labels_by_unique_attribute_request( # pylint: disable=name-too-long + type_name: str, *, attr: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/entity/uniqueAttribute/type/{typeName}/labels" + path_format_arguments = { + "typeName": _SERIALIZER.url("type_name", type_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if attr is not None: + _params["attr:qualifiedName"] = _SERIALIZER.query("attr", attr, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_entity_move_entities_to_collection_request( # pylint: disable=name-too-long + *, collection_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/entity/moveTo" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["collectionId"] = _SERIALIZER.query("collection_id", collection_id, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_list_request( + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + ignore_terms_and_categories: Optional[bool] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary" + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if offset is not None: + _params["offset"] = _SERIALIZER.query("offset", offset, "int") + if sort is not None: + _params["sort"] = _SERIALIZER.query("sort", sort, "str") + if ignore_terms_and_categories is not None: + _params["ignoreTermsAndCategories"] = _SERIALIZER.query( + "ignore_terms_and_categories", ignore_terms_and_categories, "bool" + ) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_create_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary" + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_create_categories_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/categories" + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_create_category_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/category" + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_get_category_request(category_guid: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/category/{categoryGuid}" + path_format_arguments = { + "categoryGuid": _SERIALIZER.url("category_guid", category_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_update_category_request(category_guid: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/category/{categoryGuid}" + path_format_arguments = { + "categoryGuid": _SERIALIZER.url("category_guid", category_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_delete_category_request(category_guid: str, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/glossary/category/{categoryGuid}" + path_format_arguments = { + "categoryGuid": _SERIALIZER.url("category_guid", category_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_glossary_partial_update_category_request( # pylint: disable=name-too-long + category_guid: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/category/{categoryGuid}/partial" + path_format_arguments = { + "categoryGuid": _SERIALIZER.url("category_guid", category_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_list_related_categories_request( # pylint: disable=name-too-long + category_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/category/{categoryGuid}/related" + path_format_arguments = { + "categoryGuid": _SERIALIZER.url("category_guid", category_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if offset is not None: + _params["offset"] = _SERIALIZER.query("offset", offset, "int") + if sort is not None: + _params["sort"] = _SERIALIZER.query("sort", sort, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_list_category_terms_request( # pylint: disable=name-too-long + category_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/category/{categoryGuid}/terms" + path_format_arguments = { + "categoryGuid": _SERIALIZER.url("category_guid", category_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if offset is not None: + _params["offset"] = _SERIALIZER.query("offset", offset, "int") + if sort is not None: + _params["sort"] = _SERIALIZER.query("sort", sort, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_create_term_request(*, include_term_hierarchy: Optional[bool] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/term" + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if include_term_hierarchy is not None: + _params["includeTermHierarchy"] = _SERIALIZER.query("include_term_hierarchy", include_term_hierarchy, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_get_term_request(term_guid: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/term/{termGuid}" + path_format_arguments = { + "termGuid": _SERIALIZER.url("term_guid", term_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_update_term_request( + term_guid: str, *, include_term_hierarchy: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/term/{termGuid}" + path_format_arguments = { + "termGuid": _SERIALIZER.url("term_guid", term_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if include_term_hierarchy is not None: + _params["includeTermHierarchy"] = _SERIALIZER.query("include_term_hierarchy", include_term_hierarchy, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_delete_term_request(term_guid: str, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/glossary/term/{termGuid}" + path_format_arguments = { + "termGuid": _SERIALIZER.url("term_guid", term_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_glossary_partial_update_term_request( # pylint: disable=name-too-long + term_guid: str, *, include_term_hierarchy: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/term/{termGuid}/partial" + path_format_arguments = { + "termGuid": _SERIALIZER.url("term_guid", term_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if include_term_hierarchy is not None: + _params["includeTermHierarchy"] = _SERIALIZER.query("include_term_hierarchy", include_term_hierarchy, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_create_terms_request(*, include_term_hierarchy: Optional[bool] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/terms" + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if include_term_hierarchy is not None: + _params["includeTermHierarchy"] = _SERIALIZER.query("include_term_hierarchy", include_term_hierarchy, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_list_entities_assigned_with_term_request( # pylint: disable=name-too-long + term_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/terms/{termGuid}/assignedEntities" + path_format_arguments = { + "termGuid": _SERIALIZER.url("term_guid", term_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if offset is not None: + _params["offset"] = _SERIALIZER.query("offset", offset, "int") + if sort is not None: + _params["sort"] = _SERIALIZER.query("sort", sort, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_assign_term_to_entities_request( # pylint: disable=name-too-long + term_guid: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/glossary/terms/{termGuid}/assignedEntities" + path_format_arguments = { + "termGuid": _SERIALIZER.url("term_guid", term_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_delete_term_assignment_from_entities_request( # pylint: disable=name-too-long + term_guid: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/glossary/terms/{termGuid}/assignedEntities" + path_format_arguments = { + "termGuid": _SERIALIZER.url("term_guid", term_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_list_related_terms_request( # pylint: disable=name-too-long + term_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/terms/{termGuid}/related" + path_format_arguments = { + "termGuid": _SERIALIZER.url("term_guid", term_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if offset is not None: + _params["offset"] = _SERIALIZER.query("offset", offset, "int") + if sort is not None: + _params["sort"] = _SERIALIZER.query("sort", sort, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_get_request(glossary_guid: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/{glossaryGuid}" + path_format_arguments = { + "glossaryGuid": _SERIALIZER.url("glossary_guid", glossary_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_update_request( + glossary_guid: str, *, ignore_terms_and_categories: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/{glossaryGuid}" + path_format_arguments = { + "glossaryGuid": _SERIALIZER.url("glossary_guid", glossary_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if ignore_terms_and_categories is not None: + _params["ignoreTermsAndCategories"] = _SERIALIZER.query( + "ignore_terms_and_categories", ignore_terms_and_categories, "bool" + ) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_delete_request(glossary_guid: str, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/glossary/{glossaryGuid}" + path_format_arguments = { + "glossaryGuid": _SERIALIZER.url("glossary_guid", glossary_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_glossary_list_categories_request( + glossary_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/{glossaryGuid}/categories" + path_format_arguments = { + "glossaryGuid": _SERIALIZER.url("glossary_guid", glossary_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if offset is not None: + _params["offset"] = _SERIALIZER.query("offset", offset, "int") + if sort is not None: + _params["sort"] = _SERIALIZER.query("sort", sort, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_list_categories_headers_request( # pylint: disable=name-too-long + glossary_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/{glossaryGuid}/categories/headers" + path_format_arguments = { + "glossaryGuid": _SERIALIZER.url("glossary_guid", glossary_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if offset is not None: + _params["offset"] = _SERIALIZER.query("offset", offset, "int") + if sort is not None: + _params["sort"] = _SERIALIZER.query("sort", sort, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_get_detailed_request(glossary_guid: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/{glossaryGuid}/detailed" + path_format_arguments = { + "glossaryGuid": _SERIALIZER.url("glossary_guid", glossary_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_partial_update_request( + glossary_guid: str, *, ignore_terms_and_categories: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/{glossaryGuid}/partial" + path_format_arguments = { + "glossaryGuid": _SERIALIZER.url("glossary_guid", glossary_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if ignore_terms_and_categories is not None: + _params["ignoreTermsAndCategories"] = _SERIALIZER.query( + "ignore_terms_and_categories", ignore_terms_and_categories, "bool" + ) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_list_terms_request( + glossary_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/{glossaryGuid}/terms" + path_format_arguments = { + "glossaryGuid": _SERIALIZER.url("glossary_guid", glossary_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if offset is not None: + _params["offset"] = _SERIALIZER.query("offset", offset, "int") + if sort is not None: + _params["sort"] = _SERIALIZER.query("sort", sort, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_glossary_list_term_headers_request( + glossary_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/glossary/{glossaryGuid}/terms/headers" + path_format_arguments = { + "glossaryGuid": _SERIALIZER.url("glossary_guid", glossary_guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if offset is not None: + _params["offset"] = _SERIALIZER.query("offset", offset, "int") + if sort is not None: + _params["sort"] = _SERIALIZER.query("sort", sort, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_discovery_query_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/search/query" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_discovery_suggest_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/search/suggest" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_discovery_auto_complete_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/search/autocomplete" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_lineage_get_request( + guid: str, *, direction: Union[str, _models.Direction], depth: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/lineage/{guid}" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if depth is not None: + _params["depth"] = _SERIALIZER.query("depth", depth, "int") + _params["direction"] = _SERIALIZER.query("direction", direction, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_lineage_get_next_page_request( + guid: str, + *, + direction: Union[str, _models.Direction], + offset: Optional[int] = None, + limit: Optional[int] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/lineage/{guid}/next" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["direction"] = _SERIALIZER.query("direction", direction, "str") + if offset is not None: + _params["offset"] = _SERIALIZER.query("offset", offset, "int") + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_lineage_get_by_unique_attribute_request( # pylint: disable=name-too-long + type_name: str, + *, + direction: Union[str, _models.Direction], + depth: Optional[int] = None, + attr: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/lineage/uniqueAttribute/type/{typeName}" + path_format_arguments = { + "typeName": _SERIALIZER.url("type_name", type_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if depth is not None: + _params["depth"] = _SERIALIZER.query("depth", depth, "int") + _params["direction"] = _SERIALIZER.query("direction", direction, "str") + if attr is not None: + _params["attr:qualifiedName"] = _SERIALIZER.query("attr", attr, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_relationship_create_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/relationship" + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_relationship_update_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/relationship" + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_relationship_get_request(guid: str, *, extended_info: Optional[bool] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/relationship/guid/{guid}" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if extended_info is not None: + _params["extendedInfo"] = _SERIALIZER.query("extended_info", extended_info, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_relationship_delete_request(guid: str, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/relationship/guid/{guid}" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_type_get_business_metadata_def_by_guid_request( # pylint: disable=name-too-long + guid: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/types/businessmetadatadef/guid/{guid}" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_type_get_business_metadata_def_by_name_request( # pylint: disable=name-too-long + name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/types/businessmetadatadef/name/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_type_get_classification_def_by_guid_request( # pylint: disable=name-too-long + guid: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/types/classificationdef/guid/{guid}" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_type_get_classification_def_by_name_request( # pylint: disable=name-too-long + name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/types/classificationdef/name/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_type_get_entity_def_by_guid_request(guid: str, **kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/types/entitydef/guid/{guid}" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_type_get_entity_def_by_name_request(name: str, **kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/types/entitydef/name/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_type_get_enum_def_by_guid_request(guid: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/types/enumdef/guid/{guid}" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_type_get_enum_def_by_name_request(name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/types/enumdef/name/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_type_get_relationship_def_by_guid_request( # pylint: disable=name-too-long + guid: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/types/relationshipdef/guid/{guid}" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_type_get_relationship_def_by_name_request( # pylint: disable=name-too-long + name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/types/relationshipdef/name/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_type_get_struct_def_by_guid_request(guid: str, **kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/types/structdef/guid/{guid}" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_type_get_struct_def_by_name_request(name: str, **kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/types/structdef/name/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_type_get_by_guid_request(guid: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/types/typedef/guid/{guid}" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_type_get_by_name_request(name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/types/typedef/name/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_type_delete_request(name: str, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/types/typedef/name/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_type_list_request( + *, include_term_template: Optional[bool] = None, type: Optional[Union[str, _models.Typedef]] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/types/typedefs" + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if include_term_template is not None: + _params["includeTermTemplate"] = _SERIALIZER.query("include_term_template", include_term_template, "bool") + if type is not None: + _params["type"] = _SERIALIZER.query("type", type, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_type_bulk_create_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/types/typedefs" + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_type_bulk_update_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/types/typedefs" + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_type_bulk_delete_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + # Construct URL + _url = "/atlas/v2/types/typedefs" + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_type_list_headers_request( + *, include_term_template: Optional[bool] = None, type: Optional[Union[str, _models.Typedef]] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/atlas/v2/types/typedefs/headers" + + # Construct parameters + if api_version is not None: + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if include_term_template is not None: + _params["includeTermTemplate"] = _SERIALIZER.query("include_term_template", include_term_template, "bool") + if type is not None: + _params["type"] = _SERIALIZER.query("type", type, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_type_get_term_template_def_by_guid_request( # pylint: disable=name-too-long + guid: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/types/termtemplatedef/guid/{guid}" + path_format_arguments = { + "guid": _SERIALIZER.url("guid", guid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_type_get_term_template_def_by_name_request( # pylint: disable=name-too-long + name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/types/termtemplatedef/name/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class EntityClientOperationsMixin(EntityClientMixinABC): # pylint: disable=too-many-public-methods + @overload + def create_or_update( + self, + entity: _models.AtlasEntityWithExtInfo, + *, + business_attribute_update_behavior: Optional[Union[str, _models.BusinessAttributeUpdateBehavior]] = None, + collection_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.EntityMutationResponse: + """Create or update an entity. + Existing entity is matched using its unique guid if + supplied or by its unique attributes eg: qualifiedName. + Map and array of + collections are not well supported. E.g., array`>, array>. + For each contact type, the maximum number of contacts is 20. + + :param entity: Atlas entity with extended information. Required. + :type entity: ~azure.analytics.purview.datamap.models.AtlasEntityWithExtInfo + :keyword business_attribute_update_behavior: Used to define the update behavior for business + attributes when updating + entities. Known values are: "ignore", "replace", and "merge". Default value is None. + :paramtype business_attribute_update_behavior: str or + ~azure.analytics.purview.datamap.models.BusinessAttributeUpdateBehavior + :keyword collection_id: The collection where entities will be moved to. Only specify a value if + you + need to move an entity to another collection. Default value is None. + :paramtype collection_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + entity: JSON, + *, + business_attribute_update_behavior: Optional[Union[str, _models.BusinessAttributeUpdateBehavior]] = None, + collection_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.EntityMutationResponse: + """Create or update an entity. + Existing entity is matched using its unique guid if + supplied or by its unique attributes eg: qualifiedName. + Map and array of + collections are not well supported. E.g., array`>, array>. + For each contact type, the maximum number of contacts is 20. + + :param entity: Atlas entity with extended information. Required. + :type entity: JSON + :keyword business_attribute_update_behavior: Used to define the update behavior for business + attributes when updating + entities. Known values are: "ignore", "replace", and "merge". Default value is None. + :paramtype business_attribute_update_behavior: str or + ~azure.analytics.purview.datamap.models.BusinessAttributeUpdateBehavior + :keyword collection_id: The collection where entities will be moved to. Only specify a value if + you + need to move an entity to another collection. Default value is None. + :paramtype collection_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + entity: IO, + *, + business_attribute_update_behavior: Optional[Union[str, _models.BusinessAttributeUpdateBehavior]] = None, + collection_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.EntityMutationResponse: + """Create or update an entity. + Existing entity is matched using its unique guid if + supplied or by its unique attributes eg: qualifiedName. + Map and array of + collections are not well supported. E.g., array`>, array>. + For each contact type, the maximum number of contacts is 20. + + :param entity: Atlas entity with extended information. Required. + :type entity: IO + :keyword business_attribute_update_behavior: Used to define the update behavior for business + attributes when updating + entities. Known values are: "ignore", "replace", and "merge". Default value is None. + :paramtype business_attribute_update_behavior: str or + ~azure.analytics.purview.datamap.models.BusinessAttributeUpdateBehavior + :keyword collection_id: The collection where entities will be moved to. Only specify a value if + you + need to move an entity to another collection. Default value is None. + :paramtype collection_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + entity: Union[_models.AtlasEntityWithExtInfo, JSON, IO], + *, + business_attribute_update_behavior: Optional[Union[str, _models.BusinessAttributeUpdateBehavior]] = None, + collection_id: Optional[str] = None, + **kwargs: Any, + ) -> _models.EntityMutationResponse: + """Create or update an entity. + Existing entity is matched using its unique guid if + supplied or by its unique attributes eg: qualifiedName. + Map and array of + collections are not well supported. E.g., array`>, array>. + For each contact type, the maximum number of contacts is 20. + + :param entity: Atlas entity with extended information. Is one of the following types: + AtlasEntityWithExtInfo, JSON, IO Required. + :type entity: ~azure.analytics.purview.datamap.models.AtlasEntityWithExtInfo or JSON or IO + :keyword business_attribute_update_behavior: Used to define the update behavior for business + attributes when updating + entities. Known values are: "ignore", "replace", and "merge". Default value is None. + :paramtype business_attribute_update_behavior: str or + ~azure.analytics.purview.datamap.models.BusinessAttributeUpdateBehavior + :keyword collection_id: The collection where entities will be moved to. Only specify a value if + you + need to move an entity to another collection. Default value is None. + :paramtype collection_id: str + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EntityMutationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(entity, (IOBase, bytes)): + _content = entity + else: + _content = json.dumps(entity, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_create_or_update_request( + business_attribute_update_behavior=business_attribute_update_behavior, + collection_id=collection_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.EntityMutationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_guids( + self, + *, + guid: List[str], + min_ext_info: Optional[bool] = None, + ignore_relationships: Optional[bool] = None, + **kwargs: Any, + ) -> _models.AtlasEntitiesWithExtInfo: + """List entities in bulk identified by its GUIDs. + + :keyword guid: An array of GUIDs of entities to list. Required. + :paramtype guid: list[str] + :keyword min_ext_info: Whether to return minimal information for referred entities. Default + value is None. + :paramtype min_ext_info: bool + :keyword ignore_relationships: Whether to ignore relationship attributes. Default value is + None. + :paramtype ignore_relationships: bool + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasEntitiesWithExtInfo. The AtlasEntitiesWithExtInfo is compatible with + MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasEntitiesWithExtInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasEntitiesWithExtInfo] = kwargs.pop("cls", None) + + _request = build_entity_list_by_guids_request( + guid=guid, + min_ext_info=min_ext_info, + ignore_relationships=ignore_relationships, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasEntitiesWithExtInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def bulk_create_or_update( + self, + entities: _models.AtlasEntitiesWithExtInfo, + *, + collection_id: Optional[str] = None, + business_attribute_update_behavior: Optional[Union[str, _models.BusinessAttributeUpdateBehavior]] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.EntityMutationResponse: + """Create or update entities in bulk. + Existing entity is matched using its unique + guid if supplied or by its unique attributes eg: qualifiedName. + Map and array + of collections are not well supported. E.g., array`>, + array>. + For each contact type, the maximum number of contacts + is 20. + + :param entities: An array of entities to create or update. Required. + :type entities: ~azure.analytics.purview.datamap.models.AtlasEntitiesWithExtInfo + :keyword collection_id: The collection where entities will be moved to. Only specify a value if + you + need to move an entity to another collection. Default value is None. + :paramtype collection_id: str + :keyword business_attribute_update_behavior: Used to define the update behavior for business + attributes when updating + entities. Known values are: "ignore", "replace", and "merge". Default value is None. + :paramtype business_attribute_update_behavior: str or + ~azure.analytics.purview.datamap.models.BusinessAttributeUpdateBehavior + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def bulk_create_or_update( + self, + entities: JSON, + *, + collection_id: Optional[str] = None, + business_attribute_update_behavior: Optional[Union[str, _models.BusinessAttributeUpdateBehavior]] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.EntityMutationResponse: + """Create or update entities in bulk. + Existing entity is matched using its unique + guid if supplied or by its unique attributes eg: qualifiedName. + Map and array + of collections are not well supported. E.g., array`>, + array>. + For each contact type, the maximum number of contacts + is 20. + + :param entities: An array of entities to create or update. Required. + :type entities: JSON + :keyword collection_id: The collection where entities will be moved to. Only specify a value if + you + need to move an entity to another collection. Default value is None. + :paramtype collection_id: str + :keyword business_attribute_update_behavior: Used to define the update behavior for business + attributes when updating + entities. Known values are: "ignore", "replace", and "merge". Default value is None. + :paramtype business_attribute_update_behavior: str or + ~azure.analytics.purview.datamap.models.BusinessAttributeUpdateBehavior + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def bulk_create_or_update( + self, + entities: IO, + *, + collection_id: Optional[str] = None, + business_attribute_update_behavior: Optional[Union[str, _models.BusinessAttributeUpdateBehavior]] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.EntityMutationResponse: + """Create or update entities in bulk. + Existing entity is matched using its unique + guid if supplied or by its unique attributes eg: qualifiedName. + Map and array + of collections are not well supported. E.g., array`>, + array>. + For each contact type, the maximum number of contacts + is 20. + + :param entities: An array of entities to create or update. Required. + :type entities: IO + :keyword collection_id: The collection where entities will be moved to. Only specify a value if + you + need to move an entity to another collection. Default value is None. + :paramtype collection_id: str + :keyword business_attribute_update_behavior: Used to define the update behavior for business + attributes when updating + entities. Known values are: "ignore", "replace", and "merge". Default value is None. + :paramtype business_attribute_update_behavior: str or + ~azure.analytics.purview.datamap.models.BusinessAttributeUpdateBehavior + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def bulk_create_or_update( + self, + entities: Union[_models.AtlasEntitiesWithExtInfo, JSON, IO], + *, + collection_id: Optional[str] = None, + business_attribute_update_behavior: Optional[Union[str, _models.BusinessAttributeUpdateBehavior]] = None, + **kwargs: Any, + ) -> _models.EntityMutationResponse: + """Create or update entities in bulk. + Existing entity is matched using its unique + guid if supplied or by its unique attributes eg: qualifiedName. + Map and array + of collections are not well supported. E.g., array`>, + array>. + For each contact type, the maximum number of contacts + is 20. + + :param entities: An array of entities to create or update. Is one of the following types: + AtlasEntitiesWithExtInfo, JSON, IO Required. + :type entities: ~azure.analytics.purview.datamap.models.AtlasEntitiesWithExtInfo or JSON or IO + :keyword collection_id: The collection where entities will be moved to. Only specify a value if + you + need to move an entity to another collection. Default value is None. + :paramtype collection_id: str + :keyword business_attribute_update_behavior: Used to define the update behavior for business + attributes when updating + entities. Known values are: "ignore", "replace", and "merge". Default value is None. + :paramtype business_attribute_update_behavior: str or + ~azure.analytics.purview.datamap.models.BusinessAttributeUpdateBehavior + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EntityMutationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(entities, (IOBase, bytes)): + _content = entities + else: + _content = json.dumps(entities, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_bulk_create_or_update_request( + collection_id=collection_id, + business_attribute_update_behavior=business_attribute_update_behavior, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.EntityMutationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def bulk_delete(self, *, guid: List[str], **kwargs: Any) -> _models.EntityMutationResponse: + """Delete a list of entities in bulk identified by their GUIDs or unique + attributes. + + :keyword guid: An array of GUIDs of entities to delete. Required. + :paramtype guid: list[str] + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.EntityMutationResponse] = kwargs.pop("cls", None) + + _request = build_entity_bulk_delete_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.EntityMutationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def add_classification( # pylint: disable=inconsistent-return-statements + self, request: _models.ClassificationAssociateRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Associate a classification to multiple entities in bulk. + + :param request: The request to associate a classification to multiple entities. Required. + :type request: ~azure.analytics.purview.datamap.models.ClassificationAssociateRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def add_classification( # pylint: disable=inconsistent-return-statements + self, request: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Associate a classification to multiple entities in bulk. + + :param request: The request to associate a classification to multiple entities. Required. + :type request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def add_classification( # pylint: disable=inconsistent-return-statements + self, request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Associate a classification to multiple entities in bulk. + + :param request: The request to associate a classification to multiple entities. Required. + :type request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def add_classification( # pylint: disable=inconsistent-return-statements + self, request: Union[_models.ClassificationAssociateRequest, JSON, IO], **kwargs: Any + ) -> None: + """Associate a classification to multiple entities in bulk. + + :param request: The request to associate a classification to multiple entities. Is one of the + following types: ClassificationAssociateRequest, JSON, IO Required. + :type request: ~azure.analytics.purview.datamap.models.ClassificationAssociateRequest or JSON + or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(request, (IOBase, bytes)): + _content = request + else: + _content = json.dumps(request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_add_classification_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get( + self, + guid: str, + *, + min_ext_info: Optional[bool] = None, + ignore_relationships: Optional[bool] = None, + **kwargs: Any, + ) -> _models.AtlasEntityWithExtInfo: + """Get complete definition of an entity given its GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :keyword min_ext_info: Whether to return minimal information for referred entities. Default + value is None. + :paramtype min_ext_info: bool + :keyword ignore_relationships: Whether to ignore relationship attributes. Default value is + None. + :paramtype ignore_relationships: bool + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasEntityWithExtInfo. The AtlasEntityWithExtInfo is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasEntityWithExtInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasEntityWithExtInfo] = kwargs.pop("cls", None) + + _request = build_entity_get_request( + guid=guid, + min_ext_info=min_ext_info, + ignore_relationships=ignore_relationships, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasEntityWithExtInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def partial_update_attribute_by_guid( + self, guid: str, body: Any, *, name: str, **kwargs: Any + ) -> _models.EntityMutationResponse: + """Update entity partially - create or update entity attribute identified by its + GUID. + Supports only primitive attribute type and entity references. + It does not + support updating complex types like arrays, and maps. + Null updates are not + possible. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param body: The value of the attribute. Required. + :type body: any + :keyword name: The name of the attribute. Required. + :paramtype name: str + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.EntityMutationResponse] = kwargs.pop("cls", None) + + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_partial_update_attribute_by_guid_request( + guid=guid, + name=name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.EntityMutationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete(self, guid: str, **kwargs: Any) -> _models.EntityMutationResponse: + """Delete an entity identified by its GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.EntityMutationResponse] = kwargs.pop("cls", None) + + _request = build_entity_delete_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.EntityMutationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_classification(self, guid: str, classification_name: str, **kwargs: Any) -> _models.AtlasClassification: + """Get classification for a given entity represented by a GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param classification_name: The name of the classification. Required. + :type classification_name: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasClassification. The AtlasClassification is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasClassification + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasClassification] = kwargs.pop("cls", None) + + _request = build_entity_get_classification_request( + guid=guid, + classification_name=classification_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasClassification, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def remove_classification( # pylint: disable=inconsistent-return-statements + self, guid: str, classification_name: str, **kwargs: Any + ) -> None: + """Delete a given classification from an existing entity represented by a GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param classification_name: The name of the classification. Required. + :type classification_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_entity_remove_classification_request( + guid=guid, + classification_name=classification_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get_classifications(self, guid: str, **kwargs: Any) -> _models.AtlasClassifications: + """List classifications for a given entity represented by a GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasClassifications. The AtlasClassifications is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasClassifications + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasClassifications] = kwargs.pop("cls", None) + + _request = build_entity_get_classifications_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasClassifications, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def add_classifications( # pylint: disable=inconsistent-return-statements + self, + guid: str, + classifications: List[_models.AtlasClassification], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Add classifications to an existing entity represented by a GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param classifications: An array of classifications to be added. Required. + :type classifications: list[~azure.analytics.purview.datamap.models.AtlasClassification] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def add_classifications( # pylint: disable=inconsistent-return-statements + self, guid: str, classifications: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Add classifications to an existing entity represented by a GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param classifications: An array of classifications to be added. Required. + :type classifications: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def add_classifications( # pylint: disable=inconsistent-return-statements + self, guid: str, classifications: Union[List[_models.AtlasClassification], IO], **kwargs: Any + ) -> None: + """Add classifications to an existing entity represented by a GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param classifications: An array of classifications to be added. Is either a + [AtlasClassification] type or a IO type. Required. + :type classifications: list[~azure.analytics.purview.datamap.models.AtlasClassification] or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(classifications, (IOBase, bytes)): + _content = classifications + else: + _content = json.dumps(classifications, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_add_classifications_request( + guid=guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def update_classifications( # pylint: disable=inconsistent-return-statements + self, + guid: str, + classifications: List[_models.AtlasClassification], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Update classifications to an existing entity represented by a guid. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param classifications: An array of classifications to be updated. Required. + :type classifications: list[~azure.analytics.purview.datamap.models.AtlasClassification] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_classifications( # pylint: disable=inconsistent-return-statements + self, guid: str, classifications: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Update classifications to an existing entity represented by a guid. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param classifications: An array of classifications to be updated. Required. + :type classifications: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_classifications( # pylint: disable=inconsistent-return-statements + self, guid: str, classifications: Union[List[_models.AtlasClassification], IO], **kwargs: Any + ) -> None: + """Update classifications to an existing entity represented by a guid. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param classifications: An array of classifications to be updated. Is either a + [AtlasClassification] type or a IO type. Required. + :type classifications: list[~azure.analytics.purview.datamap.models.AtlasClassification] or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(classifications, (IOBase, bytes)): + _content = classifications + else: + _content = json.dumps(classifications, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_update_classifications_request( + guid=guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get_by_unique_attributes( + self, + type_name: str, + *, + min_ext_info: Optional[bool] = None, + ignore_relationships: Optional[bool] = None, + attr: Optional[str] = None, + **kwargs: Any, + ) -> _models.AtlasEntityWithExtInfo: + """Get complete definition of an entity given its type and unique attribute. + + In + addition to the typeName path parameter, attribute key-value pair(s) can be + provided in the following format: + attr:\:code:``=:code:``. + + NOTE: The + attrName and attrValue should be unique across entities, eg. + qualifiedName. + + The REST request would look something like this: + GET + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :keyword min_ext_info: Whether to return minimal information for referred entities. Default + value is None. + :paramtype min_ext_info: bool + :keyword ignore_relationships: Whether to ignore relationship attributes. Default value is + None. + :paramtype ignore_relationships: bool + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasEntityWithExtInfo. The AtlasEntityWithExtInfo is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasEntityWithExtInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasEntityWithExtInfo] = kwargs.pop("cls", None) + + _request = build_entity_get_by_unique_attributes_request( + type_name=type_name, + min_ext_info=min_ext_info, + ignore_relationships=ignore_relationships, + attr=attr, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasEntityWithExtInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def partial_update_by_unique_attributes( + self, + type_name: str, + atlas_entity_with_ext_info: _models.AtlasEntityWithExtInfo, + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.EntityMutationResponse: + """Update entity partially - Allow a subset of attributes to be updated on an + entity which is identified by its type and unique attribute eg: + Referenceable.qualifiedName. Null updates are not possible. + + In addition to the + typeName path parameter, attribute key-value pair(s) can be provided in the + following format: + + attr::code:``=:code:``. + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: + PUT + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param atlas_entity_with_ext_info: Atlas entity with extended information. Required. + :type atlas_entity_with_ext_info: + ~azure.analytics.purview.datamap.models.AtlasEntityWithExtInfo + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def partial_update_by_unique_attributes( + self, + type_name: str, + atlas_entity_with_ext_info: JSON, + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.EntityMutationResponse: + """Update entity partially - Allow a subset of attributes to be updated on an + entity which is identified by its type and unique attribute eg: + Referenceable.qualifiedName. Null updates are not possible. + + In addition to the + typeName path parameter, attribute key-value pair(s) can be provided in the + following format: + + attr::code:``=:code:``. + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: + PUT + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param atlas_entity_with_ext_info: Atlas entity with extended information. Required. + :type atlas_entity_with_ext_info: JSON + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def partial_update_by_unique_attributes( + self, + type_name: str, + atlas_entity_with_ext_info: IO, + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.EntityMutationResponse: + """Update entity partially - Allow a subset of attributes to be updated on an + entity which is identified by its type and unique attribute eg: + Referenceable.qualifiedName. Null updates are not possible. + + In addition to the + typeName path parameter, attribute key-value pair(s) can be provided in the + following format: + + attr::code:``=:code:``. + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: + PUT + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param atlas_entity_with_ext_info: Atlas entity with extended information. Required. + :type atlas_entity_with_ext_info: IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def partial_update_by_unique_attributes( + self, + type_name: str, + atlas_entity_with_ext_info: Union[_models.AtlasEntityWithExtInfo, JSON, IO], + *, + attr: Optional[str] = None, + **kwargs: Any, + ) -> _models.EntityMutationResponse: + """Update entity partially - Allow a subset of attributes to be updated on an + entity which is identified by its type and unique attribute eg: + Referenceable.qualifiedName. Null updates are not possible. + + In addition to the + typeName path parameter, attribute key-value pair(s) can be provided in the + following format: + + attr::code:``=:code:``. + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: + PUT + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param atlas_entity_with_ext_info: Atlas entity with extended information. Is one of the + following types: AtlasEntityWithExtInfo, JSON, IO Required. + :type atlas_entity_with_ext_info: + ~azure.analytics.purview.datamap.models.AtlasEntityWithExtInfo or JSON or IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EntityMutationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(atlas_entity_with_ext_info, (IOBase, bytes)): + _content = atlas_entity_with_ext_info + else: + _content = json.dumps(atlas_entity_with_ext_info, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_partial_update_by_unique_attributes_request( + type_name=type_name, + attr=attr, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.EntityMutationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete_by_unique_attribute( + self, type_name: str, *, attr: Optional[str] = None, **kwargs: Any + ) -> _models.EntityMutationResponse: + """Delete an entity identified by its type and unique attributes. + In addition to + the typeName path parameter, attribute key-value pair(s) can be provided in the + following format: + attr:\:code:``=\:code:``. + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: + DELETE + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.EntityMutationResponse] = kwargs.pop("cls", None) + + _request = build_entity_delete_by_unique_attribute_request( + type_name=type_name, + attr=attr, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.EntityMutationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def remove_classification_by_unique_attribute( # pylint: disable=inconsistent-return-statements,name-too-long + self, type_name: str, classification_name: str, *, attr: Optional[str] = None, **kwargs: Any + ) -> None: + """Delete a given classification from an entity identified by its type and unique + attributes. + + :param type_name: The name of the type. Required. + :type type_name: str + :param classification_name: The name of the classification. Required. + :type classification_name: str + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_entity_remove_classification_by_unique_attribute_request( + type_name=type_name, + classification_name=classification_name, + attr=attr, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def add_classifications_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, + type_name: str, + atlas_classification_array: List[_models.AtlasClassification], + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Add classification to the entity identified by its type and unique attributes. + + :param type_name: The name of the type. Required. + :type type_name: str + :param atlas_classification_array: An array of classification to be added. Required. + :type atlas_classification_array: + list[~azure.analytics.purview.datamap.models.AtlasClassification] + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def add_classifications_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, + type_name: str, + atlas_classification_array: IO, + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Add classification to the entity identified by its type and unique attributes. + + :param type_name: The name of the type. Required. + :type type_name: str + :param atlas_classification_array: An array of classification to be added. Required. + :type atlas_classification_array: IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def add_classifications_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, + type_name: str, + atlas_classification_array: Union[List[_models.AtlasClassification], IO], + *, + attr: Optional[str] = None, + **kwargs: Any, + ) -> None: + """Add classification to the entity identified by its type and unique attributes. + + :param type_name: The name of the type. Required. + :type type_name: str + :param atlas_classification_array: An array of classification to be added. Is either a + [AtlasClassification] type or a IO type. Required. + :type atlas_classification_array: + list[~azure.analytics.purview.datamap.models.AtlasClassification] or IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(atlas_classification_array, (IOBase, bytes)): + _content = atlas_classification_array + else: + _content = json.dumps(atlas_classification_array, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_add_classifications_by_unique_attribute_request( + type_name=type_name, + attr=attr, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def update_classifications_by_unique_attribute( # pylint: disable=inconsistent-return-statements,name-too-long + self, + type_name: str, + atlas_classification_array: List[_models.AtlasClassification], + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Update classification on an entity identified by its type and unique attributes. + + :param type_name: The name of the type. Required. + :type type_name: str + :param atlas_classification_array: An array of classification to be updated. Required. + :type atlas_classification_array: + list[~azure.analytics.purview.datamap.models.AtlasClassification] + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_classifications_by_unique_attribute( # pylint: disable=inconsistent-return-statements,name-too-long + self, + type_name: str, + atlas_classification_array: IO, + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Update classification on an entity identified by its type and unique attributes. + + :param type_name: The name of the type. Required. + :type type_name: str + :param atlas_classification_array: An array of classification to be updated. Required. + :type atlas_classification_array: IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_classifications_by_unique_attribute( # pylint: disable=inconsistent-return-statements,name-too-long + self, + type_name: str, + atlas_classification_array: Union[List[_models.AtlasClassification], IO], + *, + attr: Optional[str] = None, + **kwargs: Any, + ) -> None: + """Update classification on an entity identified by its type and unique attributes. + + :param type_name: The name of the type. Required. + :type type_name: str + :param atlas_classification_array: An array of classification to be updated. Is either a + [AtlasClassification] type or a IO type. Required. + :type atlas_classification_array: + list[~azure.analytics.purview.datamap.models.AtlasClassification] or IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(atlas_classification_array, (IOBase, bytes)): + _content = atlas_classification_array + else: + _content = json.dumps(atlas_classification_array, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_update_classifications_by_unique_attribute_request( + type_name=type_name, + attr=attr, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def bulk_set_classifications( + self, entity_headers: _models.AtlasEntityHeaders, *, content_type: str = "application/json", **kwargs: Any + ) -> List[str]: + """Set classifications on entities in bulk. + + :param entity_headers: Atlas entity headers. Required. + :type entity_headers: ~azure.analytics.purview.datamap.models.AtlasEntityHeaders + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of str + :rtype: list[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def bulk_set_classifications( + self, entity_headers: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> List[str]: + """Set classifications on entities in bulk. + + :param entity_headers: Atlas entity headers. Required. + :type entity_headers: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of str + :rtype: list[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def bulk_set_classifications( + self, entity_headers: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> List[str]: + """Set classifications on entities in bulk. + + :param entity_headers: Atlas entity headers. Required. + :type entity_headers: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of str + :rtype: list[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def bulk_set_classifications( + self, entity_headers: Union[_models.AtlasEntityHeaders, JSON, IO], **kwargs: Any + ) -> List[str]: + """Set classifications on entities in bulk. + + :param entity_headers: Atlas entity headers. Is one of the following types: AtlasEntityHeaders, + JSON, IO Required. + :type entity_headers: ~azure.analytics.purview.datamap.models.AtlasEntityHeaders or JSON or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of str + :rtype: list[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[List[str]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(entity_headers, (IOBase, bytes)): + _content = entity_headers + else: + _content = json.dumps(entity_headers, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_bulk_set_classifications_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[str], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_unique_attributes( + self, + type_name: str, + *, + min_ext_info: Optional[bool] = None, + ignore_relationships: Optional[bool] = None, + attr_n_qualified_name: Optional[str] = None, + **kwargs: Any, + ) -> _models.AtlasEntitiesWithExtInfo: + """Bulk API to retrieve list of entities identified by its unique attributes. + In + addition to the typeName path parameter, attribute key-value pair(s) can be + provided in the following + format + + typeName=\:code:``&attr_1:\:code:``=\:code:``&attr_2:\:code:``=\:code:``&attr_3:\:code:``=\:code:`` + + NOTE: + The attrName should be an unique attribute for the given entity-type. + The REST + request would look something like this + + GET + /v2/entity/bulk/uniqueAttribute/type/hive_db?attr_1:qualifiedName=db1@cl1&attr_2:qualifiedName=db2@cl1 + + Note: + at least one unique attribute must be provided. + + :param type_name: The name of the type. Required. + :type type_name: str + :keyword min_ext_info: Whether to return minimal information for referred entities. Default + value is None. + :paramtype min_ext_info: bool + :keyword ignore_relationships: Whether to ignore relationship attributes. Default value is + None. + :paramtype ignore_relationships: bool + :keyword attr_n_qualified_name: Qualified name of an entity. E.g. to find 2 entities you can + set + attrs_1:qualifiedName=db1@cl1&attrs_2:qualifiedName=db2@cl1. (This is only an + example. qualifiedName can be changed to other unique attributes). Default value is None. + :paramtype attr_n_qualified_name: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasEntitiesWithExtInfo. The AtlasEntitiesWithExtInfo is compatible with + MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasEntitiesWithExtInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasEntitiesWithExtInfo] = kwargs.pop("cls", None) + + _request = build_entity_list_by_unique_attributes_request( + type_name=type_name, + min_ext_info=min_ext_info, + ignore_relationships=ignore_relationships, + attr_n_qualified_name=attr_n_qualified_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasEntitiesWithExtInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_header(self, guid: str, **kwargs: Any) -> _models.AtlasEntityHeader: + """Get entity header given its GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasEntityHeader. The AtlasEntityHeader is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasEntityHeader + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasEntityHeader] = kwargs.pop("cls", None) + + _request = build_entity_get_header_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasEntityHeader, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def remove_business_metadata( # pylint: disable=inconsistent-return-statements + self, + guid: str, + business_metadata: Dict[str, Dict[str, Any]], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Remove business metadata from an entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata: Business metadata payload. Required. + :type business_metadata: dict[str, dict[str, any]] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def remove_business_metadata( # pylint: disable=inconsistent-return-statements + self, guid: str, business_metadata: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Remove business metadata from an entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata: Business metadata payload. Required. + :type business_metadata: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def remove_business_metadata( # pylint: disable=inconsistent-return-statements + self, guid: str, business_metadata: Union[Dict[str, Dict[str, Any]], IO], **kwargs: Any + ) -> None: + """Remove business metadata from an entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata: Business metadata payload. Is either a {str: {str: Any}} type or a IO + type. Required. + :type business_metadata: dict[str, dict[str, any]] or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(business_metadata, (IOBase, bytes)): + _content = business_metadata + else: + _content = json.dumps(business_metadata, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_remove_business_metadata_request( + guid=guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def add_or_update_business_metadata( # pylint: disable=inconsistent-return-statements + self, + guid: str, + business_metadata: Dict[str, Dict[str, Any]], + *, + is_overwrite: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Add business metadata to an entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata: BusinessMetadata payload. Required. + :type business_metadata: dict[str, dict[str, any]] + :keyword is_overwrite: Whether to overwrite the existing business metadata on the entity or + not, + default is false. Default value is None. + :paramtype is_overwrite: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def add_or_update_business_metadata( # pylint: disable=inconsistent-return-statements + self, + guid: str, + business_metadata: IO, + *, + is_overwrite: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Add business metadata to an entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata: BusinessMetadata payload. Required. + :type business_metadata: IO + :keyword is_overwrite: Whether to overwrite the existing business metadata on the entity or + not, + default is false. Default value is None. + :paramtype is_overwrite: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def add_or_update_business_metadata( # pylint: disable=inconsistent-return-statements + self, + guid: str, + business_metadata: Union[Dict[str, Dict[str, Any]], IO], + *, + is_overwrite: Optional[bool] = None, + **kwargs: Any, + ) -> None: + """Add business metadata to an entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata: BusinessMetadata payload. Is either a {str: {str: Any}} type or a IO + type. Required. + :type business_metadata: dict[str, dict[str, any]] or IO + :keyword is_overwrite: Whether to overwrite the existing business metadata on the entity or + not, + default is false. Default value is None. + :paramtype is_overwrite: bool + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(business_metadata, (IOBase, bytes)): + _content = business_metadata + else: + _content = json.dumps(business_metadata, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_add_or_update_business_metadata_request( + guid=guid, + is_overwrite=is_overwrite, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def remove_business_metadata_attributes( # pylint: disable=inconsistent-return-statements + self, + bm_name: str, + guid: str, + business_metadata_attributes: Dict[str, Any], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Delete business metadata attributes from an entity. + + :param bm_name: BusinessMetadata name. Required. + :type bm_name: str + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata_attributes: Business metadata attribute payload. Required. + :type business_metadata_attributes: dict[str, any] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def remove_business_metadata_attributes( # pylint: disable=inconsistent-return-statements + self, + bm_name: str, + guid: str, + business_metadata_attributes: IO, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Delete business metadata attributes from an entity. + + :param bm_name: BusinessMetadata name. Required. + :type bm_name: str + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata_attributes: Business metadata attribute payload. Required. + :type business_metadata_attributes: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def remove_business_metadata_attributes( # pylint: disable=inconsistent-return-statements + self, bm_name: str, guid: str, business_metadata_attributes: Union[Dict[str, Any], IO], **kwargs: Any + ) -> None: + """Delete business metadata attributes from an entity. + + :param bm_name: BusinessMetadata name. Required. + :type bm_name: str + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata_attributes: Business metadata attribute payload. Is either a {str: + Any} type or a IO type. Required. + :type business_metadata_attributes: dict[str, any] or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(business_metadata_attributes, (IOBase, bytes)): + _content = business_metadata_attributes + else: + _content = json.dumps(business_metadata_attributes, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_remove_business_metadata_attributes_request( + bm_name=bm_name, + guid=guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def add_or_update_business_metadata_attributes( # pylint: disable=inconsistent-return-statements,name-too-long + self, + bm_name: str, + guid: str, + business_metadata_attributes: Dict[str, Any], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Add or update business metadata attributes. + + :param bm_name: BusinessMetadata name. Required. + :type bm_name: str + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata_attributes: Business metadata attribute payload. Required. + :type business_metadata_attributes: dict[str, any] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def add_or_update_business_metadata_attributes( # pylint: disable=inconsistent-return-statements,name-too-long + self, + bm_name: str, + guid: str, + business_metadata_attributes: IO, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Add or update business metadata attributes. + + :param bm_name: BusinessMetadata name. Required. + :type bm_name: str + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata_attributes: Business metadata attribute payload. Required. + :type business_metadata_attributes: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def add_or_update_business_metadata_attributes( # pylint: disable=inconsistent-return-statements,name-too-long + self, bm_name: str, guid: str, business_metadata_attributes: Union[Dict[str, Any], IO], **kwargs: Any + ) -> None: + """Add or update business metadata attributes. + + :param bm_name: BusinessMetadata name. Required. + :type bm_name: str + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata_attributes: Business metadata attribute payload. Is either a {str: + Any} type or a IO type. Required. + :type business_metadata_attributes: dict[str, any] or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(business_metadata_attributes, (IOBase, bytes)): + _content = business_metadata_attributes + else: + _content = json.dumps(business_metadata_attributes, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_add_or_update_business_metadata_attributes_request( + bm_name=bm_name, + guid=guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get_sample_business_metadata_template(self, **kwargs: Any) -> bytes: + """Get the sample Template for uploading/creating bulk BusinessMetaData. + + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: bytes + :rtype: bytes + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[bytes] = kwargs.pop("cls", None) + + _request = build_entity_get_sample_business_metadata_template_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response.read() + deserialized = response.content + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def import_business_metadata( + self, body: JSON = _Unset, *, uploaded_input_stream: bytes = _Unset, **kwargs: Any + ) -> _models.BulkImportResponse: + """Upload the file for creating Business Metadata in BULK. + + :param body: Required. + :type body: JSON + :keyword uploaded_input_stream: InputStream of file. Required. + :paramtype uploaded_input_stream: bytes + :keyword content_type: The content type for the operation. Always multipart/form-data for this + operation. Default value is "multipart/form-data". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: BulkImportResponse. The BulkImportResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.BulkImportResponse + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "uploadedInputStream": bytes("bytes", encoding="utf-8") # InputStream of + file. Required. + } + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "multipart/form-data")) + cls: ClsType[_models.BulkImportResponse] = kwargs.pop("cls", None) + + if body is _Unset: + if uploaded_input_stream is _Unset: + raise TypeError("missing required argument: uploaded_input_stream") + body = {"uploadedinputstream": uploaded_input_stream} + body = {k: v for k, v in body.items() if v is not None} + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_import_business_metadata_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BulkImportResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def remove_labels( # pylint: disable=inconsistent-return-statements + self, guid: str, body: List[str], *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Delete given labels to a given entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param body: set of labels to be deleted. Required. + :type body: list[str] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def remove_labels( # pylint: disable=inconsistent-return-statements + self, guid: str, body: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Delete given labels to a given entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param body: set of labels to be deleted. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def remove_labels( # pylint: disable=inconsistent-return-statements + self, guid: str, body: Union[List[str], IO], **kwargs: Any + ) -> None: + """Delete given labels to a given entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param body: set of labels to be deleted. Is either a [str] type or a IO type. Required. + :type body: list[str] or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_remove_labels_request( + guid=guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def set_labels( # pylint: disable=inconsistent-return-statements + self, guid: str, body: List[str], *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Set labels to a given entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param body: set of labels to be set to the entity. Required. + :type body: list[str] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_labels( # pylint: disable=inconsistent-return-statements + self, guid: str, body: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Set labels to a given entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param body: set of labels to be set to the entity. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def set_labels( # pylint: disable=inconsistent-return-statements + self, guid: str, body: Union[List[str], IO], **kwargs: Any + ) -> None: + """Set labels to a given entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param body: set of labels to be set to the entity. Is either a [str] type or a IO type. + Required. + :type body: list[str] or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_set_labels_request( + guid=guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def add_label( # pylint: disable=inconsistent-return-statements + self, guid: str, body: List[str], *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Add given labels to a given entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param body: set of labels to be added. Required. + :type body: list[str] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def add_label( # pylint: disable=inconsistent-return-statements + self, guid: str, body: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Add given labels to a given entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param body: set of labels to be added. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def add_label( # pylint: disable=inconsistent-return-statements + self, guid: str, body: Union[List[str], IO], **kwargs: Any + ) -> None: + """Add given labels to a given entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param body: set of labels to be added. Is either a [str] type or a IO type. Required. + :type body: list[str] or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_add_label_request( + guid=guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def remove_labels_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, + type_name: str, + body: List[str], + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Delete given labels to a given entity identified by its type and unique + attribute. + + If labels is null/empty, no labels will be removed. + + If any labels + in labels set are non-existing labels, they will be ignored, only existing + labels will be removed. In addition to the typeName path parameter, attribute + key-value pair(s) can be provided in the following format: + attr::code:``=:code:``. NOTE: The attrName and attrValue should be unique + across entities, eg. qualifiedName. The REST request would look something like + this: DELETE + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param body: set of labels to be deleted. Required. + :type body: list[str] + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def remove_labels_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, + type_name: str, + body: IO, + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Delete given labels to a given entity identified by its type and unique + attribute. + + If labels is null/empty, no labels will be removed. + + If any labels + in labels set are non-existing labels, they will be ignored, only existing + labels will be removed. In addition to the typeName path parameter, attribute + key-value pair(s) can be provided in the following format: + attr::code:``=:code:``. NOTE: The attrName and attrValue should be unique + across entities, eg. qualifiedName. The REST request would look something like + this: DELETE + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param body: set of labels to be deleted. Required. + :type body: IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def remove_labels_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, type_name: str, body: Union[List[str], IO], *, attr: Optional[str] = None, **kwargs: Any + ) -> None: + """Delete given labels to a given entity identified by its type and unique + attribute. + + If labels is null/empty, no labels will be removed. + + If any labels + in labels set are non-existing labels, they will be ignored, only existing + labels will be removed. In addition to the typeName path parameter, attribute + key-value pair(s) can be provided in the following format: + attr::code:``=:code:``. NOTE: The attrName and attrValue should be unique + across entities, eg. qualifiedName. The REST request would look something like + this: DELETE + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param body: set of labels to be deleted. Is either a [str] type or a IO type. Required. + :type body: list[str] or IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_remove_labels_by_unique_attribute_request( + type_name=type_name, + attr=attr, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def set_labels_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, + type_name: str, + body: List[str], + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Set labels to a given entity identified by its type and unique attributes. + + If + labels is null/empty, existing labels will all be removed. + + In addition to the + typeName path parameter, attribute key-value pair(s) can be provided in the + following format: attr::code:``=:code:``. + + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: POST + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param body: set of labels to be set. Required. + :type body: list[str] + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set_labels_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, + type_name: str, + body: IO, + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Set labels to a given entity identified by its type and unique attributes. + + If + labels is null/empty, existing labels will all be removed. + + In addition to the + typeName path parameter, attribute key-value pair(s) can be provided in the + following format: attr::code:``=:code:``. + + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: POST + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param body: set of labels to be set. Required. + :type body: IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def set_labels_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, type_name: str, body: Union[List[str], IO], *, attr: Optional[str] = None, **kwargs: Any + ) -> None: + """Set labels to a given entity identified by its type and unique attributes. + + If + labels is null/empty, existing labels will all be removed. + + In addition to the + typeName path parameter, attribute key-value pair(s) can be provided in the + following format: attr::code:``=:code:``. + + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: POST + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param body: set of labels to be set. Is either a [str] type or a IO type. Required. + :type body: list[str] or IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_set_labels_by_unique_attribute_request( + type_name=type_name, + attr=attr, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def add_labels_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, + type_name: str, + body: List[str], + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Add given labels to a given entity identified by its type and unique + attributes. + + If labels is null/empty, no labels will be added. + + In addition to + the typeName path parameter, attribute key-value pair(s) can be provided in the + following format: attr::code:``=:code:``. + + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: PUT + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param body: set of labels to be added. Required. + :type body: list[str] + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def add_labels_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, + type_name: str, + body: IO, + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Add given labels to a given entity identified by its type and unique + attributes. + + If labels is null/empty, no labels will be added. + + In addition to + the typeName path parameter, attribute key-value pair(s) can be provided in the + following format: attr::code:``=:code:``. + + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: PUT + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param body: set of labels to be added. Required. + :type body: IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def add_labels_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, type_name: str, body: Union[List[str], IO], *, attr: Optional[str] = None, **kwargs: Any + ) -> None: + """Add given labels to a given entity identified by its type and unique + attributes. + + If labels is null/empty, no labels will be added. + + In addition to + the typeName path parameter, attribute key-value pair(s) can be provided in the + following format: attr::code:``=:code:``. + + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: PUT + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param body: set of labels to be added. Is either a [str] type or a IO type. Required. + :type body: list[str] or IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_add_labels_by_unique_attribute_request( + type_name=type_name, + attr=attr, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def move_entities_to_collection( + self, + move_entities_request: _models.MoveEntitiesRequest, + *, + collection_id: str, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.EntityMutationResponse: + """Move existing entities to the target collection. + + :param move_entities_request: Entity guids to be moved to target collection. Required. + :type move_entities_request: ~azure.analytics.purview.datamap.models.MoveEntitiesRequest + :keyword collection_id: The collection where entities will be moved to. Required. + :paramtype collection_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def move_entities_to_collection( + self, move_entities_request: JSON, *, collection_id: str, content_type: str = "application/json", **kwargs: Any + ) -> _models.EntityMutationResponse: + """Move existing entities to the target collection. + + :param move_entities_request: Entity guids to be moved to target collection. Required. + :type move_entities_request: JSON + :keyword collection_id: The collection where entities will be moved to. Required. + :paramtype collection_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def move_entities_to_collection( + self, move_entities_request: IO, *, collection_id: str, content_type: str = "application/json", **kwargs: Any + ) -> _models.EntityMutationResponse: + """Move existing entities to the target collection. + + :param move_entities_request: Entity guids to be moved to target collection. Required. + :type move_entities_request: IO + :keyword collection_id: The collection where entities will be moved to. Required. + :paramtype collection_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def move_entities_to_collection( + self, move_entities_request: Union[_models.MoveEntitiesRequest, JSON, IO], *, collection_id: str, **kwargs: Any + ) -> _models.EntityMutationResponse: + """Move existing entities to the target collection. + + :param move_entities_request: Entity guids to be moved to target collection. Is one of the + following types: MoveEntitiesRequest, JSON, IO Required. + :type move_entities_request: ~azure.analytics.purview.datamap.models.MoveEntitiesRequest or + JSON or IO + :keyword collection_id: The collection where entities will be moved to. Required. + :paramtype collection_id: str + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EntityMutationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(move_entities_request, (IOBase, bytes)): + _content = move_entities_request + else: + _content = json.dumps(move_entities_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_move_entities_to_collection_request( + collection_id=collection_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.EntityMutationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class GlossaryClientOperationsMixin(GlossaryClientMixinABC): # pylint: disable=too-many-public-methods + @distributed_trace + def list( + self, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + ignore_terms_and_categories: Optional[bool] = None, + **kwargs: Any, + ) -> List[_models.AtlasGlossary]: + """Get all glossaries. Recommend using limit/offset to get pagination result. + Recommend using 'ignoreTermsAndCategories=true' and fetch terms/categories + separately using + + 'GET /datamap/api/atlas/v2/glossary/{glossaryGuid}/terms' + and + + 'GET '/datamap/api/atlas/v2/glossary/{glossaryGuid}/categories'. + + :keyword limit: The page size - by default there is no paging. Default value is None. + :paramtype limit: int + :keyword offset: The offset for pagination purpose. Default value is None. + :paramtype offset: int + :keyword sort: The sort order, ASC (default) or DESC. Default value is None. + :paramtype sort: str + :keyword ignore_terms_and_categories: Whether ignore terms and categories. Default value is + None. + :paramtype ignore_terms_and_categories: bool + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasGlossary + :rtype: list[~azure.analytics.purview.datamap.models.AtlasGlossary] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AtlasGlossary]] = kwargs.pop("cls", None) + + _request = build_glossary_list_request( + limit=limit, + offset=offset, + sort=sort, + ignore_terms_and_categories=ignore_terms_and_categories, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.AtlasGlossary], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, atlas_glossary: _models.AtlasGlossary, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasGlossary: + """Create a glossary. + + :param atlas_glossary: Glossary definition, terms & categories can be anchored to a glossary. + Using + the anchor attribute when creating the Term/Category. Required. + :type atlas_glossary: ~azure.analytics.purview.datamap.models.AtlasGlossary + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossary. The AtlasGlossary is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossary + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, atlas_glossary: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasGlossary: + """Create a glossary. + + :param atlas_glossary: Glossary definition, terms & categories can be anchored to a glossary. + Using + the anchor attribute when creating the Term/Category. Required. + :type atlas_glossary: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossary. The AtlasGlossary is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossary + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, atlas_glossary: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasGlossary: + """Create a glossary. + + :param atlas_glossary: Glossary definition, terms & categories can be anchored to a glossary. + Using + the anchor attribute when creating the Term/Category. Required. + :type atlas_glossary: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossary. The AtlasGlossary is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossary + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create(self, atlas_glossary: Union[_models.AtlasGlossary, JSON, IO], **kwargs: Any) -> _models.AtlasGlossary: + """Create a glossary. + + :param atlas_glossary: Glossary definition, terms & categories can be anchored to a glossary. + Using + the anchor attribute when creating the Term/Category. Is one of the following types: + AtlasGlossary, JSON, IO Required. + :type atlas_glossary: ~azure.analytics.purview.datamap.models.AtlasGlossary or JSON or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossary. The AtlasGlossary is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossary + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AtlasGlossary] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(atlas_glossary, (IOBase, bytes)): + _content = atlas_glossary + else: + _content = json.dumps(atlas_glossary, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_create_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossary, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_categories( + self, + glossary_category: List[_models.AtlasGlossaryCategory], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> List[_models.AtlasGlossaryCategory]: + """Create glossary category in bulk. + + :param glossary_category: An array of glossary category definitions to be created. Required. + :type glossary_category: list[~azure.analytics.purview.datamap.models.AtlasGlossaryCategory] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasGlossaryCategory + :rtype: list[~azure.analytics.purview.datamap.models.AtlasGlossaryCategory] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_categories( + self, glossary_category: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> List[_models.AtlasGlossaryCategory]: + """Create glossary category in bulk. + + :param glossary_category: An array of glossary category definitions to be created. Required. + :type glossary_category: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasGlossaryCategory + :rtype: list[~azure.analytics.purview.datamap.models.AtlasGlossaryCategory] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_categories( + self, glossary_category: Union[List[_models.AtlasGlossaryCategory], IO], **kwargs: Any + ) -> List[_models.AtlasGlossaryCategory]: + """Create glossary category in bulk. + + :param glossary_category: An array of glossary category definitions to be created. Is either a + [AtlasGlossaryCategory] type or a IO type. Required. + :type glossary_category: list[~azure.analytics.purview.datamap.models.AtlasGlossaryCategory] or + IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasGlossaryCategory + :rtype: list[~azure.analytics.purview.datamap.models.AtlasGlossaryCategory] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[List[_models.AtlasGlossaryCategory]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(glossary_category, (IOBase, bytes)): + _content = glossary_category + else: + _content = json.dumps(glossary_category, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_create_categories_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.AtlasGlossaryCategory], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_category( + self, glossary_category: _models.AtlasGlossaryCategory, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasGlossaryCategory: + """Create a glossary category. + + :param glossary_category: The glossary category definition. A category must be anchored to a + Glossary + when creating. + Optionally, terms belonging to the category and the hierarchy + can also be defined during creation. Required. + :type glossary_category: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryCategory. The AtlasGlossaryCategory is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_category( + self, glossary_category: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasGlossaryCategory: + """Create a glossary category. + + :param glossary_category: The glossary category definition. A category must be anchored to a + Glossary + when creating. + Optionally, terms belonging to the category and the hierarchy + can also be defined during creation. Required. + :type glossary_category: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryCategory. The AtlasGlossaryCategory is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_category( + self, glossary_category: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasGlossaryCategory: + """Create a glossary category. + + :param glossary_category: The glossary category definition. A category must be anchored to a + Glossary + when creating. + Optionally, terms belonging to the category and the hierarchy + can also be defined during creation. Required. + :type glossary_category: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryCategory. The AtlasGlossaryCategory is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_category( + self, glossary_category: Union[_models.AtlasGlossaryCategory, JSON, IO], **kwargs: Any + ) -> _models.AtlasGlossaryCategory: + """Create a glossary category. + + :param glossary_category: The glossary category definition. A category must be anchored to a + Glossary + when creating. + Optionally, terms belonging to the category and the hierarchy + can also be defined during creation. Is one of the following types: AtlasGlossaryCategory, + JSON, IO Required. + :type glossary_category: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory or JSON + or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryCategory. The AtlasGlossaryCategory is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AtlasGlossaryCategory] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(glossary_category, (IOBase, bytes)): + _content = glossary_category + else: + _content = json.dumps(glossary_category, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_create_category_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossaryCategory, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_category(self, category_guid: str, **kwargs: Any) -> _models.AtlasGlossaryCategory: + """Get specific glossary category by its GUID. + + :param category_guid: The globally unique identifier of the category. Required. + :type category_guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryCategory. The AtlasGlossaryCategory is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasGlossaryCategory] = kwargs.pop("cls", None) + + _request = build_glossary_get_category_request( + category_guid=category_guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossaryCategory, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update_category( + self, + category_guid: str, + glossary_category: _models.AtlasGlossaryCategory, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.AtlasGlossaryCategory: + """Update the given glossary category by its GUID. + + :param category_guid: The globally unique identifier of the category. Required. + :type category_guid: str + :param glossary_category: The glossary category to be updated. Required. + :type glossary_category: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryCategory. The AtlasGlossaryCategory is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_category( + self, category_guid: str, glossary_category: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasGlossaryCategory: + """Update the given glossary category by its GUID. + + :param category_guid: The globally unique identifier of the category. Required. + :type category_guid: str + :param glossary_category: The glossary category to be updated. Required. + :type glossary_category: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryCategory. The AtlasGlossaryCategory is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_category( + self, category_guid: str, glossary_category: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasGlossaryCategory: + """Update the given glossary category by its GUID. + + :param category_guid: The globally unique identifier of the category. Required. + :type category_guid: str + :param glossary_category: The glossary category to be updated. Required. + :type glossary_category: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryCategory. The AtlasGlossaryCategory is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_category( + self, category_guid: str, glossary_category: Union[_models.AtlasGlossaryCategory, JSON, IO], **kwargs: Any + ) -> _models.AtlasGlossaryCategory: + """Update the given glossary category by its GUID. + + :param category_guid: The globally unique identifier of the category. Required. + :type category_guid: str + :param glossary_category: The glossary category to be updated. Is one of the following types: + AtlasGlossaryCategory, JSON, IO Required. + :type glossary_category: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory or JSON + or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryCategory. The AtlasGlossaryCategory is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AtlasGlossaryCategory] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(glossary_category, (IOBase, bytes)): + _content = glossary_category + else: + _content = json.dumps(glossary_category, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_update_category_request( + category_guid=category_guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossaryCategory, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete_category( # pylint: disable=inconsistent-return-statements + self, category_guid: str, **kwargs: Any + ) -> None: + """Delete a glossary category. + + :param category_guid: The globally unique identifier of the category. Required. + :type category_guid: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_glossary_delete_category_request( + category_guid=category_guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def partial_update_category( + self, category_guid: str, partial_updates: Any, **kwargs: Any + ) -> _models.AtlasGlossaryCategory: + """Update the glossary category partially. So far we only supports partial + updating shortDescription and longDescription for category. + + :param category_guid: The globally unique identifier of the category. Required. + :type category_guid: str + :param partial_updates: A map containing keys as attribute names and values as corresponding + attribute + values for partial update. Required. + :type partial_updates: any + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryCategory. The AtlasGlossaryCategory is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.AtlasGlossaryCategory] = kwargs.pop("cls", None) + + _content = json.dumps(partial_updates, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_partial_update_category_request( + category_guid=category_guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossaryCategory, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_related_categories( + self, + category_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any, + ) -> Dict[str, List[_models.AtlasRelatedCategoryHeader]]: + """Get all related categories (parent and children). Limit, offset, and sort + parameters are currently not being enabled and won't work even they are passed. + + :param category_guid: The globally unique identifier of the category. Required. + :type category_guid: str + :keyword limit: The page size - by default there is no paging. Default value is None. + :paramtype limit: int + :keyword offset: The offset for pagination purpose. Default value is None. + :paramtype offset: int + :keyword sort: The sort order, ASC (default) or DESC. Default value is None. + :paramtype sort: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: dict mapping str to list of AtlasRelatedCategoryHeader + :rtype: dict[str, list[~azure.analytics.purview.datamap.models.AtlasRelatedCategoryHeader]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Dict[str, List[_models.AtlasRelatedCategoryHeader]]] = kwargs.pop("cls", None) + + _request = build_glossary_list_related_categories_request( + category_guid=category_guid, + limit=limit, + offset=offset, + sort=sort, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(Dict[str, List[_models.AtlasRelatedCategoryHeader]], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_category_terms( + self, + category_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any, + ) -> List[_models.AtlasRelatedTermHeader]: + """Get all terms associated with the specific category. + + :param category_guid: The globally unique identifier of the category. Required. + :type category_guid: str + :keyword limit: The page size - by default there is no paging. Default value is None. + :paramtype limit: int + :keyword offset: The offset for pagination purpose. Default value is None. + :paramtype offset: int + :keyword sort: The sort order, ASC (default) or DESC. Default value is None. + :paramtype sort: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasRelatedTermHeader + :rtype: list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AtlasRelatedTermHeader]] = kwargs.pop("cls", None) + + _request = build_glossary_list_category_terms_request( + category_guid=category_guid, + limit=limit, + offset=offset, + sort=sort, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.AtlasRelatedTermHeader], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_term( + self, + glossary_term: _models.AtlasGlossaryTerm, + *, + include_term_hierarchy: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.AtlasGlossaryTerm: + """Create a glossary term. + + :param glossary_term: The glossary term definition. A term must be anchored to a Glossary at + the time + of creation. + Optionally it can be categorized as well. Required. + :type glossary_term: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryTerm. The AtlasGlossaryTerm is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_term( + self, + glossary_term: JSON, + *, + include_term_hierarchy: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.AtlasGlossaryTerm: + """Create a glossary term. + + :param glossary_term: The glossary term definition. A term must be anchored to a Glossary at + the time + of creation. + Optionally it can be categorized as well. Required. + :type glossary_term: JSON + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryTerm. The AtlasGlossaryTerm is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_term( + self, + glossary_term: IO, + *, + include_term_hierarchy: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.AtlasGlossaryTerm: + """Create a glossary term. + + :param glossary_term: The glossary term definition. A term must be anchored to a Glossary at + the time + of creation. + Optionally it can be categorized as well. Required. + :type glossary_term: IO + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryTerm. The AtlasGlossaryTerm is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_term( + self, + glossary_term: Union[_models.AtlasGlossaryTerm, JSON, IO], + *, + include_term_hierarchy: Optional[bool] = None, + **kwargs: Any, + ) -> _models.AtlasGlossaryTerm: + """Create a glossary term. + + :param glossary_term: The glossary term definition. A term must be anchored to a Glossary at + the time + of creation. + Optionally it can be categorized as well. Is one of the following types: AtlasGlossaryTerm, + JSON, IO Required. + :type glossary_term: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm or JSON or IO + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryTerm. The AtlasGlossaryTerm is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AtlasGlossaryTerm] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(glossary_term, (IOBase, bytes)): + _content = glossary_term + else: + _content = json.dumps(glossary_term, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_create_term_request( + include_term_hierarchy=include_term_hierarchy, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossaryTerm, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_term(self, term_guid: str, **kwargs: Any) -> _models.AtlasGlossaryTerm: + """Get a specific glossary term by its GUID. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryTerm. The AtlasGlossaryTerm is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasGlossaryTerm] = kwargs.pop("cls", None) + + _request = build_glossary_get_term_request( + term_guid=term_guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossaryTerm, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update_term( + self, + term_guid: str, + glossary_term: _models.AtlasGlossaryTerm, + *, + include_term_hierarchy: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.AtlasGlossaryTerm: + """Update the given glossary term by its GUID. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param glossary_term: The glossary term to be updated. Required. + :type glossary_term: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryTerm. The AtlasGlossaryTerm is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_term( + self, + term_guid: str, + glossary_term: JSON, + *, + include_term_hierarchy: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.AtlasGlossaryTerm: + """Update the given glossary term by its GUID. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param glossary_term: The glossary term to be updated. Required. + :type glossary_term: JSON + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryTerm. The AtlasGlossaryTerm is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_term( + self, + term_guid: str, + glossary_term: IO, + *, + include_term_hierarchy: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.AtlasGlossaryTerm: + """Update the given glossary term by its GUID. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param glossary_term: The glossary term to be updated. Required. + :type glossary_term: IO + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryTerm. The AtlasGlossaryTerm is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_term( + self, + term_guid: str, + glossary_term: Union[_models.AtlasGlossaryTerm, JSON, IO], + *, + include_term_hierarchy: Optional[bool] = None, + **kwargs: Any, + ) -> _models.AtlasGlossaryTerm: + """Update the given glossary term by its GUID. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param glossary_term: The glossary term to be updated. Is one of the following types: + AtlasGlossaryTerm, JSON, IO Required. + :type glossary_term: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm or JSON or IO + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryTerm. The AtlasGlossaryTerm is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AtlasGlossaryTerm] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(glossary_term, (IOBase, bytes)): + _content = glossary_term + else: + _content = json.dumps(glossary_term, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_update_term_request( + term_guid=term_guid, + include_term_hierarchy=include_term_hierarchy, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossaryTerm, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete_term(self, term_guid: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Delete a glossary term. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_glossary_delete_term_request( + term_guid=term_guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def partial_update_term( + self, term_guid: str, partial_updates: Any, *, include_term_hierarchy: Optional[bool] = None, **kwargs: Any + ) -> _models.AtlasGlossaryTerm: + """Update the glossary term partially. So far we only supports partial updating + shortDescription, longDescription, abbreviation, usage and status for term. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param partial_updates: A map containing keys as attribute names and values as corresponding + attribute + values to be updated. Required. + :type partial_updates: any + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryTerm. The AtlasGlossaryTerm is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.AtlasGlossaryTerm] = kwargs.pop("cls", None) + + _content = json.dumps(partial_updates, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_partial_update_term_request( + term_guid=term_guid, + include_term_hierarchy=include_term_hierarchy, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossaryTerm, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_terms( + self, + glossary_term: List[_models.AtlasGlossaryTerm], + *, + include_term_hierarchy: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> List[_models.AtlasGlossaryTerm]: + """Create glossary terms in bulk. + + :param glossary_term: An array of glossary term definitions to be created in bulk. Required. + :type glossary_term: list[~azure.analytics.purview.datamap.models.AtlasGlossaryTerm] + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasGlossaryTerm + :rtype: list[~azure.analytics.purview.datamap.models.AtlasGlossaryTerm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_terms( + self, + glossary_term: IO, + *, + include_term_hierarchy: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> List[_models.AtlasGlossaryTerm]: + """Create glossary terms in bulk. + + :param glossary_term: An array of glossary term definitions to be created in bulk. Required. + :type glossary_term: IO + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasGlossaryTerm + :rtype: list[~azure.analytics.purview.datamap.models.AtlasGlossaryTerm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_terms( + self, + glossary_term: Union[List[_models.AtlasGlossaryTerm], IO], + *, + include_term_hierarchy: Optional[bool] = None, + **kwargs: Any, + ) -> List[_models.AtlasGlossaryTerm]: + """Create glossary terms in bulk. + + :param glossary_term: An array of glossary term definitions to be created in bulk. Is either a + [AtlasGlossaryTerm] type or a IO type. Required. + :type glossary_term: list[~azure.analytics.purview.datamap.models.AtlasGlossaryTerm] or IO + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasGlossaryTerm + :rtype: list[~azure.analytics.purview.datamap.models.AtlasGlossaryTerm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[List[_models.AtlasGlossaryTerm]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(glossary_term, (IOBase, bytes)): + _content = glossary_term + else: + _content = json.dumps(glossary_term, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_create_terms_request( + include_term_hierarchy=include_term_hierarchy, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.AtlasGlossaryTerm], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_entities_assigned_with_term( + self, + term_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any, + ) -> List[_models.AtlasRelatedObjectId]: + """List all related objects assigned with the specified term. Recommend using + limit/offset to get pagination result. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :keyword limit: The page size - by default there is no paging. Default value is None. + :paramtype limit: int + :keyword offset: The offset for pagination purpose. Default value is None. + :paramtype offset: int + :keyword sort: The sort order, ASC (default) or DESC. Default value is None. + :paramtype sort: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasRelatedObjectId + :rtype: list[~azure.analytics.purview.datamap.models.AtlasRelatedObjectId] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AtlasRelatedObjectId]] = kwargs.pop("cls", None) + + _request = build_glossary_list_entities_assigned_with_term_request( + term_guid=term_guid, + limit=limit, + offset=offset, + sort=sort, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.AtlasRelatedObjectId], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def assign_term_to_entities( # pylint: disable=inconsistent-return-statements + self, + term_guid: str, + related_object_ids: List[_models.AtlasRelatedObjectId], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Assign the given term to the provided list of related objects. Recommend using + small batches with multiple API calls. + + `Entities Create Or Update + operation + `_ + is an alternative to assign a term to multiple entities. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param related_object_ids: An array of related object IDs to which the term has to be + associated. Required. + :type related_object_ids: list[~azure.analytics.purview.datamap.models.AtlasRelatedObjectId] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def assign_term_to_entities( # pylint: disable=inconsistent-return-statements + self, term_guid: str, related_object_ids: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Assign the given term to the provided list of related objects. Recommend using + small batches with multiple API calls. + + `Entities Create Or Update + operation + `_ + is an alternative to assign a term to multiple entities. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param related_object_ids: An array of related object IDs to which the term has to be + associated. Required. + :type related_object_ids: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def assign_term_to_entities( # pylint: disable=inconsistent-return-statements + self, term_guid: str, related_object_ids: Union[List[_models.AtlasRelatedObjectId], IO], **kwargs: Any + ) -> None: + """Assign the given term to the provided list of related objects. Recommend using + small batches with multiple API calls. + + `Entities Create Or Update + operation + `_ + is an alternative to assign a term to multiple entities. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param related_object_ids: An array of related object IDs to which the term has to be + associated. Is either a [AtlasRelatedObjectId] type or a IO type. Required. + :type related_object_ids: list[~azure.analytics.purview.datamap.models.AtlasRelatedObjectId] or + IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(related_object_ids, (IOBase, bytes)): + _content = related_object_ids + else: + _content = json.dumps(related_object_ids, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_assign_term_to_entities_request( + term_guid=term_guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def delete_term_assignment_from_entities( # pylint: disable=inconsistent-return-statements + self, + term_guid: str, + related_object_ids: List[_models.AtlasRelatedObjectId], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Delete the term assignment for the given list of related objects. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param related_object_ids: An array of related object IDs from which the term has to be + dissociated. Required. + :type related_object_ids: list[~azure.analytics.purview.datamap.models.AtlasRelatedObjectId] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def delete_term_assignment_from_entities( # pylint: disable=inconsistent-return-statements + self, term_guid: str, related_object_ids: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Delete the term assignment for the given list of related objects. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param related_object_ids: An array of related object IDs from which the term has to be + dissociated. Required. + :type related_object_ids: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def delete_term_assignment_from_entities( # pylint: disable=inconsistent-return-statements + self, term_guid: str, related_object_ids: Union[List[_models.AtlasRelatedObjectId], IO], **kwargs: Any + ) -> None: + """Delete the term assignment for the given list of related objects. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param related_object_ids: An array of related object IDs from which the term has to be + dissociated. Is either a [AtlasRelatedObjectId] type or a IO type. Required. + :type related_object_ids: list[~azure.analytics.purview.datamap.models.AtlasRelatedObjectId] or + IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(related_object_ids, (IOBase, bytes)): + _content = related_object_ids + else: + _content = json.dumps(related_object_ids, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_delete_term_assignment_from_entities_request( + term_guid=term_guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_related_terms( + self, + term_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any, + ) -> Dict[str, List[_models.AtlasRelatedTermHeader]]: + """Get all related terms for a specific term by its GUID. Limit, offset, and sort + parameters are currently not being enabled and won't work even they are passed. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :keyword limit: The page size - by default there is no paging. Default value is None. + :paramtype limit: int + :keyword offset: The offset for pagination purpose. Default value is None. + :paramtype offset: int + :keyword sort: The sort order, ASC (default) or DESC. Default value is None. + :paramtype sort: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: dict mapping str to list of AtlasRelatedTermHeader + :rtype: dict[str, list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Dict[str, List[_models.AtlasRelatedTermHeader]]] = kwargs.pop("cls", None) + + _request = build_glossary_list_related_terms_request( + term_guid=term_guid, + limit=limit, + offset=offset, + sort=sort, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(Dict[str, List[_models.AtlasRelatedTermHeader]], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get(self, glossary_guid: str, **kwargs: Any) -> _models.AtlasGlossary: + """Get a specific Glossary by its GUID. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossary. The AtlasGlossary is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossary + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasGlossary] = kwargs.pop("cls", None) + + _request = build_glossary_get_request( + glossary_guid=glossary_guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossary, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + glossary_guid: str, + updated_glossary: _models.AtlasGlossary, + *, + ignore_terms_and_categories: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.AtlasGlossary: + """Update the given glossary. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :param updated_glossary: The glossary definition to be updated. Required. + :type updated_glossary: ~azure.analytics.purview.datamap.models.AtlasGlossary + :keyword ignore_terms_and_categories: Whether ignore terms and categories. Default value is + None. + :paramtype ignore_terms_and_categories: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossary. The AtlasGlossary is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossary + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + glossary_guid: str, + updated_glossary: JSON, + *, + ignore_terms_and_categories: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.AtlasGlossary: + """Update the given glossary. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :param updated_glossary: The glossary definition to be updated. Required. + :type updated_glossary: JSON + :keyword ignore_terms_and_categories: Whether ignore terms and categories. Default value is + None. + :paramtype ignore_terms_and_categories: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossary. The AtlasGlossary is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossary + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + glossary_guid: str, + updated_glossary: IO, + *, + ignore_terms_and_categories: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.AtlasGlossary: + """Update the given glossary. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :param updated_glossary: The glossary definition to be updated. Required. + :type updated_glossary: IO + :keyword ignore_terms_and_categories: Whether ignore terms and categories. Default value is + None. + :paramtype ignore_terms_and_categories: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossary. The AtlasGlossary is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossary + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + glossary_guid: str, + updated_glossary: Union[_models.AtlasGlossary, JSON, IO], + *, + ignore_terms_and_categories: Optional[bool] = None, + **kwargs: Any, + ) -> _models.AtlasGlossary: + """Update the given glossary. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :param updated_glossary: The glossary definition to be updated. Is one of the following types: + AtlasGlossary, JSON, IO Required. + :type updated_glossary: ~azure.analytics.purview.datamap.models.AtlasGlossary or JSON or IO + :keyword ignore_terms_and_categories: Whether ignore terms and categories. Default value is + None. + :paramtype ignore_terms_and_categories: bool + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossary. The AtlasGlossary is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossary + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AtlasGlossary] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(updated_glossary, (IOBase, bytes)): + _content = updated_glossary + else: + _content = json.dumps(updated_glossary, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_update_request( + glossary_guid=glossary_guid, + ignore_terms_and_categories=ignore_terms_and_categories, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossary, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete(self, glossary_guid: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Delete a glossary. Will delete underlying terms/categories together. Recommend + separate delete terms and categories. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_glossary_delete_request( + glossary_guid=glossary_guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_categories( + self, + glossary_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any, + ) -> List[_models.AtlasGlossaryCategory]: + """Get the categories belonging to a specific glossary. Recommend using + limit/offset to get pagination result. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :keyword limit: The page size - by default there is no paging. Default value is None. + :paramtype limit: int + :keyword offset: The offset for pagination purpose. Default value is None. + :paramtype offset: int + :keyword sort: The sort order, ASC (default) or DESC. Default value is None. + :paramtype sort: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasGlossaryCategory + :rtype: list[~azure.analytics.purview.datamap.models.AtlasGlossaryCategory] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AtlasGlossaryCategory]] = kwargs.pop("cls", None) + + _request = build_glossary_list_categories_request( + glossary_guid=glossary_guid, + limit=limit, + offset=offset, + sort=sort, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.AtlasGlossaryCategory], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_categories_headers( + self, + glossary_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any, + ) -> List[_models.AtlasRelatedCategoryHeader]: + """Get the category headers belonging to a specific glossary. Recommend using + limit/offset to get pagination result. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :keyword limit: The page size - by default there is no paging. Default value is None. + :paramtype limit: int + :keyword offset: The offset for pagination purpose. Default value is None. + :paramtype offset: int + :keyword sort: The sort order, ASC (default) or DESC. Default value is None. + :paramtype sort: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasRelatedCategoryHeader + :rtype: list[~azure.analytics.purview.datamap.models.AtlasRelatedCategoryHeader] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AtlasRelatedCategoryHeader]] = kwargs.pop("cls", None) + + _request = build_glossary_list_categories_headers_request( + glossary_guid=glossary_guid, + limit=limit, + offset=offset, + sort=sort, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.AtlasRelatedCategoryHeader], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_detailed(self, glossary_guid: str, **kwargs: Any) -> _models.AtlasGlossaryExtInfo: + """Get a specific glossary with detailed information. This API is not + recommend. + + Recommend to fetch terms/categories details separately using + + GET /datamap/api/atlas/v2/glossary/{glossaryGuid}/terms and + + GET /datamap/api/atlas/v2/glossary/{glossaryGuid}/categories. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryExtInfo. The AtlasGlossaryExtInfo is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryExtInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasGlossaryExtInfo] = kwargs.pop("cls", None) + + _request = build_glossary_get_detailed_request( + glossary_guid=glossary_guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossaryExtInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def partial_update( + self, + glossary_guid: str, + partial_updates: Any, + *, + ignore_terms_and_categories: Optional[bool] = None, + **kwargs: Any, + ) -> _models.AtlasGlossary: + """Update the glossary partially. Some properties such as qualifiedName are not + allowed to be updated. + + So far we only supports partial updating + shortDescription, longDescription, language and usage for glossary. + + Recommend + using 'ignoreTermsAndCategories=true' to reduce response body size. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :param partial_updates: A map containing keys as attribute names and values as corresponding + attribute + values. Required. + :type partial_updates: any + :keyword ignore_terms_and_categories: Whether ignore terms and categories. Default value is + None. + :paramtype ignore_terms_and_categories: bool + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossary. The AtlasGlossary is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossary + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.AtlasGlossary] = kwargs.pop("cls", None) + + _content = json.dumps(partial_updates, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_partial_update_request( + glossary_guid=glossary_guid, + ignore_terms_and_categories=ignore_terms_and_categories, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossary, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_terms( + self, + glossary_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any, + ) -> List[_models.AtlasGlossaryTerm]: + """Get terms belonging to a specific glossary. Recommend using limit/offset to get + pagination result. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :keyword limit: The page size - by default there is no paging. Default value is None. + :paramtype limit: int + :keyword offset: The offset for pagination purpose. Default value is None. + :paramtype offset: int + :keyword sort: The sort order, ASC (default) or DESC. Default value is None. + :paramtype sort: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasGlossaryTerm + :rtype: list[~azure.analytics.purview.datamap.models.AtlasGlossaryTerm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AtlasGlossaryTerm]] = kwargs.pop("cls", None) + + _request = build_glossary_list_terms_request( + glossary_guid=glossary_guid, + limit=limit, + offset=offset, + sort=sort, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.AtlasGlossaryTerm], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_term_headers( + self, + glossary_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any, + ) -> List[_models.AtlasRelatedTermHeader]: + """Get term headers belonging to a specific glossary. Recommend using limit/offset + to get pagination result. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :keyword limit: The page size - by default there is no paging. Default value is None. + :paramtype limit: int + :keyword offset: The offset for pagination purpose. Default value is None. + :paramtype offset: int + :keyword sort: The sort order, ASC (default) or DESC. Default value is None. + :paramtype sort: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasRelatedTermHeader + :rtype: list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AtlasRelatedTermHeader]] = kwargs.pop("cls", None) + + _request = build_glossary_list_term_headers_request( + glossary_guid=glossary_guid, + limit=limit, + offset=offset, + sort=sort, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.AtlasRelatedTermHeader], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class DiscoveryClientOperationsMixin(DiscoveryClientMixinABC): + @overload + def query( + self, search_request: _models.SearchRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SearchResult: + """Get data using search. + + :param search_request: An object specifying the search criteria. Required. + :type search_request: ~azure.analytics.purview.datamap.models.SearchRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: SearchResult. The SearchResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.SearchResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def query( + self, search_request: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SearchResult: + """Get data using search. + + :param search_request: An object specifying the search criteria. Required. + :type search_request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: SearchResult. The SearchResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.SearchResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def query( + self, search_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SearchResult: + """Get data using search. + + :param search_request: An object specifying the search criteria. Required. + :type search_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: SearchResult. The SearchResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.SearchResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def query(self, search_request: Union[_models.SearchRequest, JSON, IO], **kwargs: Any) -> _models.SearchResult: + """Get data using search. + + :param search_request: An object specifying the search criteria. Is one of the following types: + SearchRequest, JSON, IO Required. + :type search_request: ~azure.analytics.purview.datamap.models.SearchRequest or JSON or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: SearchResult. The SearchResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.SearchResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SearchResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(search_request, (IOBase, bytes)): + _content = search_request + else: + _content = json.dumps(search_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_discovery_query_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SearchResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def suggest( + self, suggest_request: _models.SuggestRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SuggestResult: + """Get search suggestions by query criteria. + + :param suggest_request: An object specifying the suggest criteria. Required. + :type suggest_request: ~azure.analytics.purview.datamap.models.SuggestRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: SuggestResult. The SuggestResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.SuggestResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def suggest( + self, suggest_request: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SuggestResult: + """Get search suggestions by query criteria. + + :param suggest_request: An object specifying the suggest criteria. Required. + :type suggest_request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: SuggestResult. The SuggestResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.SuggestResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def suggest( + self, suggest_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SuggestResult: + """Get search suggestions by query criteria. + + :param suggest_request: An object specifying the suggest criteria. Required. + :type suggest_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: SuggestResult. The SuggestResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.SuggestResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def suggest(self, suggest_request: Union[_models.SuggestRequest, JSON, IO], **kwargs: Any) -> _models.SuggestResult: + """Get search suggestions by query criteria. + + :param suggest_request: An object specifying the suggest criteria. Is one of the following + types: SuggestRequest, JSON, IO Required. + :type suggest_request: ~azure.analytics.purview.datamap.models.SuggestRequest or JSON or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: SuggestResult. The SuggestResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.SuggestResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SuggestResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(suggest_request, (IOBase, bytes)): + _content = suggest_request + else: + _content = json.dumps(suggest_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_discovery_suggest_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SuggestResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def auto_complete( + self, + auto_complete_request: _models.AutoCompleteRequest, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.AutoCompleteResult: + """Get auto complete options. + + :param auto_complete_request: An object specifying the autocomplete criteria. Required. + :type auto_complete_request: ~azure.analytics.purview.datamap.models.AutoCompleteRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AutoCompleteResult. The AutoCompleteResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AutoCompleteResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def auto_complete( + self, auto_complete_request: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AutoCompleteResult: + """Get auto complete options. + + :param auto_complete_request: An object specifying the autocomplete criteria. Required. + :type auto_complete_request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AutoCompleteResult. The AutoCompleteResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AutoCompleteResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def auto_complete( + self, auto_complete_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AutoCompleteResult: + """Get auto complete options. + + :param auto_complete_request: An object specifying the autocomplete criteria. Required. + :type auto_complete_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AutoCompleteResult. The AutoCompleteResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AutoCompleteResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def auto_complete( + self, auto_complete_request: Union[_models.AutoCompleteRequest, JSON, IO], **kwargs: Any + ) -> _models.AutoCompleteResult: + """Get auto complete options. + + :param auto_complete_request: An object specifying the autocomplete criteria. Is one of the + following types: AutoCompleteRequest, JSON, IO Required. + :type auto_complete_request: ~azure.analytics.purview.datamap.models.AutoCompleteRequest or + JSON or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AutoCompleteResult. The AutoCompleteResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AutoCompleteResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutoCompleteResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(auto_complete_request, (IOBase, bytes)): + _content = auto_complete_request + else: + _content = json.dumps(auto_complete_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_discovery_auto_complete_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AutoCompleteResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class LineageClientOperationsMixin(LineageClientMixinABC): + @distributed_trace + def get( + self, guid: str, *, direction: Union[str, _models.Direction], depth: Optional[int] = None, **kwargs: Any + ) -> _models.AtlasLineageInfo: + """Get lineage info of the entity specified by GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :keyword direction: The direction of the lineage, which could be INPUT, OUTPUT or BOTH. Known + values are: "BOTH", "INPUT", and "OUTPUT". Required. + :paramtype direction: str or ~azure.analytics.purview.datamap.models.Direction + :keyword depth: The number of hops for lineage. Default value is None. + :paramtype depth: int + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasLineageInfo. The AtlasLineageInfo is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasLineageInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasLineageInfo] = kwargs.pop("cls", None) + + _request = build_lineage_get_request( + guid=guid, + direction=direction, + depth=depth, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasLineageInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_next_page( + self, + guid: str, + *, + direction: Union[str, _models.Direction], + offset: Optional[int] = None, + limit: Optional[int] = None, + **kwargs: Any, + ) -> _models.AtlasLineageInfo: + """Return immediate next page lineage info about entity with pagination. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :keyword direction: The direction of the lineage, which could be INPUT, OUTPUT or BOTH. Known + values are: "BOTH", "INPUT", and "OUTPUT". Required. + :paramtype direction: str or ~azure.analytics.purview.datamap.models.Direction + :keyword offset: The offset for pagination purpose. Default value is None. + :paramtype offset: int + :keyword limit: The page size - by default there is no paging. Default value is None. + :paramtype limit: int + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasLineageInfo. The AtlasLineageInfo is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasLineageInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasLineageInfo] = kwargs.pop("cls", None) + + _request = build_lineage_get_next_page_request( + guid=guid, + direction=direction, + offset=offset, + limit=limit, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasLineageInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_by_unique_attribute( + self, + type_name: str, + *, + direction: Union[str, _models.Direction], + depth: Optional[int] = None, + attr: Optional[str] = None, + **kwargs: Any, + ) -> _models.AtlasLineageInfo: + """Return lineage info about entity. + + In addition to the typeName path parameter, + attribute key-value pair(s) can be provided in the following + format + + attr:[attrName]=[attrValue] + + NOTE: The attrName and attrValue should be + unique across entities, eg. qualifiedName. + + The REST request would look + something like this: + + GET + /v2/lineage/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :keyword direction: The direction of the lineage, which could be INPUT, OUTPUT or BOTH. Known + values are: "BOTH", "INPUT", and "OUTPUT". Required. + :paramtype direction: str or ~azure.analytics.purview.datamap.models.Direction + :keyword depth: The number of hops for lineage. Default value is None. + :paramtype depth: int + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasLineageInfo. The AtlasLineageInfo is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasLineageInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasLineageInfo] = kwargs.pop("cls", None) + + _request = build_lineage_get_by_unique_attribute_request( + type_name=type_name, + direction=direction, + depth=depth, + attr=attr, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasLineageInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class RelationshipClientOperationsMixin(RelationshipClientMixinABC): + @overload + def create( + self, relationship: _models.AtlasRelationship, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasRelationship: + """Create a new relationship between entities. + + :param relationship: The AtlasRelationship object containing the information for the + relationship to + be created. Required. + :type relationship: ~azure.analytics.purview.datamap.models.AtlasRelationship + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationship. The AtlasRelationship is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationship + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, relationship: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasRelationship: + """Create a new relationship between entities. + + :param relationship: The AtlasRelationship object containing the information for the + relationship to + be created. Required. + :type relationship: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationship. The AtlasRelationship is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationship + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, relationship: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasRelationship: + """Create a new relationship between entities. + + :param relationship: The AtlasRelationship object containing the information for the + relationship to + be created. Required. + :type relationship: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationship. The AtlasRelationship is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationship + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, relationship: Union[_models.AtlasRelationship, JSON, IO], **kwargs: Any + ) -> _models.AtlasRelationship: + """Create a new relationship between entities. + + :param relationship: The AtlasRelationship object containing the information for the + relationship to + be created. Is one of the following types: AtlasRelationship, JSON, IO Required. + :type relationship: ~azure.analytics.purview.datamap.models.AtlasRelationship or JSON or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationship. The AtlasRelationship is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationship + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AtlasRelationship] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(relationship, (IOBase, bytes)): + _content = relationship + else: + _content = json.dumps(relationship, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_relationship_create_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasRelationship, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, relationship: _models.AtlasRelationship, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasRelationship: + """Update an existing relationship between entities. + + :param relationship: The AtlasRelationship object containing the information for the + relationship to + be created. Required. + :type relationship: ~azure.analytics.purview.datamap.models.AtlasRelationship + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationship. The AtlasRelationship is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationship + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, relationship: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasRelationship: + """Update an existing relationship between entities. + + :param relationship: The AtlasRelationship object containing the information for the + relationship to + be created. Required. + :type relationship: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationship. The AtlasRelationship is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationship + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, relationship: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasRelationship: + """Update an existing relationship between entities. + + :param relationship: The AtlasRelationship object containing the information for the + relationship to + be created. Required. + :type relationship: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationship. The AtlasRelationship is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationship + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, relationship: Union[_models.AtlasRelationship, JSON, IO], **kwargs: Any + ) -> _models.AtlasRelationship: + """Update an existing relationship between entities. + + :param relationship: The AtlasRelationship object containing the information for the + relationship to + be created. Is one of the following types: AtlasRelationship, JSON, IO Required. + :type relationship: ~azure.analytics.purview.datamap.models.AtlasRelationship or JSON or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationship. The AtlasRelationship is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationship + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AtlasRelationship] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(relationship, (IOBase, bytes)): + _content = relationship + else: + _content = json.dumps(relationship, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_relationship_update_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasRelationship, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get( + self, guid: str, *, extended_info: Optional[bool] = None, **kwargs: Any + ) -> _models.AtlasRelationshipWithExtInfo: + """Get relationship information between entities by its GUID. + + :param guid: The globally unique identifier of the relationship. Required. + :type guid: str + :keyword extended_info: Limits whether includes extended information. Default value is None. + :paramtype extended_info: bool + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationshipWithExtInfo. The AtlasRelationshipWithExtInfo is compatible with + MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationshipWithExtInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasRelationshipWithExtInfo] = kwargs.pop("cls", None) + + _request = build_relationship_get_request( + guid=guid, + extended_info=extended_info, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasRelationshipWithExtInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete(self, guid: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Delete a relationship between entities by its GUID. + + :param guid: The globally unique identifier of the relationship. Required. + :type guid: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_relationship_delete_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class TypeClientOperationsMixin(TypeClientMixinABC): # pylint: disable=too-many-public-methods + @distributed_trace + def get_business_metadata_def_by_guid(self, guid: str, **kwargs: Any) -> _models.AtlasBusinessMetadataDef: + """Get the businessMetadata definition for the given guid. + + :param guid: businessMetadata guid. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasBusinessMetadataDef. The AtlasBusinessMetadataDef is compatible with + MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasBusinessMetadataDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasBusinessMetadataDef] = kwargs.pop("cls", None) + + _request = build_type_get_business_metadata_def_by_guid_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasBusinessMetadataDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_business_metadata_def_by_name(self, name: str, **kwargs: Any) -> _models.AtlasBusinessMetadataDef: + """Get the businessMetadata definition by it's name (unique). + + :param name: businessMetadata name. Required. + :type name: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasBusinessMetadataDef. The AtlasBusinessMetadataDef is compatible with + MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasBusinessMetadataDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasBusinessMetadataDef] = kwargs.pop("cls", None) + + _request = build_type_get_business_metadata_def_by_name_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasBusinessMetadataDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_classification_def_by_guid(self, guid: str, **kwargs: Any) -> _models.AtlasClassificationDef: + """Get the classification definition for the given GUID. + + :param guid: The globally unique identifier of the classification. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasClassificationDef. The AtlasClassificationDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasClassificationDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasClassificationDef] = kwargs.pop("cls", None) + + _request = build_type_get_classification_def_by_guid_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasClassificationDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_classification_def_by_name(self, name: str, **kwargs: Any) -> _models.AtlasClassificationDef: + """Get the classification definition by its name (unique). + + :param name: The name of the classification. Required. + :type name: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasClassificationDef. The AtlasClassificationDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasClassificationDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasClassificationDef] = kwargs.pop("cls", None) + + _request = build_type_get_classification_def_by_name_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasClassificationDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_entity_def_by_guid(self, guid: str, **kwargs: Any) -> _models.AtlasEntityDef: + """Get the Entity definition for the given GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasEntityDef. The AtlasEntityDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasEntityDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasEntityDef] = kwargs.pop("cls", None) + + _request = build_type_get_entity_def_by_guid_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasEntityDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_entity_def_by_name(self, name: str, **kwargs: Any) -> _models.AtlasEntityDef: + """Get the entity definition by its name (unique). + + :param name: The name of the entity. Required. + :type name: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasEntityDef. The AtlasEntityDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasEntityDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasEntityDef] = kwargs.pop("cls", None) + + _request = build_type_get_entity_def_by_name_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasEntityDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_enum_def_by_guid(self, guid: str, **kwargs: Any) -> _models.AtlasEnumDef: + """Get the enum definition for the given GUID. + + :param guid: The globally unique identifier of the enum. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasEnumDef. The AtlasEnumDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasEnumDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasEnumDef] = kwargs.pop("cls", None) + + _request = build_type_get_enum_def_by_guid_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasEnumDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_enum_def_by_name(self, name: str, **kwargs: Any) -> _models.AtlasEnumDef: + """Get the enum definition by its name (unique). + + :param name: The name of the enum. Required. + :type name: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasEnumDef. The AtlasEnumDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasEnumDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasEnumDef] = kwargs.pop("cls", None) + + _request = build_type_get_enum_def_by_name_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasEnumDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_relationship_def_by_guid(self, guid: str, **kwargs: Any) -> _models.AtlasRelationshipDef: + """Get the relationship definition for the given GUID. + + :param guid: The globally unique identifier of the relationship. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationshipDef. The AtlasRelationshipDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationshipDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasRelationshipDef] = kwargs.pop("cls", None) + + _request = build_type_get_relationship_def_by_guid_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasRelationshipDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_relationship_def_by_name(self, name: str, **kwargs: Any) -> _models.AtlasRelationshipDef: + """Get the relationship definition by its name (unique). + + :param name: The name of the relationship. Required. + :type name: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationshipDef. The AtlasRelationshipDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationshipDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasRelationshipDef] = kwargs.pop("cls", None) + + _request = build_type_get_relationship_def_by_name_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasRelationshipDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_struct_def_by_guid(self, guid: str, **kwargs: Any) -> _models.AtlasStructDef: + """Get the struct definition for the given GUID. + + :param guid: The globally unique identifier of the struct. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasStructDef. The AtlasStructDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasStructDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasStructDef] = kwargs.pop("cls", None) + + _request = build_type_get_struct_def_by_guid_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasStructDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_struct_def_by_name(self, name: str, **kwargs: Any) -> _models.AtlasStructDef: + """Get the struct definition by its name (unique). + + :param name: The name of the struct. Required. + :type name: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasStructDef. The AtlasStructDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasStructDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasStructDef] = kwargs.pop("cls", None) + + _request = build_type_get_struct_def_by_name_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasStructDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_by_guid(self, guid: str, **kwargs: Any) -> _models.AtlasTypeDef: + """Get the type definition for the given GUID. + + :param guid: The globally unique identifier of the type. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypeDef. The AtlasTypeDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypeDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasTypeDef] = kwargs.pop("cls", None) + + _request = build_type_get_by_guid_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasTypeDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_by_name(self, name: str, **kwargs: Any) -> _models.AtlasTypeDef: + """Get the type definition by its name (unique). + + :param name: The name of the type. Required. + :type name: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypeDef. The AtlasTypeDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypeDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasTypeDef] = kwargs.pop("cls", None) + + _request = build_type_get_by_name_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasTypeDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Delete API for type identified by its name. + + :param name: The name of the type. Required. + :type name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_type_delete_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list( + self, + *, + include_term_template: Optional[bool] = None, + type: Optional[Union[str, _models.Typedef]] = None, + **kwargs: Any, + ) -> _models.AtlasTypesDef: + """List all type definitions in bulk. + + :keyword include_term_template: Whether include termtemplatedef when return all typedefs. + This is always true + when search filter type=term_template. Default value is None. + :paramtype include_term_template: bool + :keyword type: Typedef name as search filter when get typedefs. Known values are: "enum", + "entity", "classification", "relationship", "struct", and "term_template". Default value is + None. + :paramtype type: str or ~azure.analytics.purview.datamap.models.Typedef + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypesDef. The AtlasTypesDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasTypesDef] = kwargs.pop("cls", None) + + _request = build_type_list_request( + include_term_template=include_term_template, + type=type, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasTypesDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def bulk_create( + self, types_def: _models.AtlasTypesDef, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasTypesDef: + """Create all atlas type definitions in bulk, only new definitions will be + created. + Any changes to the existing definitions will be discarded. + + :param types_def: A composite wrapper object with corresponding lists of the type definition. + Required. + :type types_def: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypesDef. The AtlasTypesDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def bulk_create( + self, types_def: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasTypesDef: + """Create all atlas type definitions in bulk, only new definitions will be + created. + Any changes to the existing definitions will be discarded. + + :param types_def: A composite wrapper object with corresponding lists of the type definition. + Required. + :type types_def: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypesDef. The AtlasTypesDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def bulk_create( + self, types_def: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasTypesDef: + """Create all atlas type definitions in bulk, only new definitions will be + created. + Any changes to the existing definitions will be discarded. + + :param types_def: A composite wrapper object with corresponding lists of the type definition. + Required. + :type types_def: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypesDef. The AtlasTypesDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def bulk_create(self, types_def: Union[_models.AtlasTypesDef, JSON, IO], **kwargs: Any) -> _models.AtlasTypesDef: + """Create all atlas type definitions in bulk, only new definitions will be + created. + Any changes to the existing definitions will be discarded. + + :param types_def: A composite wrapper object with corresponding lists of the type definition. + Is one of the following types: AtlasTypesDef, JSON, IO Required. + :type types_def: ~azure.analytics.purview.datamap.models.AtlasTypesDef or JSON or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypesDef. The AtlasTypesDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AtlasTypesDef] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(types_def, (IOBase, bytes)): + _content = types_def + else: + _content = json.dumps(types_def, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_type_bulk_create_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasTypesDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def bulk_update( + self, types_def: _models.AtlasTypesDef, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasTypesDef: + """Update all types in bulk, changes detected in the type definitions would be + persisted. + + :param types_def: A composite object that captures all type definition changes. Required. + :type types_def: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypesDef. The AtlasTypesDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def bulk_update( + self, types_def: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasTypesDef: + """Update all types in bulk, changes detected in the type definitions would be + persisted. + + :param types_def: A composite object that captures all type definition changes. Required. + :type types_def: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypesDef. The AtlasTypesDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def bulk_update( + self, types_def: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasTypesDef: + """Update all types in bulk, changes detected in the type definitions would be + persisted. + + :param types_def: A composite object that captures all type definition changes. Required. + :type types_def: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypesDef. The AtlasTypesDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def bulk_update(self, types_def: Union[_models.AtlasTypesDef, JSON, IO], **kwargs: Any) -> _models.AtlasTypesDef: + """Update all types in bulk, changes detected in the type definitions would be + persisted. + + :param types_def: A composite object that captures all type definition changes. Is one of the + following types: AtlasTypesDef, JSON, IO Required. + :type types_def: ~azure.analytics.purview.datamap.models.AtlasTypesDef or JSON or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypesDef. The AtlasTypesDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AtlasTypesDef] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(types_def, (IOBase, bytes)): + _content = types_def + else: + _content = json.dumps(types_def, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_type_bulk_update_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasTypesDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def bulk_delete( # pylint: disable=inconsistent-return-statements + self, types_def: _models.AtlasTypesDef, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Delete API for all types in bulk. + + :param types_def: A composite object that captures all types to be deleted. Required. + :type types_def: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def bulk_delete( # pylint: disable=inconsistent-return-statements + self, types_def: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Delete API for all types in bulk. + + :param types_def: A composite object that captures all types to be deleted. Required. + :type types_def: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def bulk_delete( # pylint: disable=inconsistent-return-statements + self, types_def: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Delete API for all types in bulk. + + :param types_def: A composite object that captures all types to be deleted. Required. + :type types_def: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def bulk_delete( # pylint: disable=inconsistent-return-statements + self, types_def: Union[_models.AtlasTypesDef, JSON, IO], **kwargs: Any + ) -> None: + """Delete API for all types in bulk. + + :param types_def: A composite object that captures all types to be deleted. Is one of the + following types: AtlasTypesDef, JSON, IO Required. + :type types_def: ~azure.analytics.purview.datamap.models.AtlasTypesDef or JSON or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(types_def, (IOBase, bytes)): + _content = types_def + else: + _content = json.dumps(types_def, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_type_bulk_delete_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_headers( + self, + *, + include_term_template: Optional[bool] = None, + type: Optional[Union[str, _models.Typedef]] = None, + **kwargs: Any, + ) -> List[_models.AtlasTypeDefHeader]: + """List all type definitions returned as a list of minimal information header. + + :keyword include_term_template: Whether include termtemplatedef when return all typedefs. + This is always true + when search filter type=term_template. Default value is None. + :paramtype include_term_template: bool + :keyword type: Typedef name as search filter when get typedefs. Known values are: "enum", + "entity", "classification", "relationship", "struct", and "term_template". Default value is + None. + :paramtype type: str or ~azure.analytics.purview.datamap.models.Typedef + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasTypeDefHeader + :rtype: list[~azure.analytics.purview.datamap.models.AtlasTypeDefHeader] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AtlasTypeDefHeader]] = kwargs.pop("cls", None) + + _request = build_type_list_headers_request( + include_term_template=include_term_template, + type=type, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.AtlasTypeDefHeader], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_term_template_def_by_guid(self, guid: str, **kwargs: Any) -> _models.TermTemplateDef: + """Get the term template definition for the given GUID. + + :param guid: The globally unique identifier of the term template. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: TermTemplateDef. The TermTemplateDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.TermTemplateDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TermTemplateDef] = kwargs.pop("cls", None) + + _request = build_type_get_term_template_def_by_guid_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.TermTemplateDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_term_template_def_by_name(self, name: str, **kwargs: Any) -> _models.TermTemplateDef: + """Get the term template definition by its name (unique). + + :param name: The unique name of the term template. Required. + :type name: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: TermTemplateDef. The TermTemplateDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.TermTemplateDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TermTemplateDef] = kwargs.pop("cls", None) + + _request = build_type_get_term_template_def_by_name_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.TermTemplateDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_operations/_patch.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_operations/_patch.py new file mode 100644 index 0000000000000..f7dd32510333d --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_patch.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_patch.py new file mode 100644 index 0000000000000..f7dd32510333d --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_serialization.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_serialization.py new file mode 100644 index 0000000000000..8c265befc2aaf --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_serialization.py @@ -0,0 +1,2004 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError as err: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise DeserializationError("XML is invalid") from err + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str + unicode_str = str + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset # type: ignore +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[Dict[str, Any]] = {} + for k in kwargs: + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node.""" + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result.update(objects[valuetype]._flatten_subtype(key, objects)) + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + Remove the polymorphic key from the initial data. + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + """ + return key.replace("\\.", ".") + + +class Serializer(object): + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = unicode_str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise SerializationError(msg) from err + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise SerializationError("Unable to build a model: " + str(err)) from err + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is CoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise SerializationError(msg.format(data, data_type)) from err + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + not be None or empty. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. + :rtype: list, str + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is unicode_str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from err + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map # type: ignore + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise DeserializationError(msg) from err + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + try: + return list(enum_obj.__members__.values())[data] + except IndexError: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from err + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise DeserializationError(msg) from err + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise DeserializationError(msg) from err + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + else: + return date_obj diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_vendor.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_vendor.py new file mode 100644 index 0000000000000..aaa944e810c7d --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_vendor.py @@ -0,0 +1,78 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from abc import ABC +from typing import TYPE_CHECKING + +from ._configuration import ( + DiscoveryClientConfiguration, + EntityClientConfiguration, + GlossaryClientConfiguration, + LineageClientConfiguration, + RelationshipClientConfiguration, + TypeClientConfiguration, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from ._serialization import Deserializer, Serializer + + +class EntityClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: EntityClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" + + +class GlossaryClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: GlossaryClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" + + +class DiscoveryClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: DiscoveryClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" + + +class LineageClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: LineageClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" + + +class RelationshipClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: RelationshipClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" + + +class TypeClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: TypeClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_version.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_version.py new file mode 100644 index 0000000000000..be71c81bd2821 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/__init__.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/__init__.py new file mode 100644 index 0000000000000..20f6a5d75cb5b --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/__init__.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._client import EntityClient +from ._client import GlossaryClient +from ._client import DiscoveryClient +from ._client import LineageClient +from ._client import RelationshipClient +from ._client import TypeClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "EntityClient", + "GlossaryClient", + "DiscoveryClient", + "LineageClient", + "RelationshipClient", + "TypeClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_client.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_client.py new file mode 100644 index 0000000000000..a8425040bf1d0 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_client.py @@ -0,0 +1,504 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core import AsyncPipelineClient +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest + +from .._serialization import Deserializer, Serializer +from ._configuration import ( + DiscoveryClientConfiguration, + EntityClientConfiguration, + GlossaryClientConfiguration, + LineageClientConfiguration, + RelationshipClientConfiguration, + TypeClientConfiguration, +) +from ._operations import ( + DiscoveryClientOperationsMixin, + EntityClientOperationsMixin, + GlossaryClientOperationsMixin, + LineageClientOperationsMixin, + RelationshipClientOperationsMixin, + TypeClientOperationsMixin, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class EntityClient(EntityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword + """EntityClient. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{endpoint}/datamap/api" + self._config = EntityClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + + def send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "EntityClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) + + +class GlossaryClient(GlossaryClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword + """GlossaryClient. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{endpoint}/datamap/api" + self._config = GlossaryClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + + def send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "GlossaryClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) + + +class DiscoveryClient(DiscoveryClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword + """DiscoveryClient. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{endpoint}/datamap/api" + self._config = DiscoveryClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + + def send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "DiscoveryClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) + + +class LineageClient(LineageClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword + """LineageClient. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{endpoint}/datamap/api" + self._config = LineageClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + + def send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "LineageClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) + + +class RelationshipClient(RelationshipClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword + """RelationshipClient. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{endpoint}/datamap/api" + self._config = RelationshipClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + + def send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "RelationshipClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) + + +class TypeClient(TypeClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword + """TypeClient. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + _endpoint = "{endpoint}/datamap/api" + self._config = TypeClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + + def send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "TypeClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_configuration.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_configuration.py new file mode 100644 index 0000000000000..2f3aab2e70e1c --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_configuration.py @@ -0,0 +1,305 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.pipeline import policies + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class EntityClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for EntityClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2023-09-01") + + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.endpoint = endpoint + self.credential = credential + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["user_impersonation"]) + kwargs.setdefault("sdk_moniker", "analytics-purview-datamap/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy( + self.credential, *self.credential_scopes, **kwargs + ) + + +class GlossaryClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for GlossaryClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2023-09-01") + + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.endpoint = endpoint + self.credential = credential + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["user_impersonation"]) + kwargs.setdefault("sdk_moniker", "analytics-purview-datamap/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy( + self.credential, *self.credential_scopes, **kwargs + ) + + +class DiscoveryClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for DiscoveryClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2023-09-01") + + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.endpoint = endpoint + self.credential = credential + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["user_impersonation"]) + kwargs.setdefault("sdk_moniker", "analytics-purview-datamap/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy( + self.credential, *self.credential_scopes, **kwargs + ) + + +class LineageClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for LineageClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2023-09-01") + + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.endpoint = endpoint + self.credential = credential + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["user_impersonation"]) + kwargs.setdefault("sdk_moniker", "analytics-purview-datamap/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy( + self.credential, *self.credential_scopes, **kwargs + ) + + +class RelationshipClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for RelationshipClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2023-09-01") + + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.endpoint = endpoint + self.credential = credential + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["user_impersonation"]) + kwargs.setdefault("sdk_moniker", "analytics-purview-datamap/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy( + self.credential, *self.credential_scopes, **kwargs + ) + + +class TypeClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for TypeClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Required. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: The API version to use for this operation. Known values are "2023-09-01" + and None. Default value is "2023-09-01". Note that overriding this default value may result in + unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2023-09-01") + + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.endpoint = endpoint + self.credential = credential + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["user_impersonation"]) + kwargs.setdefault("sdk_moniker", "analytics-purview-datamap/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_operations/__init__.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_operations/__init__.py new file mode 100644 index 0000000000000..203123c1f4b63 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_operations/__init__.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import EntityClientOperationsMixin +from ._operations import GlossaryClientOperationsMixin +from ._operations import DiscoveryClientOperationsMixin +from ._operations import LineageClientOperationsMixin +from ._operations import RelationshipClientOperationsMixin +from ._operations import TypeClientOperationsMixin + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "EntityClientOperationsMixin", + "GlossaryClientOperationsMixin", + "DiscoveryClientOperationsMixin", + "LineageClientOperationsMixin", + "RelationshipClientOperationsMixin", + "TypeClientOperationsMixin", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_operations/_operations.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_operations/_operations.py new file mode 100644 index 0000000000000..62f48b4f8e93a --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_operations/_operations.py @@ -0,0 +1,9423 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import json +import sys +from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict + +from ... import models as _models +from ..._model_base import SdkJSONEncoder, _deserialize +from ..._operations._operations import ( + build_discovery_auto_complete_request, + build_discovery_query_request, + build_discovery_suggest_request, + build_entity_add_classification_request, + build_entity_add_classifications_by_unique_attribute_request, + build_entity_add_classifications_request, + build_entity_add_label_request, + build_entity_add_labels_by_unique_attribute_request, + build_entity_add_or_update_business_metadata_attributes_request, + build_entity_add_or_update_business_metadata_request, + build_entity_bulk_create_or_update_request, + build_entity_bulk_delete_request, + build_entity_bulk_set_classifications_request, + build_entity_create_or_update_request, + build_entity_delete_by_unique_attribute_request, + build_entity_delete_request, + build_entity_get_by_unique_attributes_request, + build_entity_get_classification_request, + build_entity_get_classifications_request, + build_entity_get_header_request, + build_entity_get_request, + build_entity_get_sample_business_metadata_template_request, + build_entity_import_business_metadata_request, + build_entity_list_by_guids_request, + build_entity_list_by_unique_attributes_request, + build_entity_move_entities_to_collection_request, + build_entity_partial_update_attribute_by_guid_request, + build_entity_partial_update_by_unique_attributes_request, + build_entity_remove_business_metadata_attributes_request, + build_entity_remove_business_metadata_request, + build_entity_remove_classification_by_unique_attribute_request, + build_entity_remove_classification_request, + build_entity_remove_labels_by_unique_attribute_request, + build_entity_remove_labels_request, + build_entity_set_labels_by_unique_attribute_request, + build_entity_set_labels_request, + build_entity_update_classifications_by_unique_attribute_request, + build_entity_update_classifications_request, + build_glossary_assign_term_to_entities_request, + build_glossary_create_categories_request, + build_glossary_create_category_request, + build_glossary_create_request, + build_glossary_create_term_request, + build_glossary_create_terms_request, + build_glossary_delete_category_request, + build_glossary_delete_request, + build_glossary_delete_term_assignment_from_entities_request, + build_glossary_delete_term_request, + build_glossary_get_category_request, + build_glossary_get_detailed_request, + build_glossary_get_request, + build_glossary_get_term_request, + build_glossary_list_categories_headers_request, + build_glossary_list_categories_request, + build_glossary_list_category_terms_request, + build_glossary_list_entities_assigned_with_term_request, + build_glossary_list_related_categories_request, + build_glossary_list_related_terms_request, + build_glossary_list_request, + build_glossary_list_term_headers_request, + build_glossary_list_terms_request, + build_glossary_partial_update_category_request, + build_glossary_partial_update_request, + build_glossary_partial_update_term_request, + build_glossary_update_category_request, + build_glossary_update_request, + build_glossary_update_term_request, + build_lineage_get_by_unique_attribute_request, + build_lineage_get_next_page_request, + build_lineage_get_request, + build_relationship_create_request, + build_relationship_delete_request, + build_relationship_get_request, + build_relationship_update_request, + build_type_bulk_create_request, + build_type_bulk_delete_request, + build_type_bulk_update_request, + build_type_delete_request, + build_type_get_business_metadata_def_by_guid_request, + build_type_get_business_metadata_def_by_name_request, + build_type_get_by_guid_request, + build_type_get_by_name_request, + build_type_get_classification_def_by_guid_request, + build_type_get_classification_def_by_name_request, + build_type_get_entity_def_by_guid_request, + build_type_get_entity_def_by_name_request, + build_type_get_enum_def_by_guid_request, + build_type_get_enum_def_by_name_request, + build_type_get_relationship_def_by_guid_request, + build_type_get_relationship_def_by_name_request, + build_type_get_struct_def_by_guid_request, + build_type_get_struct_def_by_name_request, + build_type_get_term_template_def_by_guid_request, + build_type_get_term_template_def_by_name_request, + build_type_list_headers_request, + build_type_list_request, +) +from .._vendor import ( + DiscoveryClientMixinABC, + EntityClientMixinABC, + GlossaryClientMixinABC, + LineageClientMixinABC, + RelationshipClientMixinABC, + TypeClientMixinABC, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +_Unset: Any = object() +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class EntityClientOperationsMixin(EntityClientMixinABC): # pylint: disable=too-many-public-methods + @overload + async def create_or_update( + self, + entity: _models.AtlasEntityWithExtInfo, + *, + business_attribute_update_behavior: Optional[Union[str, _models.BusinessAttributeUpdateBehavior]] = None, + collection_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EntityMutationResponse: + """Create or update an entity. + Existing entity is matched using its unique guid if + supplied or by its unique attributes eg: qualifiedName. + Map and array of + collections are not well supported. E.g., array`>, array>. + For each contact type, the maximum number of contacts is 20. + + :param entity: Atlas entity with extended information. Required. + :type entity: ~azure.analytics.purview.datamap.models.AtlasEntityWithExtInfo + :keyword business_attribute_update_behavior: Used to define the update behavior for business + attributes when updating + entities. Known values are: "ignore", "replace", and "merge". Default value is None. + :paramtype business_attribute_update_behavior: str or + ~azure.analytics.purview.datamap.models.BusinessAttributeUpdateBehavior + :keyword collection_id: The collection where entities will be moved to. Only specify a value if + you + need to move an entity to another collection. Default value is None. + :paramtype collection_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + entity: JSON, + *, + business_attribute_update_behavior: Optional[Union[str, _models.BusinessAttributeUpdateBehavior]] = None, + collection_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EntityMutationResponse: + """Create or update an entity. + Existing entity is matched using its unique guid if + supplied or by its unique attributes eg: qualifiedName. + Map and array of + collections are not well supported. E.g., array`>, array>. + For each contact type, the maximum number of contacts is 20. + + :param entity: Atlas entity with extended information. Required. + :type entity: JSON + :keyword business_attribute_update_behavior: Used to define the update behavior for business + attributes when updating + entities. Known values are: "ignore", "replace", and "merge". Default value is None. + :paramtype business_attribute_update_behavior: str or + ~azure.analytics.purview.datamap.models.BusinessAttributeUpdateBehavior + :keyword collection_id: The collection where entities will be moved to. Only specify a value if + you + need to move an entity to another collection. Default value is None. + :paramtype collection_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + entity: IO, + *, + business_attribute_update_behavior: Optional[Union[str, _models.BusinessAttributeUpdateBehavior]] = None, + collection_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EntityMutationResponse: + """Create or update an entity. + Existing entity is matched using its unique guid if + supplied or by its unique attributes eg: qualifiedName. + Map and array of + collections are not well supported. E.g., array`>, array>. + For each contact type, the maximum number of contacts is 20. + + :param entity: Atlas entity with extended information. Required. + :type entity: IO + :keyword business_attribute_update_behavior: Used to define the update behavior for business + attributes when updating + entities. Known values are: "ignore", "replace", and "merge". Default value is None. + :paramtype business_attribute_update_behavior: str or + ~azure.analytics.purview.datamap.models.BusinessAttributeUpdateBehavior + :keyword collection_id: The collection where entities will be moved to. Only specify a value if + you + need to move an entity to another collection. Default value is None. + :paramtype collection_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + entity: Union[_models.AtlasEntityWithExtInfo, JSON, IO], + *, + business_attribute_update_behavior: Optional[Union[str, _models.BusinessAttributeUpdateBehavior]] = None, + collection_id: Optional[str] = None, + **kwargs: Any + ) -> _models.EntityMutationResponse: + """Create or update an entity. + Existing entity is matched using its unique guid if + supplied or by its unique attributes eg: qualifiedName. + Map and array of + collections are not well supported. E.g., array`>, array>. + For each contact type, the maximum number of contacts is 20. + + :param entity: Atlas entity with extended information. Is one of the following types: + AtlasEntityWithExtInfo, JSON, IO Required. + :type entity: ~azure.analytics.purview.datamap.models.AtlasEntityWithExtInfo or JSON or IO + :keyword business_attribute_update_behavior: Used to define the update behavior for business + attributes when updating + entities. Known values are: "ignore", "replace", and "merge". Default value is None. + :paramtype business_attribute_update_behavior: str or + ~azure.analytics.purview.datamap.models.BusinessAttributeUpdateBehavior + :keyword collection_id: The collection where entities will be moved to. Only specify a value if + you + need to move an entity to another collection. Default value is None. + :paramtype collection_id: str + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EntityMutationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(entity, (IOBase, bytes)): + _content = entity + else: + _content = json.dumps(entity, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_create_or_update_request( + business_attribute_update_behavior=business_attribute_update_behavior, + collection_id=collection_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.EntityMutationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_by_guids( + self, + *, + guid: List[str], + min_ext_info: Optional[bool] = None, + ignore_relationships: Optional[bool] = None, + **kwargs: Any + ) -> _models.AtlasEntitiesWithExtInfo: + """List entities in bulk identified by its GUIDs. + + :keyword guid: An array of GUIDs of entities to list. Required. + :paramtype guid: list[str] + :keyword min_ext_info: Whether to return minimal information for referred entities. Default + value is None. + :paramtype min_ext_info: bool + :keyword ignore_relationships: Whether to ignore relationship attributes. Default value is + None. + :paramtype ignore_relationships: bool + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasEntitiesWithExtInfo. The AtlasEntitiesWithExtInfo is compatible with + MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasEntitiesWithExtInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasEntitiesWithExtInfo] = kwargs.pop("cls", None) + + _request = build_entity_list_by_guids_request( + guid=guid, + min_ext_info=min_ext_info, + ignore_relationships=ignore_relationships, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasEntitiesWithExtInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def bulk_create_or_update( + self, + entities: _models.AtlasEntitiesWithExtInfo, + *, + collection_id: Optional[str] = None, + business_attribute_update_behavior: Optional[Union[str, _models.BusinessAttributeUpdateBehavior]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EntityMutationResponse: + """Create or update entities in bulk. + Existing entity is matched using its unique + guid if supplied or by its unique attributes eg: qualifiedName. + Map and array + of collections are not well supported. E.g., array`>, + array>. + For each contact type, the maximum number of contacts + is 20. + + :param entities: An array of entities to create or update. Required. + :type entities: ~azure.analytics.purview.datamap.models.AtlasEntitiesWithExtInfo + :keyword collection_id: The collection where entities will be moved to. Only specify a value if + you + need to move an entity to another collection. Default value is None. + :paramtype collection_id: str + :keyword business_attribute_update_behavior: Used to define the update behavior for business + attributes when updating + entities. Known values are: "ignore", "replace", and "merge". Default value is None. + :paramtype business_attribute_update_behavior: str or + ~azure.analytics.purview.datamap.models.BusinessAttributeUpdateBehavior + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def bulk_create_or_update( + self, + entities: JSON, + *, + collection_id: Optional[str] = None, + business_attribute_update_behavior: Optional[Union[str, _models.BusinessAttributeUpdateBehavior]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EntityMutationResponse: + """Create or update entities in bulk. + Existing entity is matched using its unique + guid if supplied or by its unique attributes eg: qualifiedName. + Map and array + of collections are not well supported. E.g., array`>, + array>. + For each contact type, the maximum number of contacts + is 20. + + :param entities: An array of entities to create or update. Required. + :type entities: JSON + :keyword collection_id: The collection where entities will be moved to. Only specify a value if + you + need to move an entity to another collection. Default value is None. + :paramtype collection_id: str + :keyword business_attribute_update_behavior: Used to define the update behavior for business + attributes when updating + entities. Known values are: "ignore", "replace", and "merge". Default value is None. + :paramtype business_attribute_update_behavior: str or + ~azure.analytics.purview.datamap.models.BusinessAttributeUpdateBehavior + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def bulk_create_or_update( + self, + entities: IO, + *, + collection_id: Optional[str] = None, + business_attribute_update_behavior: Optional[Union[str, _models.BusinessAttributeUpdateBehavior]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EntityMutationResponse: + """Create or update entities in bulk. + Existing entity is matched using its unique + guid if supplied or by its unique attributes eg: qualifiedName. + Map and array + of collections are not well supported. E.g., array`>, + array>. + For each contact type, the maximum number of contacts + is 20. + + :param entities: An array of entities to create or update. Required. + :type entities: IO + :keyword collection_id: The collection where entities will be moved to. Only specify a value if + you + need to move an entity to another collection. Default value is None. + :paramtype collection_id: str + :keyword business_attribute_update_behavior: Used to define the update behavior for business + attributes when updating + entities. Known values are: "ignore", "replace", and "merge". Default value is None. + :paramtype business_attribute_update_behavior: str or + ~azure.analytics.purview.datamap.models.BusinessAttributeUpdateBehavior + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def bulk_create_or_update( + self, + entities: Union[_models.AtlasEntitiesWithExtInfo, JSON, IO], + *, + collection_id: Optional[str] = None, + business_attribute_update_behavior: Optional[Union[str, _models.BusinessAttributeUpdateBehavior]] = None, + **kwargs: Any + ) -> _models.EntityMutationResponse: + """Create or update entities in bulk. + Existing entity is matched using its unique + guid if supplied or by its unique attributes eg: qualifiedName. + Map and array + of collections are not well supported. E.g., array`>, + array>. + For each contact type, the maximum number of contacts + is 20. + + :param entities: An array of entities to create or update. Is one of the following types: + AtlasEntitiesWithExtInfo, JSON, IO Required. + :type entities: ~azure.analytics.purview.datamap.models.AtlasEntitiesWithExtInfo or JSON or IO + :keyword collection_id: The collection where entities will be moved to. Only specify a value if + you + need to move an entity to another collection. Default value is None. + :paramtype collection_id: str + :keyword business_attribute_update_behavior: Used to define the update behavior for business + attributes when updating + entities. Known values are: "ignore", "replace", and "merge". Default value is None. + :paramtype business_attribute_update_behavior: str or + ~azure.analytics.purview.datamap.models.BusinessAttributeUpdateBehavior + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EntityMutationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(entities, (IOBase, bytes)): + _content = entities + else: + _content = json.dumps(entities, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_bulk_create_or_update_request( + collection_id=collection_id, + business_attribute_update_behavior=business_attribute_update_behavior, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.EntityMutationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def bulk_delete(self, *, guid: List[str], **kwargs: Any) -> _models.EntityMutationResponse: + """Delete a list of entities in bulk identified by their GUIDs or unique + attributes. + + :keyword guid: An array of GUIDs of entities to delete. Required. + :paramtype guid: list[str] + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.EntityMutationResponse] = kwargs.pop("cls", None) + + _request = build_entity_bulk_delete_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.EntityMutationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def add_classification( # pylint: disable=inconsistent-return-statements + self, request: _models.ClassificationAssociateRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Associate a classification to multiple entities in bulk. + + :param request: The request to associate a classification to multiple entities. Required. + :type request: ~azure.analytics.purview.datamap.models.ClassificationAssociateRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def add_classification( # pylint: disable=inconsistent-return-statements + self, request: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Associate a classification to multiple entities in bulk. + + :param request: The request to associate a classification to multiple entities. Required. + :type request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def add_classification( # pylint: disable=inconsistent-return-statements + self, request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Associate a classification to multiple entities in bulk. + + :param request: The request to associate a classification to multiple entities. Required. + :type request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def add_classification( # pylint: disable=inconsistent-return-statements + self, request: Union[_models.ClassificationAssociateRequest, JSON, IO], **kwargs: Any + ) -> None: + """Associate a classification to multiple entities in bulk. + + :param request: The request to associate a classification to multiple entities. Is one of the + following types: ClassificationAssociateRequest, JSON, IO Required. + :type request: ~azure.analytics.purview.datamap.models.ClassificationAssociateRequest or JSON + or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(request, (IOBase, bytes)): + _content = request + else: + _content = json.dumps(request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_add_classification_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def get( + self, + guid: str, + *, + min_ext_info: Optional[bool] = None, + ignore_relationships: Optional[bool] = None, + **kwargs: Any + ) -> _models.AtlasEntityWithExtInfo: + """Get complete definition of an entity given its GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :keyword min_ext_info: Whether to return minimal information for referred entities. Default + value is None. + :paramtype min_ext_info: bool + :keyword ignore_relationships: Whether to ignore relationship attributes. Default value is + None. + :paramtype ignore_relationships: bool + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasEntityWithExtInfo. The AtlasEntityWithExtInfo is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasEntityWithExtInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasEntityWithExtInfo] = kwargs.pop("cls", None) + + _request = build_entity_get_request( + guid=guid, + min_ext_info=min_ext_info, + ignore_relationships=ignore_relationships, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasEntityWithExtInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def partial_update_attribute_by_guid( + self, guid: str, body: Any, *, name: str, **kwargs: Any + ) -> _models.EntityMutationResponse: + """Update entity partially - create or update entity attribute identified by its + GUID. + Supports only primitive attribute type and entity references. + It does not + support updating complex types like arrays, and maps. + Null updates are not + possible. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param body: The value of the attribute. Required. + :type body: any + :keyword name: The name of the attribute. Required. + :paramtype name: str + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.EntityMutationResponse] = kwargs.pop("cls", None) + + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_partial_update_attribute_by_guid_request( + guid=guid, + name=name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.EntityMutationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, guid: str, **kwargs: Any) -> _models.EntityMutationResponse: + """Delete an entity identified by its GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.EntityMutationResponse] = kwargs.pop("cls", None) + + _request = build_entity_delete_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.EntityMutationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_classification( + self, guid: str, classification_name: str, **kwargs: Any + ) -> _models.AtlasClassification: + """Get classification for a given entity represented by a GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param classification_name: The name of the classification. Required. + :type classification_name: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasClassification. The AtlasClassification is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasClassification + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasClassification] = kwargs.pop("cls", None) + + _request = build_entity_get_classification_request( + guid=guid, + classification_name=classification_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasClassification, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def remove_classification( # pylint: disable=inconsistent-return-statements + self, guid: str, classification_name: str, **kwargs: Any + ) -> None: + """Delete a given classification from an existing entity represented by a GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param classification_name: The name of the classification. Required. + :type classification_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_entity_remove_classification_request( + guid=guid, + classification_name=classification_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def get_classifications(self, guid: str, **kwargs: Any) -> _models.AtlasClassifications: + """List classifications for a given entity represented by a GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasClassifications. The AtlasClassifications is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasClassifications + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasClassifications] = kwargs.pop("cls", None) + + _request = build_entity_get_classifications_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasClassifications, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def add_classifications( # pylint: disable=inconsistent-return-statements + self, + guid: str, + classifications: List[_models.AtlasClassification], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Add classifications to an existing entity represented by a GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param classifications: An array of classifications to be added. Required. + :type classifications: list[~azure.analytics.purview.datamap.models.AtlasClassification] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def add_classifications( # pylint: disable=inconsistent-return-statements + self, guid: str, classifications: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Add classifications to an existing entity represented by a GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param classifications: An array of classifications to be added. Required. + :type classifications: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def add_classifications( # pylint: disable=inconsistent-return-statements + self, guid: str, classifications: Union[List[_models.AtlasClassification], IO], **kwargs: Any + ) -> None: + """Add classifications to an existing entity represented by a GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param classifications: An array of classifications to be added. Is either a + [AtlasClassification] type or a IO type. Required. + :type classifications: list[~azure.analytics.purview.datamap.models.AtlasClassification] or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(classifications, (IOBase, bytes)): + _content = classifications + else: + _content = json.dumps(classifications, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_add_classifications_request( + guid=guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def update_classifications( # pylint: disable=inconsistent-return-statements + self, + guid: str, + classifications: List[_models.AtlasClassification], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Update classifications to an existing entity represented by a guid. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param classifications: An array of classifications to be updated. Required. + :type classifications: list[~azure.analytics.purview.datamap.models.AtlasClassification] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_classifications( # pylint: disable=inconsistent-return-statements + self, guid: str, classifications: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Update classifications to an existing entity represented by a guid. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param classifications: An array of classifications to be updated. Required. + :type classifications: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_classifications( # pylint: disable=inconsistent-return-statements + self, guid: str, classifications: Union[List[_models.AtlasClassification], IO], **kwargs: Any + ) -> None: + """Update classifications to an existing entity represented by a guid. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param classifications: An array of classifications to be updated. Is either a + [AtlasClassification] type or a IO type. Required. + :type classifications: list[~azure.analytics.purview.datamap.models.AtlasClassification] or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(classifications, (IOBase, bytes)): + _content = classifications + else: + _content = json.dumps(classifications, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_update_classifications_request( + guid=guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def get_by_unique_attributes( + self, + type_name: str, + *, + min_ext_info: Optional[bool] = None, + ignore_relationships: Optional[bool] = None, + attr: Optional[str] = None, + **kwargs: Any + ) -> _models.AtlasEntityWithExtInfo: + """Get complete definition of an entity given its type and unique attribute. + + In + addition to the typeName path parameter, attribute key-value pair(s) can be + provided in the following format: + attr:\:code:``=:code:``. + + NOTE: The + attrName and attrValue should be unique across entities, eg. + qualifiedName. + + The REST request would look something like this: + GET + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :keyword min_ext_info: Whether to return minimal information for referred entities. Default + value is None. + :paramtype min_ext_info: bool + :keyword ignore_relationships: Whether to ignore relationship attributes. Default value is + None. + :paramtype ignore_relationships: bool + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasEntityWithExtInfo. The AtlasEntityWithExtInfo is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasEntityWithExtInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasEntityWithExtInfo] = kwargs.pop("cls", None) + + _request = build_entity_get_by_unique_attributes_request( + type_name=type_name, + min_ext_info=min_ext_info, + ignore_relationships=ignore_relationships, + attr=attr, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasEntityWithExtInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def partial_update_by_unique_attributes( + self, + type_name: str, + atlas_entity_with_ext_info: _models.AtlasEntityWithExtInfo, + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EntityMutationResponse: + """Update entity partially - Allow a subset of attributes to be updated on an + entity which is identified by its type and unique attribute eg: + Referenceable.qualifiedName. Null updates are not possible. + + In addition to the + typeName path parameter, attribute key-value pair(s) can be provided in the + following format: + + attr::code:``=:code:``. + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: + PUT + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param atlas_entity_with_ext_info: Atlas entity with extended information. Required. + :type atlas_entity_with_ext_info: + ~azure.analytics.purview.datamap.models.AtlasEntityWithExtInfo + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def partial_update_by_unique_attributes( + self, + type_name: str, + atlas_entity_with_ext_info: JSON, + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EntityMutationResponse: + """Update entity partially - Allow a subset of attributes to be updated on an + entity which is identified by its type and unique attribute eg: + Referenceable.qualifiedName. Null updates are not possible. + + In addition to the + typeName path parameter, attribute key-value pair(s) can be provided in the + following format: + + attr::code:``=:code:``. + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: + PUT + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param atlas_entity_with_ext_info: Atlas entity with extended information. Required. + :type atlas_entity_with_ext_info: JSON + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def partial_update_by_unique_attributes( + self, + type_name: str, + atlas_entity_with_ext_info: IO, + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EntityMutationResponse: + """Update entity partially - Allow a subset of attributes to be updated on an + entity which is identified by its type and unique attribute eg: + Referenceable.qualifiedName. Null updates are not possible. + + In addition to the + typeName path parameter, attribute key-value pair(s) can be provided in the + following format: + + attr::code:``=:code:``. + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: + PUT + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param atlas_entity_with_ext_info: Atlas entity with extended information. Required. + :type atlas_entity_with_ext_info: IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def partial_update_by_unique_attributes( + self, + type_name: str, + atlas_entity_with_ext_info: Union[_models.AtlasEntityWithExtInfo, JSON, IO], + *, + attr: Optional[str] = None, + **kwargs: Any + ) -> _models.EntityMutationResponse: + """Update entity partially - Allow a subset of attributes to be updated on an + entity which is identified by its type and unique attribute eg: + Referenceable.qualifiedName. Null updates are not possible. + + In addition to the + typeName path parameter, attribute key-value pair(s) can be provided in the + following format: + + attr::code:``=:code:``. + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: + PUT + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param atlas_entity_with_ext_info: Atlas entity with extended information. Is one of the + following types: AtlasEntityWithExtInfo, JSON, IO Required. + :type atlas_entity_with_ext_info: + ~azure.analytics.purview.datamap.models.AtlasEntityWithExtInfo or JSON or IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EntityMutationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(atlas_entity_with_ext_info, (IOBase, bytes)): + _content = atlas_entity_with_ext_info + else: + _content = json.dumps(atlas_entity_with_ext_info, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_partial_update_by_unique_attributes_request( + type_name=type_name, + attr=attr, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.EntityMutationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete_by_unique_attribute( + self, type_name: str, *, attr: Optional[str] = None, **kwargs: Any + ) -> _models.EntityMutationResponse: + """Delete an entity identified by its type and unique attributes. + In addition to + the typeName path parameter, attribute key-value pair(s) can be provided in the + following format: + attr:\:code:``=\:code:``. + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: + DELETE + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.EntityMutationResponse] = kwargs.pop("cls", None) + + _request = build_entity_delete_by_unique_attribute_request( + type_name=type_name, + attr=attr, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.EntityMutationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def remove_classification_by_unique_attribute( # pylint: disable=inconsistent-return-statements,name-too-long + self, type_name: str, classification_name: str, *, attr: Optional[str] = None, **kwargs: Any + ) -> None: + """Delete a given classification from an entity identified by its type and unique + attributes. + + :param type_name: The name of the type. Required. + :type type_name: str + :param classification_name: The name of the classification. Required. + :type classification_name: str + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_entity_remove_classification_by_unique_attribute_request( + type_name=type_name, + classification_name=classification_name, + attr=attr, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def add_classifications_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, + type_name: str, + atlas_classification_array: List[_models.AtlasClassification], + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Add classification to the entity identified by its type and unique attributes. + + :param type_name: The name of the type. Required. + :type type_name: str + :param atlas_classification_array: An array of classification to be added. Required. + :type atlas_classification_array: + list[~azure.analytics.purview.datamap.models.AtlasClassification] + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def add_classifications_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, + type_name: str, + atlas_classification_array: IO, + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Add classification to the entity identified by its type and unique attributes. + + :param type_name: The name of the type. Required. + :type type_name: str + :param atlas_classification_array: An array of classification to be added. Required. + :type atlas_classification_array: IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def add_classifications_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, + type_name: str, + atlas_classification_array: Union[List[_models.AtlasClassification], IO], + *, + attr: Optional[str] = None, + **kwargs: Any + ) -> None: + """Add classification to the entity identified by its type and unique attributes. + + :param type_name: The name of the type. Required. + :type type_name: str + :param atlas_classification_array: An array of classification to be added. Is either a + [AtlasClassification] type or a IO type. Required. + :type atlas_classification_array: + list[~azure.analytics.purview.datamap.models.AtlasClassification] or IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(atlas_classification_array, (IOBase, bytes)): + _content = atlas_classification_array + else: + _content = json.dumps(atlas_classification_array, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_add_classifications_by_unique_attribute_request( + type_name=type_name, + attr=attr, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def update_classifications_by_unique_attribute( # pylint: disable=inconsistent-return-statements,name-too-long + self, + type_name: str, + atlas_classification_array: List[_models.AtlasClassification], + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Update classification on an entity identified by its type and unique attributes. + + :param type_name: The name of the type. Required. + :type type_name: str + :param atlas_classification_array: An array of classification to be updated. Required. + :type atlas_classification_array: + list[~azure.analytics.purview.datamap.models.AtlasClassification] + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_classifications_by_unique_attribute( # pylint: disable=inconsistent-return-statements,name-too-long + self, + type_name: str, + atlas_classification_array: IO, + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Update classification on an entity identified by its type and unique attributes. + + :param type_name: The name of the type. Required. + :type type_name: str + :param atlas_classification_array: An array of classification to be updated. Required. + :type atlas_classification_array: IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_classifications_by_unique_attribute( # pylint: disable=inconsistent-return-statements,name-too-long + self, + type_name: str, + atlas_classification_array: Union[List[_models.AtlasClassification], IO], + *, + attr: Optional[str] = None, + **kwargs: Any + ) -> None: + """Update classification on an entity identified by its type and unique attributes. + + :param type_name: The name of the type. Required. + :type type_name: str + :param atlas_classification_array: An array of classification to be updated. Is either a + [AtlasClassification] type or a IO type. Required. + :type atlas_classification_array: + list[~azure.analytics.purview.datamap.models.AtlasClassification] or IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(atlas_classification_array, (IOBase, bytes)): + _content = atlas_classification_array + else: + _content = json.dumps(atlas_classification_array, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_update_classifications_by_unique_attribute_request( + type_name=type_name, + attr=attr, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def bulk_set_classifications( + self, entity_headers: _models.AtlasEntityHeaders, *, content_type: str = "application/json", **kwargs: Any + ) -> List[str]: + """Set classifications on entities in bulk. + + :param entity_headers: Atlas entity headers. Required. + :type entity_headers: ~azure.analytics.purview.datamap.models.AtlasEntityHeaders + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of str + :rtype: list[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def bulk_set_classifications( + self, entity_headers: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> List[str]: + """Set classifications on entities in bulk. + + :param entity_headers: Atlas entity headers. Required. + :type entity_headers: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of str + :rtype: list[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def bulk_set_classifications( + self, entity_headers: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> List[str]: + """Set classifications on entities in bulk. + + :param entity_headers: Atlas entity headers. Required. + :type entity_headers: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of str + :rtype: list[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def bulk_set_classifications( + self, entity_headers: Union[_models.AtlasEntityHeaders, JSON, IO], **kwargs: Any + ) -> List[str]: + """Set classifications on entities in bulk. + + :param entity_headers: Atlas entity headers. Is one of the following types: AtlasEntityHeaders, + JSON, IO Required. + :type entity_headers: ~azure.analytics.purview.datamap.models.AtlasEntityHeaders or JSON or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of str + :rtype: list[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[List[str]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(entity_headers, (IOBase, bytes)): + _content = entity_headers + else: + _content = json.dumps(entity_headers, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_bulk_set_classifications_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[str], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_by_unique_attributes( + self, + type_name: str, + *, + min_ext_info: Optional[bool] = None, + ignore_relationships: Optional[bool] = None, + attr_n_qualified_name: Optional[str] = None, + **kwargs: Any + ) -> _models.AtlasEntitiesWithExtInfo: + """Bulk API to retrieve list of entities identified by its unique attributes. + In + addition to the typeName path parameter, attribute key-value pair(s) can be + provided in the following + format + + typeName=\:code:``&attr_1:\:code:``=\:code:``&attr_2:\:code:``=\:code:``&attr_3:\:code:``=\:code:`` + + NOTE: + The attrName should be an unique attribute for the given entity-type. + The REST + request would look something like this + + GET + /v2/entity/bulk/uniqueAttribute/type/hive_db?attr_1:qualifiedName=db1@cl1&attr_2:qualifiedName=db2@cl1 + + Note: + at least one unique attribute must be provided. + + :param type_name: The name of the type. Required. + :type type_name: str + :keyword min_ext_info: Whether to return minimal information for referred entities. Default + value is None. + :paramtype min_ext_info: bool + :keyword ignore_relationships: Whether to ignore relationship attributes. Default value is + None. + :paramtype ignore_relationships: bool + :keyword attr_n_qualified_name: Qualified name of an entity. E.g. to find 2 entities you can + set + attrs_1:qualifiedName=db1@cl1&attrs_2:qualifiedName=db2@cl1. (This is only an + example. qualifiedName can be changed to other unique attributes). Default value is None. + :paramtype attr_n_qualified_name: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasEntitiesWithExtInfo. The AtlasEntitiesWithExtInfo is compatible with + MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasEntitiesWithExtInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasEntitiesWithExtInfo] = kwargs.pop("cls", None) + + _request = build_entity_list_by_unique_attributes_request( + type_name=type_name, + min_ext_info=min_ext_info, + ignore_relationships=ignore_relationships, + attr_n_qualified_name=attr_n_qualified_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasEntitiesWithExtInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_header(self, guid: str, **kwargs: Any) -> _models.AtlasEntityHeader: + """Get entity header given its GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasEntityHeader. The AtlasEntityHeader is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasEntityHeader + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasEntityHeader] = kwargs.pop("cls", None) + + _request = build_entity_get_header_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasEntityHeader, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def remove_business_metadata( # pylint: disable=inconsistent-return-statements + self, + guid: str, + business_metadata: Dict[str, Dict[str, Any]], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Remove business metadata from an entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata: Business metadata payload. Required. + :type business_metadata: dict[str, dict[str, any]] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def remove_business_metadata( # pylint: disable=inconsistent-return-statements + self, guid: str, business_metadata: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Remove business metadata from an entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata: Business metadata payload. Required. + :type business_metadata: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def remove_business_metadata( # pylint: disable=inconsistent-return-statements + self, guid: str, business_metadata: Union[Dict[str, Dict[str, Any]], IO], **kwargs: Any + ) -> None: + """Remove business metadata from an entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata: Business metadata payload. Is either a {str: {str: Any}} type or a IO + type. Required. + :type business_metadata: dict[str, dict[str, any]] or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(business_metadata, (IOBase, bytes)): + _content = business_metadata + else: + _content = json.dumps(business_metadata, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_remove_business_metadata_request( + guid=guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def add_or_update_business_metadata( # pylint: disable=inconsistent-return-statements + self, + guid: str, + business_metadata: Dict[str, Dict[str, Any]], + *, + is_overwrite: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Add business metadata to an entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata: BusinessMetadata payload. Required. + :type business_metadata: dict[str, dict[str, any]] + :keyword is_overwrite: Whether to overwrite the existing business metadata on the entity or + not, + default is false. Default value is None. + :paramtype is_overwrite: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def add_or_update_business_metadata( # pylint: disable=inconsistent-return-statements + self, + guid: str, + business_metadata: IO, + *, + is_overwrite: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Add business metadata to an entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata: BusinessMetadata payload. Required. + :type business_metadata: IO + :keyword is_overwrite: Whether to overwrite the existing business metadata on the entity or + not, + default is false. Default value is None. + :paramtype is_overwrite: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def add_or_update_business_metadata( # pylint: disable=inconsistent-return-statements + self, + guid: str, + business_metadata: Union[Dict[str, Dict[str, Any]], IO], + *, + is_overwrite: Optional[bool] = None, + **kwargs: Any + ) -> None: + """Add business metadata to an entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata: BusinessMetadata payload. Is either a {str: {str: Any}} type or a IO + type. Required. + :type business_metadata: dict[str, dict[str, any]] or IO + :keyword is_overwrite: Whether to overwrite the existing business metadata on the entity or + not, + default is false. Default value is None. + :paramtype is_overwrite: bool + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(business_metadata, (IOBase, bytes)): + _content = business_metadata + else: + _content = json.dumps(business_metadata, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_add_or_update_business_metadata_request( + guid=guid, + is_overwrite=is_overwrite, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def remove_business_metadata_attributes( # pylint: disable=inconsistent-return-statements + self, + bm_name: str, + guid: str, + business_metadata_attributes: Dict[str, Any], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Delete business metadata attributes from an entity. + + :param bm_name: BusinessMetadata name. Required. + :type bm_name: str + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata_attributes: Business metadata attribute payload. Required. + :type business_metadata_attributes: dict[str, any] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def remove_business_metadata_attributes( # pylint: disable=inconsistent-return-statements + self, + bm_name: str, + guid: str, + business_metadata_attributes: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Delete business metadata attributes from an entity. + + :param bm_name: BusinessMetadata name. Required. + :type bm_name: str + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata_attributes: Business metadata attribute payload. Required. + :type business_metadata_attributes: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def remove_business_metadata_attributes( # pylint: disable=inconsistent-return-statements + self, bm_name: str, guid: str, business_metadata_attributes: Union[Dict[str, Any], IO], **kwargs: Any + ) -> None: + """Delete business metadata attributes from an entity. + + :param bm_name: BusinessMetadata name. Required. + :type bm_name: str + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata_attributes: Business metadata attribute payload. Is either a {str: + Any} type or a IO type. Required. + :type business_metadata_attributes: dict[str, any] or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(business_metadata_attributes, (IOBase, bytes)): + _content = business_metadata_attributes + else: + _content = json.dumps(business_metadata_attributes, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_remove_business_metadata_attributes_request( + bm_name=bm_name, + guid=guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def add_or_update_business_metadata_attributes( # pylint: disable=inconsistent-return-statements,name-too-long + self, + bm_name: str, + guid: str, + business_metadata_attributes: Dict[str, Any], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Add or update business metadata attributes. + + :param bm_name: BusinessMetadata name. Required. + :type bm_name: str + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata_attributes: Business metadata attribute payload. Required. + :type business_metadata_attributes: dict[str, any] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def add_or_update_business_metadata_attributes( # pylint: disable=inconsistent-return-statements,name-too-long + self, + bm_name: str, + guid: str, + business_metadata_attributes: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Add or update business metadata attributes. + + :param bm_name: BusinessMetadata name. Required. + :type bm_name: str + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata_attributes: Business metadata attribute payload. Required. + :type business_metadata_attributes: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def add_or_update_business_metadata_attributes( # pylint: disable=inconsistent-return-statements,name-too-long + self, bm_name: str, guid: str, business_metadata_attributes: Union[Dict[str, Any], IO], **kwargs: Any + ) -> None: + """Add or update business metadata attributes. + + :param bm_name: BusinessMetadata name. Required. + :type bm_name: str + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param business_metadata_attributes: Business metadata attribute payload. Is either a {str: + Any} type or a IO type. Required. + :type business_metadata_attributes: dict[str, any] or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(business_metadata_attributes, (IOBase, bytes)): + _content = business_metadata_attributes + else: + _content = json.dumps(business_metadata_attributes, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_add_or_update_business_metadata_attributes_request( + bm_name=bm_name, + guid=guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def get_sample_business_metadata_template(self, **kwargs: Any) -> bytes: + """Get the sample Template for uploading/creating bulk BusinessMetaData. + + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: bytes + :rtype: bytes + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[bytes] = kwargs.pop("cls", None) + + _request = build_entity_get_sample_business_metadata_template_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + await response.read() + deserialized = response.content + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def import_business_metadata( + self, body: JSON = _Unset, *, uploaded_input_stream: bytes = _Unset, **kwargs: Any + ) -> _models.BulkImportResponse: + """Upload the file for creating Business Metadata in BULK. + + :param body: Required. + :type body: JSON + :keyword uploaded_input_stream: InputStream of file. Required. + :paramtype uploaded_input_stream: bytes + :keyword content_type: The content type for the operation. Always multipart/form-data for this + operation. Default value is "multipart/form-data". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: BulkImportResponse. The BulkImportResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.BulkImportResponse + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "uploadedInputStream": bytes("bytes", encoding="utf-8") # InputStream of + file. Required. + } + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "multipart/form-data")) + cls: ClsType[_models.BulkImportResponse] = kwargs.pop("cls", None) + + if body is _Unset: + if uploaded_input_stream is _Unset: + raise TypeError("missing required argument: uploaded_input_stream") + body = {"uploadedinputstream": uploaded_input_stream} + body = {k: v for k, v in body.items() if v is not None} + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_import_business_metadata_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BulkImportResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def remove_labels( # pylint: disable=inconsistent-return-statements + self, guid: str, body: List[str], *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Delete given labels to a given entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param body: set of labels to be deleted. Required. + :type body: list[str] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def remove_labels( # pylint: disable=inconsistent-return-statements + self, guid: str, body: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Delete given labels to a given entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param body: set of labels to be deleted. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def remove_labels( # pylint: disable=inconsistent-return-statements + self, guid: str, body: Union[List[str], IO], **kwargs: Any + ) -> None: + """Delete given labels to a given entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param body: set of labels to be deleted. Is either a [str] type or a IO type. Required. + :type body: list[str] or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_remove_labels_request( + guid=guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def set_labels( # pylint: disable=inconsistent-return-statements + self, guid: str, body: List[str], *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Set labels to a given entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param body: set of labels to be set to the entity. Required. + :type body: list[str] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_labels( # pylint: disable=inconsistent-return-statements + self, guid: str, body: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Set labels to a given entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param body: set of labels to be set to the entity. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def set_labels( # pylint: disable=inconsistent-return-statements + self, guid: str, body: Union[List[str], IO], **kwargs: Any + ) -> None: + """Set labels to a given entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param body: set of labels to be set to the entity. Is either a [str] type or a IO type. + Required. + :type body: list[str] or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_set_labels_request( + guid=guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def add_label( # pylint: disable=inconsistent-return-statements + self, guid: str, body: List[str], *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Add given labels to a given entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param body: set of labels to be added. Required. + :type body: list[str] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def add_label( # pylint: disable=inconsistent-return-statements + self, guid: str, body: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Add given labels to a given entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param body: set of labels to be added. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def add_label( # pylint: disable=inconsistent-return-statements + self, guid: str, body: Union[List[str], IO], **kwargs: Any + ) -> None: + """Add given labels to a given entity. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :param body: set of labels to be added. Is either a [str] type or a IO type. Required. + :type body: list[str] or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_add_label_request( + guid=guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def remove_labels_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, + type_name: str, + body: List[str], + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Delete given labels to a given entity identified by its type and unique + attribute. + + If labels is null/empty, no labels will be removed. + + If any labels + in labels set are non-existing labels, they will be ignored, only existing + labels will be removed. In addition to the typeName path parameter, attribute + key-value pair(s) can be provided in the following format: + attr::code:``=:code:``. NOTE: The attrName and attrValue should be unique + across entities, eg. qualifiedName. The REST request would look something like + this: DELETE + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param body: set of labels to be deleted. Required. + :type body: list[str] + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def remove_labels_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, + type_name: str, + body: IO, + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Delete given labels to a given entity identified by its type and unique + attribute. + + If labels is null/empty, no labels will be removed. + + If any labels + in labels set are non-existing labels, they will be ignored, only existing + labels will be removed. In addition to the typeName path parameter, attribute + key-value pair(s) can be provided in the following format: + attr::code:``=:code:``. NOTE: The attrName and attrValue should be unique + across entities, eg. qualifiedName. The REST request would look something like + this: DELETE + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param body: set of labels to be deleted. Required. + :type body: IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def remove_labels_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, type_name: str, body: Union[List[str], IO], *, attr: Optional[str] = None, **kwargs: Any + ) -> None: + """Delete given labels to a given entity identified by its type and unique + attribute. + + If labels is null/empty, no labels will be removed. + + If any labels + in labels set are non-existing labels, they will be ignored, only existing + labels will be removed. In addition to the typeName path parameter, attribute + key-value pair(s) can be provided in the following format: + attr::code:``=:code:``. NOTE: The attrName and attrValue should be unique + across entities, eg. qualifiedName. The REST request would look something like + this: DELETE + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param body: set of labels to be deleted. Is either a [str] type or a IO type. Required. + :type body: list[str] or IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_remove_labels_by_unique_attribute_request( + type_name=type_name, + attr=attr, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def set_labels_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, + type_name: str, + body: List[str], + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Set labels to a given entity identified by its type and unique attributes. + + If + labels is null/empty, existing labels will all be removed. + + In addition to the + typeName path parameter, attribute key-value pair(s) can be provided in the + following format: attr::code:``=:code:``. + + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: POST + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param body: set of labels to be set. Required. + :type body: list[str] + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set_labels_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, + type_name: str, + body: IO, + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Set labels to a given entity identified by its type and unique attributes. + + If + labels is null/empty, existing labels will all be removed. + + In addition to the + typeName path parameter, attribute key-value pair(s) can be provided in the + following format: attr::code:``=:code:``. + + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: POST + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param body: set of labels to be set. Required. + :type body: IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def set_labels_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, type_name: str, body: Union[List[str], IO], *, attr: Optional[str] = None, **kwargs: Any + ) -> None: + """Set labels to a given entity identified by its type and unique attributes. + + If + labels is null/empty, existing labels will all be removed. + + In addition to the + typeName path parameter, attribute key-value pair(s) can be provided in the + following format: attr::code:``=:code:``. + + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: POST + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param body: set of labels to be set. Is either a [str] type or a IO type. Required. + :type body: list[str] or IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_set_labels_by_unique_attribute_request( + type_name=type_name, + attr=attr, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def add_labels_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, + type_name: str, + body: List[str], + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Add given labels to a given entity identified by its type and unique + attributes. + + If labels is null/empty, no labels will be added. + + In addition to + the typeName path parameter, attribute key-value pair(s) can be provided in the + following format: attr::code:``=:code:``. + + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: PUT + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param body: set of labels to be added. Required. + :type body: list[str] + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def add_labels_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, + type_name: str, + body: IO, + *, + attr: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Add given labels to a given entity identified by its type and unique + attributes. + + If labels is null/empty, no labels will be added. + + In addition to + the typeName path parameter, attribute key-value pair(s) can be provided in the + following format: attr::code:``=:code:``. + + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: PUT + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param body: set of labels to be added. Required. + :type body: IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def add_labels_by_unique_attribute( # pylint: disable=inconsistent-return-statements + self, type_name: str, body: Union[List[str], IO], *, attr: Optional[str] = None, **kwargs: Any + ) -> None: + """Add given labels to a given entity identified by its type and unique + attributes. + + If labels is null/empty, no labels will be added. + + In addition to + the typeName path parameter, attribute key-value pair(s) can be provided in the + following format: attr::code:``=:code:``. + + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: PUT + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :param body: set of labels to be added. Is either a [str] type or a IO type. Required. + :type body: list[str] or IO + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_add_labels_by_unique_attribute_request( + type_name=type_name, + attr=attr, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def move_entities_to_collection( + self, + move_entities_request: _models.MoveEntitiesRequest, + *, + collection_id: str, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EntityMutationResponse: + """Move existing entities to the target collection. + + :param move_entities_request: Entity guids to be moved to target collection. Required. + :type move_entities_request: ~azure.analytics.purview.datamap.models.MoveEntitiesRequest + :keyword collection_id: The collection where entities will be moved to. Required. + :paramtype collection_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def move_entities_to_collection( + self, move_entities_request: JSON, *, collection_id: str, content_type: str = "application/json", **kwargs: Any + ) -> _models.EntityMutationResponse: + """Move existing entities to the target collection. + + :param move_entities_request: Entity guids to be moved to target collection. Required. + :type move_entities_request: JSON + :keyword collection_id: The collection where entities will be moved to. Required. + :paramtype collection_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def move_entities_to_collection( + self, move_entities_request: IO, *, collection_id: str, content_type: str = "application/json", **kwargs: Any + ) -> _models.EntityMutationResponse: + """Move existing entities to the target collection. + + :param move_entities_request: Entity guids to be moved to target collection. Required. + :type move_entities_request: IO + :keyword collection_id: The collection where entities will be moved to. Required. + :paramtype collection_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def move_entities_to_collection( + self, move_entities_request: Union[_models.MoveEntitiesRequest, JSON, IO], *, collection_id: str, **kwargs: Any + ) -> _models.EntityMutationResponse: + """Move existing entities to the target collection. + + :param move_entities_request: Entity guids to be moved to target collection. Is one of the + following types: MoveEntitiesRequest, JSON, IO Required. + :type move_entities_request: ~azure.analytics.purview.datamap.models.MoveEntitiesRequest or + JSON or IO + :keyword collection_id: The collection where entities will be moved to. Required. + :paramtype collection_id: str + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: EntityMutationResponse. The EntityMutationResponse is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.EntityMutationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EntityMutationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(move_entities_request, (IOBase, bytes)): + _content = move_entities_request + else: + _content = json.dumps(move_entities_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_entity_move_entities_to_collection_request( + collection_id=collection_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.EntityMutationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class GlossaryClientOperationsMixin(GlossaryClientMixinABC): # pylint: disable=too-many-public-methods + @distributed_trace_async + async def list( + self, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + ignore_terms_and_categories: Optional[bool] = None, + **kwargs: Any + ) -> List[_models.AtlasGlossary]: + """Get all glossaries. Recommend using limit/offset to get pagination result. + Recommend using 'ignoreTermsAndCategories=true' and fetch terms/categories + separately using + + 'GET /datamap/api/atlas/v2/glossary/{glossaryGuid}/terms' + and + + 'GET '/datamap/api/atlas/v2/glossary/{glossaryGuid}/categories'. + + :keyword limit: The page size - by default there is no paging. Default value is None. + :paramtype limit: int + :keyword offset: The offset for pagination purpose. Default value is None. + :paramtype offset: int + :keyword sort: The sort order, ASC (default) or DESC. Default value is None. + :paramtype sort: str + :keyword ignore_terms_and_categories: Whether ignore terms and categories. Default value is + None. + :paramtype ignore_terms_and_categories: bool + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasGlossary + :rtype: list[~azure.analytics.purview.datamap.models.AtlasGlossary] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AtlasGlossary]] = kwargs.pop("cls", None) + + _request = build_glossary_list_request( + limit=limit, + offset=offset, + sort=sort, + ignore_terms_and_categories=ignore_terms_and_categories, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.AtlasGlossary], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, atlas_glossary: _models.AtlasGlossary, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasGlossary: + """Create a glossary. + + :param atlas_glossary: Glossary definition, terms & categories can be anchored to a glossary. + Using + the anchor attribute when creating the Term/Category. Required. + :type atlas_glossary: ~azure.analytics.purview.datamap.models.AtlasGlossary + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossary. The AtlasGlossary is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossary + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, atlas_glossary: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasGlossary: + """Create a glossary. + + :param atlas_glossary: Glossary definition, terms & categories can be anchored to a glossary. + Using + the anchor attribute when creating the Term/Category. Required. + :type atlas_glossary: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossary. The AtlasGlossary is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossary + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, atlas_glossary: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasGlossary: + """Create a glossary. + + :param atlas_glossary: Glossary definition, terms & categories can be anchored to a glossary. + Using + the anchor attribute when creating the Term/Category. Required. + :type atlas_glossary: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossary. The AtlasGlossary is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossary + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, atlas_glossary: Union[_models.AtlasGlossary, JSON, IO], **kwargs: Any + ) -> _models.AtlasGlossary: + """Create a glossary. + + :param atlas_glossary: Glossary definition, terms & categories can be anchored to a glossary. + Using + the anchor attribute when creating the Term/Category. Is one of the following types: + AtlasGlossary, JSON, IO Required. + :type atlas_glossary: ~azure.analytics.purview.datamap.models.AtlasGlossary or JSON or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossary. The AtlasGlossary is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossary + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AtlasGlossary] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(atlas_glossary, (IOBase, bytes)): + _content = atlas_glossary + else: + _content = json.dumps(atlas_glossary, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_create_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossary, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_categories( + self, + glossary_category: List[_models.AtlasGlossaryCategory], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.AtlasGlossaryCategory]: + """Create glossary category in bulk. + + :param glossary_category: An array of glossary category definitions to be created. Required. + :type glossary_category: list[~azure.analytics.purview.datamap.models.AtlasGlossaryCategory] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasGlossaryCategory + :rtype: list[~azure.analytics.purview.datamap.models.AtlasGlossaryCategory] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_categories( + self, glossary_category: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> List[_models.AtlasGlossaryCategory]: + """Create glossary category in bulk. + + :param glossary_category: An array of glossary category definitions to be created. Required. + :type glossary_category: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasGlossaryCategory + :rtype: list[~azure.analytics.purview.datamap.models.AtlasGlossaryCategory] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_categories( + self, glossary_category: Union[List[_models.AtlasGlossaryCategory], IO], **kwargs: Any + ) -> List[_models.AtlasGlossaryCategory]: + """Create glossary category in bulk. + + :param glossary_category: An array of glossary category definitions to be created. Is either a + [AtlasGlossaryCategory] type or a IO type. Required. + :type glossary_category: list[~azure.analytics.purview.datamap.models.AtlasGlossaryCategory] or + IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasGlossaryCategory + :rtype: list[~azure.analytics.purview.datamap.models.AtlasGlossaryCategory] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[List[_models.AtlasGlossaryCategory]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(glossary_category, (IOBase, bytes)): + _content = glossary_category + else: + _content = json.dumps(glossary_category, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_create_categories_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.AtlasGlossaryCategory], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_category( + self, glossary_category: _models.AtlasGlossaryCategory, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasGlossaryCategory: + """Create a glossary category. + + :param glossary_category: The glossary category definition. A category must be anchored to a + Glossary + when creating. + Optionally, terms belonging to the category and the hierarchy + can also be defined during creation. Required. + :type glossary_category: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryCategory. The AtlasGlossaryCategory is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_category( + self, glossary_category: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasGlossaryCategory: + """Create a glossary category. + + :param glossary_category: The glossary category definition. A category must be anchored to a + Glossary + when creating. + Optionally, terms belonging to the category and the hierarchy + can also be defined during creation. Required. + :type glossary_category: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryCategory. The AtlasGlossaryCategory is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_category( + self, glossary_category: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasGlossaryCategory: + """Create a glossary category. + + :param glossary_category: The glossary category definition. A category must be anchored to a + Glossary + when creating. + Optionally, terms belonging to the category and the hierarchy + can also be defined during creation. Required. + :type glossary_category: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryCategory. The AtlasGlossaryCategory is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_category( + self, glossary_category: Union[_models.AtlasGlossaryCategory, JSON, IO], **kwargs: Any + ) -> _models.AtlasGlossaryCategory: + """Create a glossary category. + + :param glossary_category: The glossary category definition. A category must be anchored to a + Glossary + when creating. + Optionally, terms belonging to the category and the hierarchy + can also be defined during creation. Is one of the following types: AtlasGlossaryCategory, + JSON, IO Required. + :type glossary_category: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory or JSON + or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryCategory. The AtlasGlossaryCategory is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AtlasGlossaryCategory] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(glossary_category, (IOBase, bytes)): + _content = glossary_category + else: + _content = json.dumps(glossary_category, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_create_category_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossaryCategory, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_category(self, category_guid: str, **kwargs: Any) -> _models.AtlasGlossaryCategory: + """Get specific glossary category by its GUID. + + :param category_guid: The globally unique identifier of the category. Required. + :type category_guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryCategory. The AtlasGlossaryCategory is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasGlossaryCategory] = kwargs.pop("cls", None) + + _request = build_glossary_get_category_request( + category_guid=category_guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossaryCategory, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update_category( + self, + category_guid: str, + glossary_category: _models.AtlasGlossaryCategory, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AtlasGlossaryCategory: + """Update the given glossary category by its GUID. + + :param category_guid: The globally unique identifier of the category. Required. + :type category_guid: str + :param glossary_category: The glossary category to be updated. Required. + :type glossary_category: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryCategory. The AtlasGlossaryCategory is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_category( + self, category_guid: str, glossary_category: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasGlossaryCategory: + """Update the given glossary category by its GUID. + + :param category_guid: The globally unique identifier of the category. Required. + :type category_guid: str + :param glossary_category: The glossary category to be updated. Required. + :type glossary_category: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryCategory. The AtlasGlossaryCategory is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_category( + self, category_guid: str, glossary_category: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasGlossaryCategory: + """Update the given glossary category by its GUID. + + :param category_guid: The globally unique identifier of the category. Required. + :type category_guid: str + :param glossary_category: The glossary category to be updated. Required. + :type glossary_category: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryCategory. The AtlasGlossaryCategory is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_category( + self, category_guid: str, glossary_category: Union[_models.AtlasGlossaryCategory, JSON, IO], **kwargs: Any + ) -> _models.AtlasGlossaryCategory: + """Update the given glossary category by its GUID. + + :param category_guid: The globally unique identifier of the category. Required. + :type category_guid: str + :param glossary_category: The glossary category to be updated. Is one of the following types: + AtlasGlossaryCategory, JSON, IO Required. + :type glossary_category: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory or JSON + or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryCategory. The AtlasGlossaryCategory is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AtlasGlossaryCategory] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(glossary_category, (IOBase, bytes)): + _content = glossary_category + else: + _content = json.dumps(glossary_category, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_update_category_request( + category_guid=category_guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossaryCategory, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete_category( # pylint: disable=inconsistent-return-statements + self, category_guid: str, **kwargs: Any + ) -> None: + """Delete a glossary category. + + :param category_guid: The globally unique identifier of the category. Required. + :type category_guid: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_glossary_delete_category_request( + category_guid=category_guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def partial_update_category( + self, category_guid: str, partial_updates: Any, **kwargs: Any + ) -> _models.AtlasGlossaryCategory: + """Update the glossary category partially. So far we only supports partial + updating shortDescription and longDescription for category. + + :param category_guid: The globally unique identifier of the category. Required. + :type category_guid: str + :param partial_updates: A map containing keys as attribute names and values as corresponding + attribute + values for partial update. Required. + :type partial_updates: any + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryCategory. The AtlasGlossaryCategory is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.AtlasGlossaryCategory] = kwargs.pop("cls", None) + + _content = json.dumps(partial_updates, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_partial_update_category_request( + category_guid=category_guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossaryCategory, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_related_categories( + self, + category_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any + ) -> Dict[str, List[_models.AtlasRelatedCategoryHeader]]: + """Get all related categories (parent and children). Limit, offset, and sort + parameters are currently not being enabled and won't work even they are passed. + + :param category_guid: The globally unique identifier of the category. Required. + :type category_guid: str + :keyword limit: The page size - by default there is no paging. Default value is None. + :paramtype limit: int + :keyword offset: The offset for pagination purpose. Default value is None. + :paramtype offset: int + :keyword sort: The sort order, ASC (default) or DESC. Default value is None. + :paramtype sort: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: dict mapping str to list of AtlasRelatedCategoryHeader + :rtype: dict[str, list[~azure.analytics.purview.datamap.models.AtlasRelatedCategoryHeader]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Dict[str, List[_models.AtlasRelatedCategoryHeader]]] = kwargs.pop("cls", None) + + _request = build_glossary_list_related_categories_request( + category_guid=category_guid, + limit=limit, + offset=offset, + sort=sort, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(Dict[str, List[_models.AtlasRelatedCategoryHeader]], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_category_terms( + self, + category_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any + ) -> List[_models.AtlasRelatedTermHeader]: + """Get all terms associated with the specific category. + + :param category_guid: The globally unique identifier of the category. Required. + :type category_guid: str + :keyword limit: The page size - by default there is no paging. Default value is None. + :paramtype limit: int + :keyword offset: The offset for pagination purpose. Default value is None. + :paramtype offset: int + :keyword sort: The sort order, ASC (default) or DESC. Default value is None. + :paramtype sort: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasRelatedTermHeader + :rtype: list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AtlasRelatedTermHeader]] = kwargs.pop("cls", None) + + _request = build_glossary_list_category_terms_request( + category_guid=category_guid, + limit=limit, + offset=offset, + sort=sort, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.AtlasRelatedTermHeader], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_term( + self, + glossary_term: _models.AtlasGlossaryTerm, + *, + include_term_hierarchy: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AtlasGlossaryTerm: + """Create a glossary term. + + :param glossary_term: The glossary term definition. A term must be anchored to a Glossary at + the time + of creation. + Optionally it can be categorized as well. Required. + :type glossary_term: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryTerm. The AtlasGlossaryTerm is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_term( + self, + glossary_term: JSON, + *, + include_term_hierarchy: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AtlasGlossaryTerm: + """Create a glossary term. + + :param glossary_term: The glossary term definition. A term must be anchored to a Glossary at + the time + of creation. + Optionally it can be categorized as well. Required. + :type glossary_term: JSON + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryTerm. The AtlasGlossaryTerm is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_term( + self, + glossary_term: IO, + *, + include_term_hierarchy: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AtlasGlossaryTerm: + """Create a glossary term. + + :param glossary_term: The glossary term definition. A term must be anchored to a Glossary at + the time + of creation. + Optionally it can be categorized as well. Required. + :type glossary_term: IO + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryTerm. The AtlasGlossaryTerm is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_term( + self, + glossary_term: Union[_models.AtlasGlossaryTerm, JSON, IO], + *, + include_term_hierarchy: Optional[bool] = None, + **kwargs: Any + ) -> _models.AtlasGlossaryTerm: + """Create a glossary term. + + :param glossary_term: The glossary term definition. A term must be anchored to a Glossary at + the time + of creation. + Optionally it can be categorized as well. Is one of the following types: AtlasGlossaryTerm, + JSON, IO Required. + :type glossary_term: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm or JSON or IO + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryTerm. The AtlasGlossaryTerm is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AtlasGlossaryTerm] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(glossary_term, (IOBase, bytes)): + _content = glossary_term + else: + _content = json.dumps(glossary_term, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_create_term_request( + include_term_hierarchy=include_term_hierarchy, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossaryTerm, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_term(self, term_guid: str, **kwargs: Any) -> _models.AtlasGlossaryTerm: + """Get a specific glossary term by its GUID. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryTerm. The AtlasGlossaryTerm is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasGlossaryTerm] = kwargs.pop("cls", None) + + _request = build_glossary_get_term_request( + term_guid=term_guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossaryTerm, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update_term( + self, + term_guid: str, + glossary_term: _models.AtlasGlossaryTerm, + *, + include_term_hierarchy: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AtlasGlossaryTerm: + """Update the given glossary term by its GUID. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param glossary_term: The glossary term to be updated. Required. + :type glossary_term: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryTerm. The AtlasGlossaryTerm is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_term( + self, + term_guid: str, + glossary_term: JSON, + *, + include_term_hierarchy: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AtlasGlossaryTerm: + """Update the given glossary term by its GUID. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param glossary_term: The glossary term to be updated. Required. + :type glossary_term: JSON + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryTerm. The AtlasGlossaryTerm is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_term( + self, + term_guid: str, + glossary_term: IO, + *, + include_term_hierarchy: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AtlasGlossaryTerm: + """Update the given glossary term by its GUID. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param glossary_term: The glossary term to be updated. Required. + :type glossary_term: IO + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryTerm. The AtlasGlossaryTerm is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_term( + self, + term_guid: str, + glossary_term: Union[_models.AtlasGlossaryTerm, JSON, IO], + *, + include_term_hierarchy: Optional[bool] = None, + **kwargs: Any + ) -> _models.AtlasGlossaryTerm: + """Update the given glossary term by its GUID. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param glossary_term: The glossary term to be updated. Is one of the following types: + AtlasGlossaryTerm, JSON, IO Required. + :type glossary_term: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm or JSON or IO + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryTerm. The AtlasGlossaryTerm is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AtlasGlossaryTerm] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(glossary_term, (IOBase, bytes)): + _content = glossary_term + else: + _content = json.dumps(glossary_term, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_update_term_request( + term_guid=term_guid, + include_term_hierarchy=include_term_hierarchy, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossaryTerm, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete_term( # pylint: disable=inconsistent-return-statements + self, term_guid: str, **kwargs: Any + ) -> None: + """Delete a glossary term. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_glossary_delete_term_request( + term_guid=term_guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def partial_update_term( + self, term_guid: str, partial_updates: Any, *, include_term_hierarchy: Optional[bool] = None, **kwargs: Any + ) -> _models.AtlasGlossaryTerm: + """Update the glossary term partially. So far we only supports partial updating + shortDescription, longDescription, abbreviation, usage and status for term. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param partial_updates: A map containing keys as attribute names and values as corresponding + attribute + values to be updated. Required. + :type partial_updates: any + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryTerm. The AtlasGlossaryTerm is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.AtlasGlossaryTerm] = kwargs.pop("cls", None) + + _content = json.dumps(partial_updates, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_partial_update_term_request( + term_guid=term_guid, + include_term_hierarchy=include_term_hierarchy, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossaryTerm, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_terms( + self, + glossary_term: List[_models.AtlasGlossaryTerm], + *, + include_term_hierarchy: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.AtlasGlossaryTerm]: + """Create glossary terms in bulk. + + :param glossary_term: An array of glossary term definitions to be created in bulk. Required. + :type glossary_term: list[~azure.analytics.purview.datamap.models.AtlasGlossaryTerm] + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasGlossaryTerm + :rtype: list[~azure.analytics.purview.datamap.models.AtlasGlossaryTerm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_terms( + self, + glossary_term: IO, + *, + include_term_hierarchy: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.AtlasGlossaryTerm]: + """Create glossary terms in bulk. + + :param glossary_term: An array of glossary term definitions to be created in bulk. Required. + :type glossary_term: IO + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasGlossaryTerm + :rtype: list[~azure.analytics.purview.datamap.models.AtlasGlossaryTerm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_terms( + self, + glossary_term: Union[List[_models.AtlasGlossaryTerm], IO], + *, + include_term_hierarchy: Optional[bool] = None, + **kwargs: Any + ) -> List[_models.AtlasGlossaryTerm]: + """Create glossary terms in bulk. + + :param glossary_term: An array of glossary term definitions to be created in bulk. Is either a + [AtlasGlossaryTerm] type or a IO type. Required. + :type glossary_term: list[~azure.analytics.purview.datamap.models.AtlasGlossaryTerm] or IO + :keyword include_term_hierarchy: Whether include term hierarchy. Default value is None. + :paramtype include_term_hierarchy: bool + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasGlossaryTerm + :rtype: list[~azure.analytics.purview.datamap.models.AtlasGlossaryTerm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[List[_models.AtlasGlossaryTerm]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(glossary_term, (IOBase, bytes)): + _content = glossary_term + else: + _content = json.dumps(glossary_term, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_create_terms_request( + include_term_hierarchy=include_term_hierarchy, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.AtlasGlossaryTerm], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_entities_assigned_with_term( + self, + term_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any + ) -> List[_models.AtlasRelatedObjectId]: + """List all related objects assigned with the specified term. Recommend using + limit/offset to get pagination result. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :keyword limit: The page size - by default there is no paging. Default value is None. + :paramtype limit: int + :keyword offset: The offset for pagination purpose. Default value is None. + :paramtype offset: int + :keyword sort: The sort order, ASC (default) or DESC. Default value is None. + :paramtype sort: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasRelatedObjectId + :rtype: list[~azure.analytics.purview.datamap.models.AtlasRelatedObjectId] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AtlasRelatedObjectId]] = kwargs.pop("cls", None) + + _request = build_glossary_list_entities_assigned_with_term_request( + term_guid=term_guid, + limit=limit, + offset=offset, + sort=sort, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.AtlasRelatedObjectId], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def assign_term_to_entities( # pylint: disable=inconsistent-return-statements + self, + term_guid: str, + related_object_ids: List[_models.AtlasRelatedObjectId], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Assign the given term to the provided list of related objects. Recommend using + small batches with multiple API calls. + + `Entities Create Or Update + operation + `_ + is an alternative to assign a term to multiple entities. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param related_object_ids: An array of related object IDs to which the term has to be + associated. Required. + :type related_object_ids: list[~azure.analytics.purview.datamap.models.AtlasRelatedObjectId] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def assign_term_to_entities( # pylint: disable=inconsistent-return-statements + self, term_guid: str, related_object_ids: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Assign the given term to the provided list of related objects. Recommend using + small batches with multiple API calls. + + `Entities Create Or Update + operation + `_ + is an alternative to assign a term to multiple entities. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param related_object_ids: An array of related object IDs to which the term has to be + associated. Required. + :type related_object_ids: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def assign_term_to_entities( # pylint: disable=inconsistent-return-statements + self, term_guid: str, related_object_ids: Union[List[_models.AtlasRelatedObjectId], IO], **kwargs: Any + ) -> None: + """Assign the given term to the provided list of related objects. Recommend using + small batches with multiple API calls. + + `Entities Create Or Update + operation + `_ + is an alternative to assign a term to multiple entities. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param related_object_ids: An array of related object IDs to which the term has to be + associated. Is either a [AtlasRelatedObjectId] type or a IO type. Required. + :type related_object_ids: list[~azure.analytics.purview.datamap.models.AtlasRelatedObjectId] or + IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(related_object_ids, (IOBase, bytes)): + _content = related_object_ids + else: + _content = json.dumps(related_object_ids, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_assign_term_to_entities_request( + term_guid=term_guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def delete_term_assignment_from_entities( # pylint: disable=inconsistent-return-statements + self, + term_guid: str, + related_object_ids: List[_models.AtlasRelatedObjectId], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Delete the term assignment for the given list of related objects. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param related_object_ids: An array of related object IDs from which the term has to be + dissociated. Required. + :type related_object_ids: list[~azure.analytics.purview.datamap.models.AtlasRelatedObjectId] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def delete_term_assignment_from_entities( # pylint: disable=inconsistent-return-statements + self, term_guid: str, related_object_ids: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Delete the term assignment for the given list of related objects. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param related_object_ids: An array of related object IDs from which the term has to be + dissociated. Required. + :type related_object_ids: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def delete_term_assignment_from_entities( # pylint: disable=inconsistent-return-statements + self, term_guid: str, related_object_ids: Union[List[_models.AtlasRelatedObjectId], IO], **kwargs: Any + ) -> None: + """Delete the term assignment for the given list of related objects. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :param related_object_ids: An array of related object IDs from which the term has to be + dissociated. Is either a [AtlasRelatedObjectId] type or a IO type. Required. + :type related_object_ids: list[~azure.analytics.purview.datamap.models.AtlasRelatedObjectId] or + IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(related_object_ids, (IOBase, bytes)): + _content = related_object_ids + else: + _content = json.dumps(related_object_ids, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_delete_term_assignment_from_entities_request( + term_guid=term_guid, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def list_related_terms( + self, + term_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any + ) -> Dict[str, List[_models.AtlasRelatedTermHeader]]: + """Get all related terms for a specific term by its GUID. Limit, offset, and sort + parameters are currently not being enabled and won't work even they are passed. + + :param term_guid: The globally unique identifier for glossary term. Required. + :type term_guid: str + :keyword limit: The page size - by default there is no paging. Default value is None. + :paramtype limit: int + :keyword offset: The offset for pagination purpose. Default value is None. + :paramtype offset: int + :keyword sort: The sort order, ASC (default) or DESC. Default value is None. + :paramtype sort: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: dict mapping str to list of AtlasRelatedTermHeader + :rtype: dict[str, list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Dict[str, List[_models.AtlasRelatedTermHeader]]] = kwargs.pop("cls", None) + + _request = build_glossary_list_related_terms_request( + term_guid=term_guid, + limit=limit, + offset=offset, + sort=sort, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(Dict[str, List[_models.AtlasRelatedTermHeader]], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get(self, glossary_guid: str, **kwargs: Any) -> _models.AtlasGlossary: + """Get a specific Glossary by its GUID. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossary. The AtlasGlossary is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossary + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasGlossary] = kwargs.pop("cls", None) + + _request = build_glossary_get_request( + glossary_guid=glossary_guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossary, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + glossary_guid: str, + updated_glossary: _models.AtlasGlossary, + *, + ignore_terms_and_categories: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AtlasGlossary: + """Update the given glossary. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :param updated_glossary: The glossary definition to be updated. Required. + :type updated_glossary: ~azure.analytics.purview.datamap.models.AtlasGlossary + :keyword ignore_terms_and_categories: Whether ignore terms and categories. Default value is + None. + :paramtype ignore_terms_and_categories: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossary. The AtlasGlossary is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossary + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + glossary_guid: str, + updated_glossary: JSON, + *, + ignore_terms_and_categories: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AtlasGlossary: + """Update the given glossary. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :param updated_glossary: The glossary definition to be updated. Required. + :type updated_glossary: JSON + :keyword ignore_terms_and_categories: Whether ignore terms and categories. Default value is + None. + :paramtype ignore_terms_and_categories: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossary. The AtlasGlossary is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossary + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + glossary_guid: str, + updated_glossary: IO, + *, + ignore_terms_and_categories: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AtlasGlossary: + """Update the given glossary. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :param updated_glossary: The glossary definition to be updated. Required. + :type updated_glossary: IO + :keyword ignore_terms_and_categories: Whether ignore terms and categories. Default value is + None. + :paramtype ignore_terms_and_categories: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossary. The AtlasGlossary is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossary + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + glossary_guid: str, + updated_glossary: Union[_models.AtlasGlossary, JSON, IO], + *, + ignore_terms_and_categories: Optional[bool] = None, + **kwargs: Any + ) -> _models.AtlasGlossary: + """Update the given glossary. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :param updated_glossary: The glossary definition to be updated. Is one of the following types: + AtlasGlossary, JSON, IO Required. + :type updated_glossary: ~azure.analytics.purview.datamap.models.AtlasGlossary or JSON or IO + :keyword ignore_terms_and_categories: Whether ignore terms and categories. Default value is + None. + :paramtype ignore_terms_and_categories: bool + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossary. The AtlasGlossary is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossary + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AtlasGlossary] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(updated_glossary, (IOBase, bytes)): + _content = updated_glossary + else: + _content = json.dumps(updated_glossary, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_update_request( + glossary_guid=glossary_guid, + ignore_terms_and_categories=ignore_terms_and_categories, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossary, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, glossary_guid: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Delete a glossary. Will delete underlying terms/categories together. Recommend + separate delete terms and categories. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_glossary_delete_request( + glossary_guid=glossary_guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def list_categories( + self, + glossary_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any + ) -> List[_models.AtlasGlossaryCategory]: + """Get the categories belonging to a specific glossary. Recommend using + limit/offset to get pagination result. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :keyword limit: The page size - by default there is no paging. Default value is None. + :paramtype limit: int + :keyword offset: The offset for pagination purpose. Default value is None. + :paramtype offset: int + :keyword sort: The sort order, ASC (default) or DESC. Default value is None. + :paramtype sort: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasGlossaryCategory + :rtype: list[~azure.analytics.purview.datamap.models.AtlasGlossaryCategory] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AtlasGlossaryCategory]] = kwargs.pop("cls", None) + + _request = build_glossary_list_categories_request( + glossary_guid=glossary_guid, + limit=limit, + offset=offset, + sort=sort, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.AtlasGlossaryCategory], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_categories_headers( + self, + glossary_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any + ) -> List[_models.AtlasRelatedCategoryHeader]: + """Get the category headers belonging to a specific glossary. Recommend using + limit/offset to get pagination result. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :keyword limit: The page size - by default there is no paging. Default value is None. + :paramtype limit: int + :keyword offset: The offset for pagination purpose. Default value is None. + :paramtype offset: int + :keyword sort: The sort order, ASC (default) or DESC. Default value is None. + :paramtype sort: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasRelatedCategoryHeader + :rtype: list[~azure.analytics.purview.datamap.models.AtlasRelatedCategoryHeader] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AtlasRelatedCategoryHeader]] = kwargs.pop("cls", None) + + _request = build_glossary_list_categories_headers_request( + glossary_guid=glossary_guid, + limit=limit, + offset=offset, + sort=sort, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.AtlasRelatedCategoryHeader], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_detailed(self, glossary_guid: str, **kwargs: Any) -> _models.AtlasGlossaryExtInfo: + """Get a specific glossary with detailed information. This API is not + recommend. + + Recommend to fetch terms/categories details separately using + + GET /datamap/api/atlas/v2/glossary/{glossaryGuid}/terms and + + GET /datamap/api/atlas/v2/glossary/{glossaryGuid}/categories. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossaryExtInfo. The AtlasGlossaryExtInfo is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossaryExtInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasGlossaryExtInfo] = kwargs.pop("cls", None) + + _request = build_glossary_get_detailed_request( + glossary_guid=glossary_guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossaryExtInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def partial_update( + self, + glossary_guid: str, + partial_updates: Any, + *, + ignore_terms_and_categories: Optional[bool] = None, + **kwargs: Any + ) -> _models.AtlasGlossary: + """Update the glossary partially. Some properties such as qualifiedName are not + allowed to be updated. + + So far we only supports partial updating + shortDescription, longDescription, language and usage for glossary. + + Recommend + using 'ignoreTermsAndCategories=true' to reduce response body size. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :param partial_updates: A map containing keys as attribute names and values as corresponding + attribute + values. Required. + :type partial_updates: any + :keyword ignore_terms_and_categories: Whether ignore terms and categories. Default value is + None. + :paramtype ignore_terms_and_categories: bool + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasGlossary. The AtlasGlossary is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasGlossary + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.AtlasGlossary] = kwargs.pop("cls", None) + + _content = json.dumps(partial_updates, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_glossary_partial_update_request( + glossary_guid=glossary_guid, + ignore_terms_and_categories=ignore_terms_and_categories, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasGlossary, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_terms( + self, + glossary_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any + ) -> List[_models.AtlasGlossaryTerm]: + """Get terms belonging to a specific glossary. Recommend using limit/offset to get + pagination result. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :keyword limit: The page size - by default there is no paging. Default value is None. + :paramtype limit: int + :keyword offset: The offset for pagination purpose. Default value is None. + :paramtype offset: int + :keyword sort: The sort order, ASC (default) or DESC. Default value is None. + :paramtype sort: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasGlossaryTerm + :rtype: list[~azure.analytics.purview.datamap.models.AtlasGlossaryTerm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AtlasGlossaryTerm]] = kwargs.pop("cls", None) + + _request = build_glossary_list_terms_request( + glossary_guid=glossary_guid, + limit=limit, + offset=offset, + sort=sort, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.AtlasGlossaryTerm], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_term_headers( + self, + glossary_guid: str, + *, + limit: Optional[int] = None, + offset: Optional[int] = None, + sort: Optional[str] = None, + **kwargs: Any + ) -> List[_models.AtlasRelatedTermHeader]: + """Get term headers belonging to a specific glossary. Recommend using limit/offset + to get pagination result. + + :param glossary_guid: The globally unique identifier for glossary. Required. + :type glossary_guid: str + :keyword limit: The page size - by default there is no paging. Default value is None. + :paramtype limit: int + :keyword offset: The offset for pagination purpose. Default value is None. + :paramtype offset: int + :keyword sort: The sort order, ASC (default) or DESC. Default value is None. + :paramtype sort: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasRelatedTermHeader + :rtype: list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AtlasRelatedTermHeader]] = kwargs.pop("cls", None) + + _request = build_glossary_list_term_headers_request( + glossary_guid=glossary_guid, + limit=limit, + offset=offset, + sort=sort, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.AtlasRelatedTermHeader], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class DiscoveryClientOperationsMixin(DiscoveryClientMixinABC): + @overload + async def query( + self, search_request: _models.SearchRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SearchResult: + """Get data using search. + + :param search_request: An object specifying the search criteria. Required. + :type search_request: ~azure.analytics.purview.datamap.models.SearchRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: SearchResult. The SearchResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.SearchResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def query( + self, search_request: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SearchResult: + """Get data using search. + + :param search_request: An object specifying the search criteria. Required. + :type search_request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: SearchResult. The SearchResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.SearchResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def query( + self, search_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SearchResult: + """Get data using search. + + :param search_request: An object specifying the search criteria. Required. + :type search_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: SearchResult. The SearchResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.SearchResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def query( + self, search_request: Union[_models.SearchRequest, JSON, IO], **kwargs: Any + ) -> _models.SearchResult: + """Get data using search. + + :param search_request: An object specifying the search criteria. Is one of the following types: + SearchRequest, JSON, IO Required. + :type search_request: ~azure.analytics.purview.datamap.models.SearchRequest or JSON or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: SearchResult. The SearchResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.SearchResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SearchResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(search_request, (IOBase, bytes)): + _content = search_request + else: + _content = json.dumps(search_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_discovery_query_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SearchResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def suggest( + self, suggest_request: _models.SuggestRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SuggestResult: + """Get search suggestions by query criteria. + + :param suggest_request: An object specifying the suggest criteria. Required. + :type suggest_request: ~azure.analytics.purview.datamap.models.SuggestRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: SuggestResult. The SuggestResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.SuggestResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def suggest( + self, suggest_request: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SuggestResult: + """Get search suggestions by query criteria. + + :param suggest_request: An object specifying the suggest criteria. Required. + :type suggest_request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: SuggestResult. The SuggestResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.SuggestResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def suggest( + self, suggest_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SuggestResult: + """Get search suggestions by query criteria. + + :param suggest_request: An object specifying the suggest criteria. Required. + :type suggest_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: SuggestResult. The SuggestResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.SuggestResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def suggest( + self, suggest_request: Union[_models.SuggestRequest, JSON, IO], **kwargs: Any + ) -> _models.SuggestResult: + """Get search suggestions by query criteria. + + :param suggest_request: An object specifying the suggest criteria. Is one of the following + types: SuggestRequest, JSON, IO Required. + :type suggest_request: ~azure.analytics.purview.datamap.models.SuggestRequest or JSON or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: SuggestResult. The SuggestResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.SuggestResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SuggestResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(suggest_request, (IOBase, bytes)): + _content = suggest_request + else: + _content = json.dumps(suggest_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_discovery_suggest_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SuggestResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def auto_complete( + self, + auto_complete_request: _models.AutoCompleteRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AutoCompleteResult: + """Get auto complete options. + + :param auto_complete_request: An object specifying the autocomplete criteria. Required. + :type auto_complete_request: ~azure.analytics.purview.datamap.models.AutoCompleteRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AutoCompleteResult. The AutoCompleteResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AutoCompleteResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def auto_complete( + self, auto_complete_request: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AutoCompleteResult: + """Get auto complete options. + + :param auto_complete_request: An object specifying the autocomplete criteria. Required. + :type auto_complete_request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AutoCompleteResult. The AutoCompleteResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AutoCompleteResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def auto_complete( + self, auto_complete_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AutoCompleteResult: + """Get auto complete options. + + :param auto_complete_request: An object specifying the autocomplete criteria. Required. + :type auto_complete_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AutoCompleteResult. The AutoCompleteResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AutoCompleteResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def auto_complete( + self, auto_complete_request: Union[_models.AutoCompleteRequest, JSON, IO], **kwargs: Any + ) -> _models.AutoCompleteResult: + """Get auto complete options. + + :param auto_complete_request: An object specifying the autocomplete criteria. Is one of the + following types: AutoCompleteRequest, JSON, IO Required. + :type auto_complete_request: ~azure.analytics.purview.datamap.models.AutoCompleteRequest or + JSON or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AutoCompleteResult. The AutoCompleteResult is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AutoCompleteResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutoCompleteResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(auto_complete_request, (IOBase, bytes)): + _content = auto_complete_request + else: + _content = json.dumps(auto_complete_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_discovery_auto_complete_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AutoCompleteResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class LineageClientOperationsMixin(LineageClientMixinABC): + @distributed_trace_async + async def get( + self, guid: str, *, direction: Union[str, _models.Direction], depth: Optional[int] = None, **kwargs: Any + ) -> _models.AtlasLineageInfo: + """Get lineage info of the entity specified by GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :keyword direction: The direction of the lineage, which could be INPUT, OUTPUT or BOTH. Known + values are: "BOTH", "INPUT", and "OUTPUT". Required. + :paramtype direction: str or ~azure.analytics.purview.datamap.models.Direction + :keyword depth: The number of hops for lineage. Default value is None. + :paramtype depth: int + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasLineageInfo. The AtlasLineageInfo is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasLineageInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasLineageInfo] = kwargs.pop("cls", None) + + _request = build_lineage_get_request( + guid=guid, + direction=direction, + depth=depth, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasLineageInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_next_page( + self, + guid: str, + *, + direction: Union[str, _models.Direction], + offset: Optional[int] = None, + limit: Optional[int] = None, + **kwargs: Any + ) -> _models.AtlasLineageInfo: + """Return immediate next page lineage info about entity with pagination. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :keyword direction: The direction of the lineage, which could be INPUT, OUTPUT or BOTH. Known + values are: "BOTH", "INPUT", and "OUTPUT". Required. + :paramtype direction: str or ~azure.analytics.purview.datamap.models.Direction + :keyword offset: The offset for pagination purpose. Default value is None. + :paramtype offset: int + :keyword limit: The page size - by default there is no paging. Default value is None. + :paramtype limit: int + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasLineageInfo. The AtlasLineageInfo is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasLineageInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasLineageInfo] = kwargs.pop("cls", None) + + _request = build_lineage_get_next_page_request( + guid=guid, + direction=direction, + offset=offset, + limit=limit, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasLineageInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_by_unique_attribute( + self, + type_name: str, + *, + direction: Union[str, _models.Direction], + depth: Optional[int] = None, + attr: Optional[str] = None, + **kwargs: Any + ) -> _models.AtlasLineageInfo: + """Return lineage info about entity. + + In addition to the typeName path parameter, + attribute key-value pair(s) can be provided in the following + format + + attr:[attrName]=[attrValue] + + NOTE: The attrName and attrValue should be + unique across entities, eg. qualifiedName. + + The REST request would look + something like this: + + GET + /v2/lineage/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + + :param type_name: The name of the type. Required. + :type type_name: str + :keyword direction: The direction of the lineage, which could be INPUT, OUTPUT or BOTH. Known + values are: "BOTH", "INPUT", and "OUTPUT". Required. + :paramtype direction: str or ~azure.analytics.purview.datamap.models.Direction + :keyword depth: The number of hops for lineage. Default value is None. + :paramtype depth: int + :keyword attr: The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes). Default value is None. + :paramtype attr: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasLineageInfo. The AtlasLineageInfo is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasLineageInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasLineageInfo] = kwargs.pop("cls", None) + + _request = build_lineage_get_by_unique_attribute_request( + type_name=type_name, + direction=direction, + depth=depth, + attr=attr, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasLineageInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class RelationshipClientOperationsMixin(RelationshipClientMixinABC): + @overload + async def create( + self, relationship: _models.AtlasRelationship, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasRelationship: + """Create a new relationship between entities. + + :param relationship: The AtlasRelationship object containing the information for the + relationship to + be created. Required. + :type relationship: ~azure.analytics.purview.datamap.models.AtlasRelationship + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationship. The AtlasRelationship is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationship + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, relationship: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasRelationship: + """Create a new relationship between entities. + + :param relationship: The AtlasRelationship object containing the information for the + relationship to + be created. Required. + :type relationship: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationship. The AtlasRelationship is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationship + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, relationship: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasRelationship: + """Create a new relationship between entities. + + :param relationship: The AtlasRelationship object containing the information for the + relationship to + be created. Required. + :type relationship: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationship. The AtlasRelationship is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationship + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, relationship: Union[_models.AtlasRelationship, JSON, IO], **kwargs: Any + ) -> _models.AtlasRelationship: + """Create a new relationship between entities. + + :param relationship: The AtlasRelationship object containing the information for the + relationship to + be created. Is one of the following types: AtlasRelationship, JSON, IO Required. + :type relationship: ~azure.analytics.purview.datamap.models.AtlasRelationship or JSON or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationship. The AtlasRelationship is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationship + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AtlasRelationship] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(relationship, (IOBase, bytes)): + _content = relationship + else: + _content = json.dumps(relationship, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_relationship_create_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasRelationship, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, relationship: _models.AtlasRelationship, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasRelationship: + """Update an existing relationship between entities. + + :param relationship: The AtlasRelationship object containing the information for the + relationship to + be created. Required. + :type relationship: ~azure.analytics.purview.datamap.models.AtlasRelationship + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationship. The AtlasRelationship is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationship + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, relationship: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasRelationship: + """Update an existing relationship between entities. + + :param relationship: The AtlasRelationship object containing the information for the + relationship to + be created. Required. + :type relationship: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationship. The AtlasRelationship is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationship + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, relationship: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasRelationship: + """Update an existing relationship between entities. + + :param relationship: The AtlasRelationship object containing the information for the + relationship to + be created. Required. + :type relationship: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationship. The AtlasRelationship is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationship + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, relationship: Union[_models.AtlasRelationship, JSON, IO], **kwargs: Any + ) -> _models.AtlasRelationship: + """Update an existing relationship between entities. + + :param relationship: The AtlasRelationship object containing the information for the + relationship to + be created. Is one of the following types: AtlasRelationship, JSON, IO Required. + :type relationship: ~azure.analytics.purview.datamap.models.AtlasRelationship or JSON or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationship. The AtlasRelationship is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationship + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AtlasRelationship] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(relationship, (IOBase, bytes)): + _content = relationship + else: + _content = json.dumps(relationship, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_relationship_update_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasRelationship, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get( + self, guid: str, *, extended_info: Optional[bool] = None, **kwargs: Any + ) -> _models.AtlasRelationshipWithExtInfo: + """Get relationship information between entities by its GUID. + + :param guid: The globally unique identifier of the relationship. Required. + :type guid: str + :keyword extended_info: Limits whether includes extended information. Default value is None. + :paramtype extended_info: bool + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationshipWithExtInfo. The AtlasRelationshipWithExtInfo is compatible with + MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationshipWithExtInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasRelationshipWithExtInfo] = kwargs.pop("cls", None) + + _request = build_relationship_get_request( + guid=guid, + extended_info=extended_info, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasRelationshipWithExtInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, guid: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Delete a relationship between entities by its GUID. + + :param guid: The globally unique identifier of the relationship. Required. + :type guid: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_relationship_delete_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class TypeClientOperationsMixin(TypeClientMixinABC): # pylint: disable=too-many-public-methods + @distributed_trace_async + async def get_business_metadata_def_by_guid(self, guid: str, **kwargs: Any) -> _models.AtlasBusinessMetadataDef: + """Get the businessMetadata definition for the given guid. + + :param guid: businessMetadata guid. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasBusinessMetadataDef. The AtlasBusinessMetadataDef is compatible with + MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasBusinessMetadataDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasBusinessMetadataDef] = kwargs.pop("cls", None) + + _request = build_type_get_business_metadata_def_by_guid_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasBusinessMetadataDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_business_metadata_def_by_name(self, name: str, **kwargs: Any) -> _models.AtlasBusinessMetadataDef: + """Get the businessMetadata definition by it's name (unique). + + :param name: businessMetadata name. Required. + :type name: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasBusinessMetadataDef. The AtlasBusinessMetadataDef is compatible with + MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasBusinessMetadataDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasBusinessMetadataDef] = kwargs.pop("cls", None) + + _request = build_type_get_business_metadata_def_by_name_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasBusinessMetadataDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_classification_def_by_guid(self, guid: str, **kwargs: Any) -> _models.AtlasClassificationDef: + """Get the classification definition for the given GUID. + + :param guid: The globally unique identifier of the classification. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasClassificationDef. The AtlasClassificationDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasClassificationDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasClassificationDef] = kwargs.pop("cls", None) + + _request = build_type_get_classification_def_by_guid_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasClassificationDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_classification_def_by_name(self, name: str, **kwargs: Any) -> _models.AtlasClassificationDef: + """Get the classification definition by its name (unique). + + :param name: The name of the classification. Required. + :type name: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasClassificationDef. The AtlasClassificationDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasClassificationDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasClassificationDef] = kwargs.pop("cls", None) + + _request = build_type_get_classification_def_by_name_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasClassificationDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_entity_def_by_guid(self, guid: str, **kwargs: Any) -> _models.AtlasEntityDef: + """Get the Entity definition for the given GUID. + + :param guid: The globally unique identifier of the entity. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasEntityDef. The AtlasEntityDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasEntityDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasEntityDef] = kwargs.pop("cls", None) + + _request = build_type_get_entity_def_by_guid_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasEntityDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_entity_def_by_name(self, name: str, **kwargs: Any) -> _models.AtlasEntityDef: + """Get the entity definition by its name (unique). + + :param name: The name of the entity. Required. + :type name: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasEntityDef. The AtlasEntityDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasEntityDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasEntityDef] = kwargs.pop("cls", None) + + _request = build_type_get_entity_def_by_name_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasEntityDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_enum_def_by_guid(self, guid: str, **kwargs: Any) -> _models.AtlasEnumDef: + """Get the enum definition for the given GUID. + + :param guid: The globally unique identifier of the enum. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasEnumDef. The AtlasEnumDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasEnumDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasEnumDef] = kwargs.pop("cls", None) + + _request = build_type_get_enum_def_by_guid_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasEnumDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_enum_def_by_name(self, name: str, **kwargs: Any) -> _models.AtlasEnumDef: + """Get the enum definition by its name (unique). + + :param name: The name of the enum. Required. + :type name: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasEnumDef. The AtlasEnumDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasEnumDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasEnumDef] = kwargs.pop("cls", None) + + _request = build_type_get_enum_def_by_name_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasEnumDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_relationship_def_by_guid(self, guid: str, **kwargs: Any) -> _models.AtlasRelationshipDef: + """Get the relationship definition for the given GUID. + + :param guid: The globally unique identifier of the relationship. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationshipDef. The AtlasRelationshipDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationshipDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasRelationshipDef] = kwargs.pop("cls", None) + + _request = build_type_get_relationship_def_by_guid_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasRelationshipDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_relationship_def_by_name(self, name: str, **kwargs: Any) -> _models.AtlasRelationshipDef: + """Get the relationship definition by its name (unique). + + :param name: The name of the relationship. Required. + :type name: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasRelationshipDef. The AtlasRelationshipDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasRelationshipDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasRelationshipDef] = kwargs.pop("cls", None) + + _request = build_type_get_relationship_def_by_name_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasRelationshipDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_struct_def_by_guid(self, guid: str, **kwargs: Any) -> _models.AtlasStructDef: + """Get the struct definition for the given GUID. + + :param guid: The globally unique identifier of the struct. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasStructDef. The AtlasStructDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasStructDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasStructDef] = kwargs.pop("cls", None) + + _request = build_type_get_struct_def_by_guid_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasStructDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_struct_def_by_name(self, name: str, **kwargs: Any) -> _models.AtlasStructDef: + """Get the struct definition by its name (unique). + + :param name: The name of the struct. Required. + :type name: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasStructDef. The AtlasStructDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasStructDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasStructDef] = kwargs.pop("cls", None) + + _request = build_type_get_struct_def_by_name_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasStructDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_by_guid(self, guid: str, **kwargs: Any) -> _models.AtlasTypeDef: + """Get the type definition for the given GUID. + + :param guid: The globally unique identifier of the type. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypeDef. The AtlasTypeDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypeDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasTypeDef] = kwargs.pop("cls", None) + + _request = build_type_get_by_guid_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasTypeDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_by_name(self, name: str, **kwargs: Any) -> _models.AtlasTypeDef: + """Get the type definition by its name (unique). + + :param name: The name of the type. Required. + :type name: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypeDef. The AtlasTypeDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypeDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasTypeDef] = kwargs.pop("cls", None) + + _request = build_type_get_by_name_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasTypeDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Delete API for type identified by its name. + + :param name: The name of the type. Required. + :type name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_type_delete_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def list( + self, + *, + include_term_template: Optional[bool] = None, + type: Optional[Union[str, _models.Typedef]] = None, + **kwargs: Any + ) -> _models.AtlasTypesDef: + """List all type definitions in bulk. + + :keyword include_term_template: Whether include termtemplatedef when return all typedefs. + This is always true + when search filter type=term_template. Default value is None. + :paramtype include_term_template: bool + :keyword type: Typedef name as search filter when get typedefs. Known values are: "enum", + "entity", "classification", "relationship", "struct", and "term_template". Default value is + None. + :paramtype type: str or ~azure.analytics.purview.datamap.models.Typedef + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypesDef. The AtlasTypesDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AtlasTypesDef] = kwargs.pop("cls", None) + + _request = build_type_list_request( + include_term_template=include_term_template, + type=type, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasTypesDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def bulk_create( + self, types_def: _models.AtlasTypesDef, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasTypesDef: + """Create all atlas type definitions in bulk, only new definitions will be + created. + Any changes to the existing definitions will be discarded. + + :param types_def: A composite wrapper object with corresponding lists of the type definition. + Required. + :type types_def: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypesDef. The AtlasTypesDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def bulk_create( + self, types_def: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasTypesDef: + """Create all atlas type definitions in bulk, only new definitions will be + created. + Any changes to the existing definitions will be discarded. + + :param types_def: A composite wrapper object with corresponding lists of the type definition. + Required. + :type types_def: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypesDef. The AtlasTypesDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def bulk_create( + self, types_def: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasTypesDef: + """Create all atlas type definitions in bulk, only new definitions will be + created. + Any changes to the existing definitions will be discarded. + + :param types_def: A composite wrapper object with corresponding lists of the type definition. + Required. + :type types_def: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypesDef. The AtlasTypesDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def bulk_create( + self, types_def: Union[_models.AtlasTypesDef, JSON, IO], **kwargs: Any + ) -> _models.AtlasTypesDef: + """Create all atlas type definitions in bulk, only new definitions will be + created. + Any changes to the existing definitions will be discarded. + + :param types_def: A composite wrapper object with corresponding lists of the type definition. + Is one of the following types: AtlasTypesDef, JSON, IO Required. + :type types_def: ~azure.analytics.purview.datamap.models.AtlasTypesDef or JSON or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypesDef. The AtlasTypesDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AtlasTypesDef] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(types_def, (IOBase, bytes)): + _content = types_def + else: + _content = json.dumps(types_def, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_type_bulk_create_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasTypesDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def bulk_update( + self, types_def: _models.AtlasTypesDef, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasTypesDef: + """Update all types in bulk, changes detected in the type definitions would be + persisted. + + :param types_def: A composite object that captures all type definition changes. Required. + :type types_def: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypesDef. The AtlasTypesDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def bulk_update( + self, types_def: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasTypesDef: + """Update all types in bulk, changes detected in the type definitions would be + persisted. + + :param types_def: A composite object that captures all type definition changes. Required. + :type types_def: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypesDef. The AtlasTypesDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def bulk_update( + self, types_def: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AtlasTypesDef: + """Update all types in bulk, changes detected in the type definitions would be + persisted. + + :param types_def: A composite object that captures all type definition changes. Required. + :type types_def: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypesDef. The AtlasTypesDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def bulk_update( + self, types_def: Union[_models.AtlasTypesDef, JSON, IO], **kwargs: Any + ) -> _models.AtlasTypesDef: + """Update all types in bulk, changes detected in the type definitions would be + persisted. + + :param types_def: A composite object that captures all type definition changes. Is one of the + following types: AtlasTypesDef, JSON, IO Required. + :type types_def: ~azure.analytics.purview.datamap.models.AtlasTypesDef or JSON or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: AtlasTypesDef. The AtlasTypesDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AtlasTypesDef] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(types_def, (IOBase, bytes)): + _content = types_def + else: + _content = json.dumps(types_def, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_type_bulk_update_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AtlasTypesDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def bulk_delete( # pylint: disable=inconsistent-return-statements + self, types_def: _models.AtlasTypesDef, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Delete API for all types in bulk. + + :param types_def: A composite object that captures all types to be deleted. Required. + :type types_def: ~azure.analytics.purview.datamap.models.AtlasTypesDef + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def bulk_delete( # pylint: disable=inconsistent-return-statements + self, types_def: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Delete API for all types in bulk. + + :param types_def: A composite object that captures all types to be deleted. Required. + :type types_def: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def bulk_delete( # pylint: disable=inconsistent-return-statements + self, types_def: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Delete API for all types in bulk. + + :param types_def: A composite object that captures all types to be deleted. Required. + :type types_def: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def bulk_delete( # pylint: disable=inconsistent-return-statements + self, types_def: Union[_models.AtlasTypesDef, JSON, IO], **kwargs: Any + ) -> None: + """Delete API for all types in bulk. + + :param types_def: A composite object that captures all types to be deleted. Is one of the + following types: AtlasTypesDef, JSON, IO Required. + :type types_def: ~azure.analytics.purview.datamap.models.AtlasTypesDef or JSON or IO + :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default + value is None. + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(types_def, (IOBase, bytes)): + _content = types_def + else: + _content = json.dumps(types_def, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_type_bulk_delete_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def list_headers( + self, + *, + include_term_template: Optional[bool] = None, + type: Optional[Union[str, _models.Typedef]] = None, + **kwargs: Any + ) -> List[_models.AtlasTypeDefHeader]: + """List all type definitions returned as a list of minimal information header. + + :keyword include_term_template: Whether include termtemplatedef when return all typedefs. + This is always true + when search filter type=term_template. Default value is None. + :paramtype include_term_template: bool + :keyword type: Typedef name as search filter when get typedefs. Known values are: "enum", + "entity", "classification", "relationship", "struct", and "term_template". Default value is + None. + :paramtype type: str or ~azure.analytics.purview.datamap.models.Typedef + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: list of AtlasTypeDefHeader + :rtype: list[~azure.analytics.purview.datamap.models.AtlasTypeDefHeader] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AtlasTypeDefHeader]] = kwargs.pop("cls", None) + + _request = build_type_list_headers_request( + include_term_template=include_term_template, + type=type, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.AtlasTypeDefHeader], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_term_template_def_by_guid(self, guid: str, **kwargs: Any) -> _models.TermTemplateDef: + """Get the term template definition for the given GUID. + + :param guid: The globally unique identifier of the term template. Required. + :type guid: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: TermTemplateDef. The TermTemplateDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.TermTemplateDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TermTemplateDef] = kwargs.pop("cls", None) + + _request = build_type_get_term_template_def_by_guid_request( + guid=guid, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.TermTemplateDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_term_template_def_by_name(self, name: str, **kwargs: Any) -> _models.TermTemplateDef: + """Get the term template definition by its name (unique). + + :param name: The unique name of the term template. Required. + :type name: str + :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You + will have to context manage the returned stream. + :return: TermTemplateDef. The TermTemplateDef is compatible with MutableMapping + :rtype: ~azure.analytics.purview.datamap.models.TermTemplateDef + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TermTemplateDef] = kwargs.pop("cls", None) + + _request = build_type_get_term_template_def_by_name_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.TermTemplateDef, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_operations/_patch.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_operations/_patch.py new file mode 100644 index 0000000000000..f7dd32510333d --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_patch.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_patch.py new file mode 100644 index 0000000000000..f7dd32510333d --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_vendor.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_vendor.py new file mode 100644 index 0000000000000..b1a228c8145cf --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/aio/_vendor.py @@ -0,0 +1,78 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from abc import ABC +from typing import TYPE_CHECKING + +from ._configuration import ( + DiscoveryClientConfiguration, + EntityClientConfiguration, + GlossaryClientConfiguration, + LineageClientConfiguration, + RelationshipClientConfiguration, + TypeClientConfiguration, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from .._serialization import Deserializer, Serializer + + +class EntityClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: EntityClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" + + +class GlossaryClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: GlossaryClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" + + +class DiscoveryClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: DiscoveryClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" + + +class LineageClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: LineageClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" + + +class RelationshipClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: RelationshipClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" + + +class TypeClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: TypeClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/models/__init__.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/models/__init__.py new file mode 100644 index 0000000000000..22df750bab4fb --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/models/__init__.py @@ -0,0 +1,183 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._models import AtlasAttributeDef +from ._models import AtlasBusinessMetadataDef +from ._models import AtlasClassification +from ._models import AtlasClassificationDef +from ._models import AtlasClassifications +from ._models import AtlasConstraintDef +from ._models import AtlasEntitiesWithExtInfo +from ._models import AtlasEntity +from ._models import AtlasEntityDef +from ._models import AtlasEntityHeader +from ._models import AtlasEntityHeaders +from ._models import AtlasEntityWithExtInfo +from ._models import AtlasEnumDef +from ._models import AtlasEnumElementDef +from ._models import AtlasGlossary +from ._models import AtlasGlossaryCategory +from ._models import AtlasGlossaryExtInfo +from ._models import AtlasGlossaryHeader +from ._models import AtlasGlossaryTerm +from ._models import AtlasLineageInfo +from ._models import AtlasObjectId +from ._models import AtlasRelatedCategoryHeader +from ._models import AtlasRelatedObjectId +from ._models import AtlasRelatedTermHeader +from ._models import AtlasRelationship +from ._models import AtlasRelationshipAttributeDef +from ._models import AtlasRelationshipDef +from ._models import AtlasRelationshipEndDef +from ._models import AtlasRelationshipWithExtInfo +from ._models import AtlasStruct +from ._models import AtlasStructDef +from ._models import AtlasTermAssignmentHeader +from ._models import AtlasTermCategorizationHeader +from ._models import AtlasTypeDef +from ._models import AtlasTypeDefHeader +from ._models import AtlasTypesDef +from ._models import AutoCompleteRequest +from ._models import AutoCompleteResult +from ._models import AutoCompleteResultValue +from ._models import BulkImportResponse +from ._models import ClassificationAssociateRequest +from ._models import ContactBasic +from ._models import ContactSearchResultValue +from ._models import DateFormat +from ._models import EntityMutationResponse +from ._models import ErrorResponse +from ._models import ImportInfo +from ._models import LineageRelation +from ._models import MoveEntitiesRequest +from ._models import NumberFormat +from ._models import ParentRelation +from ._models import PurviewObjectId +from ._models import ResourceLink +from ._models import SearchFacetItem +from ._models import SearchFacetItemValue +from ._models import SearchFacetResultValue +from ._models import SearchHighlights +from ._models import SearchRequest +from ._models import SearchRequestTaxonomySetting +from ._models import SearchResult +from ._models import SearchResultValue +from ._models import SuggestRequest +from ._models import SuggestResult +from ._models import SuggestResultValue +from ._models import TermSearchResultValue +from ._models import TermTemplateDef +from ._models import TimeBoundary +from ._models import TimeZone + +from ._enums import AtlasTermAssignmentStatus +from ._enums import AtlasTermRelationshipStatus +from ._enums import BusinessAttributeUpdateBehavior +from ._enums import Cardinality +from ._enums import Direction +from ._enums import ImportStatus +from ._enums import LineageDirection +from ._enums import RelationshipCategory +from ._enums import RoundingMode +from ._enums import SortType +from ._enums import Status +from ._enums import StatusAtlasRelationship +from ._enums import TermStatus +from ._enums import TypeCategory +from ._enums import Typedef +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AtlasAttributeDef", + "AtlasBusinessMetadataDef", + "AtlasClassification", + "AtlasClassificationDef", + "AtlasClassifications", + "AtlasConstraintDef", + "AtlasEntitiesWithExtInfo", + "AtlasEntity", + "AtlasEntityDef", + "AtlasEntityHeader", + "AtlasEntityHeaders", + "AtlasEntityWithExtInfo", + "AtlasEnumDef", + "AtlasEnumElementDef", + "AtlasGlossary", + "AtlasGlossaryCategory", + "AtlasGlossaryExtInfo", + "AtlasGlossaryHeader", + "AtlasGlossaryTerm", + "AtlasLineageInfo", + "AtlasObjectId", + "AtlasRelatedCategoryHeader", + "AtlasRelatedObjectId", + "AtlasRelatedTermHeader", + "AtlasRelationship", + "AtlasRelationshipAttributeDef", + "AtlasRelationshipDef", + "AtlasRelationshipEndDef", + "AtlasRelationshipWithExtInfo", + "AtlasStruct", + "AtlasStructDef", + "AtlasTermAssignmentHeader", + "AtlasTermCategorizationHeader", + "AtlasTypeDef", + "AtlasTypeDefHeader", + "AtlasTypesDef", + "AutoCompleteRequest", + "AutoCompleteResult", + "AutoCompleteResultValue", + "BulkImportResponse", + "ClassificationAssociateRequest", + "ContactBasic", + "ContactSearchResultValue", + "DateFormat", + "EntityMutationResponse", + "ErrorResponse", + "ImportInfo", + "LineageRelation", + "MoveEntitiesRequest", + "NumberFormat", + "ParentRelation", + "PurviewObjectId", + "ResourceLink", + "SearchFacetItem", + "SearchFacetItemValue", + "SearchFacetResultValue", + "SearchHighlights", + "SearchRequest", + "SearchRequestTaxonomySetting", + "SearchResult", + "SearchResultValue", + "SuggestRequest", + "SuggestResult", + "SuggestResultValue", + "TermSearchResultValue", + "TermTemplateDef", + "TimeBoundary", + "TimeZone", + "AtlasTermAssignmentStatus", + "AtlasTermRelationshipStatus", + "BusinessAttributeUpdateBehavior", + "Cardinality", + "Direction", + "ImportStatus", + "LineageDirection", + "RelationshipCategory", + "RoundingMode", + "SortType", + "Status", + "StatusAtlasRelationship", + "TermStatus", + "TypeCategory", + "Typedef", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/models/_enums.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/models/_enums.py new file mode 100644 index 0000000000000..6f71eb9e41345 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/models/_enums.py @@ -0,0 +1,213 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class AtlasTermAssignmentStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status for term assignment.""" + + DISCOVERED = "DISCOVERED" + """The status is discovered.""" + PROPOSED = "PROPOSED" + """The status is proposed.""" + IMPORTED = "IMPORTED" + """The status is imported.""" + VALIDATED = "VALIDATED" + """The status is validated.""" + DEPRECATED = "DEPRECATED" + """The status is deprecated.""" + OBSOLETE = "OBSOLETE" + """The status is obsolete.""" + OTHER = "OTHER" + """Other status.""" + + +class AtlasTermRelationshipStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status for atlas term relationship.""" + + DRAFT = "DRAFT" + """draft""" + ACTIVE = "ACTIVE" + """active""" + DEPRECATED = "DEPRECATED" + """deprecated""" + OBSOLETE = "OBSOLETE" + """obsolete""" + OTHER = "OTHER" + """other""" + + +class BusinessAttributeUpdateBehavior(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum for business attribute update behavior.""" + + IGNORE = "ignore" + """Ignore the business attribute payload for update.""" + REPLACE = "replace" + """Replace all the business attributes using the payload.""" + MERGE = "merge" + """Merge the business attributes. Business attributes will not be updated if not provided.""" + + +class Cardinality(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Cardinality.""" + + SINGLE = "SINGLE" + """single""" + LIST = "LIST" + """list""" + SET = "SET" + """set""" + + +class Direction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Direction.""" + + BOTH = "BOTH" + """both""" + INPUT = "INPUT" + """input""" + OUTPUT = "OUTPUT" + """output""" + + +class ImportStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status for import.""" + + SUCCESS = "SUCCESS" + """Success""" + FAILED = "FAILED" + """Failed""" + + +class LineageDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Lineage direction.""" + + INPUT = "INPUT" + """input""" + OUTPUT = "OUTPUT" + """output""" + BOTH = "BOTH" + """both""" + + +class RelationshipCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Relationship Category.""" + + ASSOCIATION = "ASSOCIATION" + """association""" + AGGREGATION = "AGGREGATION" + """aggregation""" + COMPOSITION = "COMPOSITION" + """composition""" + + +class RoundingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Rounding Mode.""" + + UP = "UP" + """up""" + DOWN = "DOWN" + """down""" + CEILING = "CEILING" + """ceiling""" + FLOOR = "FLOOR" + """floor""" + HALF_UP = "HALF_UP" + """half up""" + HALF_DOWN = "HALF_DOWN" + """half down""" + HALF_EVEN = "HALF_EVEN" + """half even""" + UNNECESSARY = "UNNECESSARY" + """unnecessary""" + + +class SortType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type for sorting.""" + + NONE = "NONE" + """No sorting order""" + ASC = "ASC" + """Use ascending order for sorting""" + DESC = "DESC" + """Use descending order for sorting""" + + +class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status - can be active or deleted.""" + + ACTIVE = "ACTIVE" + """The status is active.""" + DELETED = "DELETED" + """The status is deleted.""" + + +class StatusAtlasRelationship(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status for atlas relationship.""" + + ACTIVE = "ACTIVE" + """active""" + DELETED = "DELETED" + """deleted""" + + +class TermStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status for term.""" + + DRAFT = "Draft" + """draft""" + APPROVED = "Approved" + """approved""" + ALERT = "Alert" + """alert""" + EXPIRED = "Expired" + """expired""" + + +class TypeCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type Category.""" + + PRIMITIVE = "PRIMITIVE" + """primitive""" + OBJECT_ID_TYPE = "OBJECT_ID_TYPE" + """object id type""" + ENUM = "ENUM" + """enum""" + STRUCT = "STRUCT" + """struct""" + CLASSIFICATION = "CLASSIFICATION" + """classification""" + ENTITY = "ENTITY" + """entity""" + ARRAY = "ARRAY" + """array""" + MAP = "MAP" + """map""" + RELATIONSHIP = "RELATIONSHIP" + """relationship""" + TERM_TEMPLATE = "TERM_TEMPLATE" + """term template""" + + +class Typedef(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type.""" + + ENUM = "enum" + """enum""" + ENTITY = "entity" + """entity""" + CLASSIFICATION = "classification" + """classification""" + RELATIONSHIP = "relationship" + """relationship""" + STRUCT = "struct" + """struct""" + TERM_TEMPLATE = "term_template" + """term template""" diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/models/_models.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/models/_models.py new file mode 100644 index 0000000000000..275528ae169b9 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/models/_models.py @@ -0,0 +1,4846 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import sys +from typing import Any, Dict, List, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .. import _model_base +from .._model_base import rest_field + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + + +class AtlasAttributeDef(_model_base.Model): # pylint: disable=too-many-instance-attributes + """class that captures details of a struct-attribute. + + :ivar cardinality: single-valued attribute or multi-valued attribute. Known values are: + "SINGLE", "LIST", and "SET". + :vartype cardinality: str or ~azure.analytics.purview.datamap.models.Cardinality + :ivar constraints: An array of constraints. + :vartype constraints: list[~azure.analytics.purview.datamap.models.AtlasConstraintDef] + :ivar default_value: The default value of the attribute. + :vartype default_value: str + :ivar description: The description of the attribute. + :vartype description: str + :ivar include_in_notification: Determines if it is included in notification. + :vartype include_in_notification: bool + :ivar is_indexable: Determines if it is indexable. + :vartype is_indexable: bool + :ivar is_optional: Determines if it is optional. + :vartype is_optional: bool + :ivar is_unique: Determines if it unique. + :vartype is_unique: bool + :ivar name: The name of the attribute. + :vartype name: str + :ivar options: The options for the attribute. + :vartype options: dict[str, str] + :ivar type_name: The name of the type. + :vartype type_name: str + :ivar values_max_count: The maximum count of the values. + :vartype values_max_count: int + :ivar values_min_count: The minimum count of the values. + :vartype values_min_count: int + """ + + cardinality: Optional[Union[str, "_models.Cardinality"]] = rest_field() + """single-valued attribute or multi-valued attribute. Known values are: \"SINGLE\", \"LIST\", and + \"SET\".""" + constraints: Optional[List["_models.AtlasConstraintDef"]] = rest_field() + """An array of constraints.""" + default_value: Optional[str] = rest_field(name="defaultValue") + """The default value of the attribute.""" + description: Optional[str] = rest_field() + """The description of the attribute.""" + include_in_notification: Optional[bool] = rest_field(name="includeInNotification") + """Determines if it is included in notification.""" + is_indexable: Optional[bool] = rest_field(name="isIndexable") + """Determines if it is indexable.""" + is_optional: Optional[bool] = rest_field(name="isOptional") + """Determines if it is optional.""" + is_unique: Optional[bool] = rest_field(name="isUnique") + """Determines if it unique.""" + name: Optional[str] = rest_field() + """The name of the attribute.""" + options: Optional[Dict[str, str]] = rest_field() + """The options for the attribute.""" + type_name: Optional[str] = rest_field(name="typeName") + """The name of the type.""" + values_max_count: Optional[int] = rest_field(name="valuesMaxCount") + """The maximum count of the values.""" + values_min_count: Optional[int] = rest_field(name="valuesMinCount") + """The minimum count of the values.""" + + @overload + def __init__( + self, + *, + cardinality: Optional[Union[str, "_models.Cardinality"]] = None, + constraints: Optional[List["_models.AtlasConstraintDef"]] = None, + default_value: Optional[str] = None, + description: Optional[str] = None, + include_in_notification: Optional[bool] = None, + is_indexable: Optional[bool] = None, + is_optional: Optional[bool] = None, + is_unique: Optional[bool] = None, + name: Optional[str] = None, + options: Optional[Dict[str, str]] = None, + type_name: Optional[str] = None, + values_max_count: Optional[int] = None, + values_min_count: Optional[int] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasBusinessMetadataDef(_model_base.Model): # pylint: disable=too-many-instance-attributes + """class that captures details of a struct-type. + + :ivar category: The enum of type category. Known values are: "PRIMITIVE", "OBJECT_ID_TYPE", + "ENUM", "STRUCT", "CLASSIFICATION", "ENTITY", "ARRAY", "MAP", "RELATIONSHIP", and + "TERM_TEMPLATE". + :vartype category: str or ~azure.analytics.purview.datamap.models.TypeCategory + :ivar create_time: The created time of the record. + :vartype create_time: int + :ivar created_by: The user who created the record. + :vartype created_by: str + :ivar date_formatter: The date format. + :vartype date_formatter: ~azure.analytics.purview.datamap.models.DateFormat + :ivar description: The description of the type definition. + :vartype description: str + :ivar guid: The GUID of the type definition. + :vartype guid: str + :ivar name: The name of the type definition. + :vartype name: str + :ivar options: The options for the type definition. + :vartype options: dict[str, str] + :ivar service_type: The service type. + :vartype service_type: str + :ivar type_version: The version of the type. + :vartype type_version: str + :ivar update_time: The update time of the record. + :vartype update_time: int + :ivar updated_by: The user who updated the record. + :vartype updated_by: str + :ivar version: The version of the record. + :vartype version: int + :ivar last_modified_t_s: ETag for concurrency control. + :vartype last_modified_t_s: str + :ivar attribute_defs: An array of attribute definitions. + :vartype attribute_defs: list[~azure.analytics.purview.datamap.models.AtlasAttributeDef] + """ + + category: Optional[Union[str, "_models.TypeCategory"]] = rest_field() + """The enum of type category. Known values are: \"PRIMITIVE\", \"OBJECT_ID_TYPE\", \"ENUM\", + \"STRUCT\", \"CLASSIFICATION\", \"ENTITY\", \"ARRAY\", \"MAP\", \"RELATIONSHIP\", and + \"TERM_TEMPLATE\".""" + create_time: Optional[int] = rest_field(name="createTime") + """The created time of the record.""" + created_by: Optional[str] = rest_field(name="createdBy") + """The user who created the record.""" + date_formatter: Optional["_models.DateFormat"] = rest_field(name="dateFormatter") + """The date format.""" + description: Optional[str] = rest_field() + """The description of the type definition.""" + guid: Optional[str] = rest_field() + """The GUID of the type definition.""" + name: Optional[str] = rest_field() + """The name of the type definition.""" + options: Optional[Dict[str, str]] = rest_field() + """The options for the type definition.""" + service_type: Optional[str] = rest_field(name="serviceType") + """The service type.""" + type_version: Optional[str] = rest_field(name="typeVersion") + """The version of the type.""" + update_time: Optional[int] = rest_field(name="updateTime") + """The update time of the record.""" + updated_by: Optional[str] = rest_field(name="updatedBy") + """The user who updated the record.""" + version: Optional[int] = rest_field() + """The version of the record.""" + last_modified_t_s: Optional[str] = rest_field(name="lastModifiedTS") + """ETag for concurrency control.""" + attribute_defs: Optional[List["_models.AtlasAttributeDef"]] = rest_field(name="attributeDefs") + """An array of attribute definitions.""" + + @overload + def __init__( + self, + *, + category: Optional[Union[str, "_models.TypeCategory"]] = None, + create_time: Optional[int] = None, + created_by: Optional[str] = None, + date_formatter: Optional["_models.DateFormat"] = None, + description: Optional[str] = None, + guid: Optional[str] = None, + name: Optional[str] = None, + options: Optional[Dict[str, str]] = None, + service_type: Optional[str] = None, + type_version: Optional[str] = None, + update_time: Optional[int] = None, + updated_by: Optional[str] = None, + version: Optional[int] = None, + last_modified_t_s: Optional[str] = None, + attribute_defs: Optional[List["_models.AtlasAttributeDef"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasClassification(_model_base.Model): + """An instance of a classification; it doesn't have an identity, this object + exists only when associated with an entity. + + :ivar attributes: The attributes of the struct. + :vartype attributes: dict[str, any] + :ivar type_name: The name of the type. + :vartype type_name: str + :ivar last_modified_t_s: ETag for concurrency control. + :vartype last_modified_t_s: str + :ivar entity_guid: The GUID of the entity. + :vartype entity_guid: str + :ivar entity_status: Status of the entity - can be active or deleted. Deleted entities are not + removed. Known values are: "ACTIVE" and "DELETED". + :vartype entity_status: str or ~azure.analytics.purview.datamap.models.Status + :ivar remove_propagations_on_entity_delete: Determines if propagations will be removed on + entity deletion. + :vartype remove_propagations_on_entity_delete: bool + :ivar validity_periods: An array of time boundaries indicating validity periods. + :vartype validity_periods: list[~azure.analytics.purview.datamap.models.TimeBoundary] + """ + + attributes: Optional[Dict[str, Any]] = rest_field() + """The attributes of the struct.""" + type_name: Optional[str] = rest_field(name="typeName") + """The name of the type.""" + last_modified_t_s: Optional[str] = rest_field(name="lastModifiedTS") + """ETag for concurrency control.""" + entity_guid: Optional[str] = rest_field(name="entityGuid") + """The GUID of the entity.""" + entity_status: Optional[Union[str, "_models.Status"]] = rest_field(name="entityStatus") + """Status of the entity - can be active or deleted. Deleted entities are not + removed. Known values are: \"ACTIVE\" and \"DELETED\".""" + remove_propagations_on_entity_delete: Optional[bool] = rest_field(name="removePropagationsOnEntityDelete") + """Determines if propagations will be removed on entity deletion.""" + validity_periods: Optional[List["_models.TimeBoundary"]] = rest_field(name="validityPeriods") + """An array of time boundaries indicating validity periods.""" + + @overload + def __init__( + self, + *, + attributes: Optional[Dict[str, Any]] = None, + type_name: Optional[str] = None, + last_modified_t_s: Optional[str] = None, + entity_guid: Optional[str] = None, + entity_status: Optional[Union[str, "_models.Status"]] = None, + remove_propagations_on_entity_delete: Optional[bool] = None, + validity_periods: Optional[List["_models.TimeBoundary"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasClassificationDef(_model_base.Model): # pylint: disable=too-many-instance-attributes + """class that captures details of a classification-type. + + :ivar category: The enum of type category. Known values are: "PRIMITIVE", "OBJECT_ID_TYPE", + "ENUM", "STRUCT", "CLASSIFICATION", "ENTITY", "ARRAY", "MAP", "RELATIONSHIP", and + "TERM_TEMPLATE". + :vartype category: str or ~azure.analytics.purview.datamap.models.TypeCategory + :ivar create_time: The created time of the record. + :vartype create_time: int + :ivar created_by: The user who created the record. + :vartype created_by: str + :ivar date_formatter: The date format. + :vartype date_formatter: ~azure.analytics.purview.datamap.models.DateFormat + :ivar description: The description of the type definition. + :vartype description: str + :ivar guid: The GUID of the type definition. + :vartype guid: str + :ivar name: The name of the type definition. + :vartype name: str + :ivar options: The options for the type definition. + :vartype options: dict[str, str] + :ivar service_type: The service type. + :vartype service_type: str + :ivar type_version: The version of the type. + :vartype type_version: str + :ivar update_time: The update time of the record. + :vartype update_time: int + :ivar updated_by: The user who updated the record. + :vartype updated_by: str + :ivar version: The version of the record. + :vartype version: int + :ivar last_modified_t_s: ETag for concurrency control. + :vartype last_modified_t_s: str + :ivar attribute_defs: An array of attribute definitions. + :vartype attribute_defs: list[~azure.analytics.purview.datamap.models.AtlasAttributeDef] + :ivar entity_types: Specifying a list of entityType names in the classificationDef, ensures + that + classifications can + only be applied to those entityTypes. + + + .. raw:: html + +
    +
  • Any subtypes + of the entity types inherit the restriction
  • +
  • Any classificationDef + subtypes inherit the parents entityTypes restrictions
  • +
  • Any + classificationDef subtypes can further restrict the parents entityTypes + restrictions by specifying a subset of the entityTypes
  • +
  • An empty + entityTypes list when there are no parent restrictions means there are no + restrictions
  • +
  • An empty entityTypes list when there are parent + restrictions means that the subtype picks up the parents + restrictions
  • +
  • If a list of entityTypes are supplied, where one inherits + from another, this will be rejected. This should encourage cleaner + classificationsDefs
  • +
. + :vartype entity_types: list[str] + :ivar sub_types: An array of sub types. + :vartype sub_types: list[str] + :ivar super_types: An array of super types. + :vartype super_types: list[str] + """ + + category: Optional[Union[str, "_models.TypeCategory"]] = rest_field() + """The enum of type category. Known values are: \"PRIMITIVE\", \"OBJECT_ID_TYPE\", \"ENUM\", + \"STRUCT\", \"CLASSIFICATION\", \"ENTITY\", \"ARRAY\", \"MAP\", \"RELATIONSHIP\", and + \"TERM_TEMPLATE\".""" + create_time: Optional[int] = rest_field(name="createTime") + """The created time of the record.""" + created_by: Optional[str] = rest_field(name="createdBy") + """The user who created the record.""" + date_formatter: Optional["_models.DateFormat"] = rest_field(name="dateFormatter") + """The date format.""" + description: Optional[str] = rest_field() + """The description of the type definition.""" + guid: Optional[str] = rest_field() + """The GUID of the type definition.""" + name: Optional[str] = rest_field() + """The name of the type definition.""" + options: Optional[Dict[str, str]] = rest_field() + """The options for the type definition.""" + service_type: Optional[str] = rest_field(name="serviceType") + """The service type.""" + type_version: Optional[str] = rest_field(name="typeVersion") + """The version of the type.""" + update_time: Optional[int] = rest_field(name="updateTime") + """The update time of the record.""" + updated_by: Optional[str] = rest_field(name="updatedBy") + """The user who updated the record.""" + version: Optional[int] = rest_field() + """The version of the record.""" + last_modified_t_s: Optional[str] = rest_field(name="lastModifiedTS") + """ETag for concurrency control.""" + attribute_defs: Optional[List["_models.AtlasAttributeDef"]] = rest_field(name="attributeDefs") + """An array of attribute definitions.""" + entity_types: Optional[List[str]] = rest_field(name="entityTypes") + """Specifying a list of entityType names in the classificationDef, ensures that + classifications can + only be applied to those entityTypes. + + + .. raw:: html + +
    +
  • Any subtypes + of the entity types inherit the restriction
  • +
  • Any classificationDef + subtypes inherit the parents entityTypes restrictions
  • +
  • Any + classificationDef subtypes can further restrict the parents entityTypes + restrictions by specifying a subset of the entityTypes
  • +
  • An empty + entityTypes list when there are no parent restrictions means there are no + restrictions
  • +
  • An empty entityTypes list when there are parent + restrictions means that the subtype picks up the parents + restrictions
  • +
  • If a list of entityTypes are supplied, where one inherits + from another, this will be rejected. This should encourage cleaner + classificationsDefs
  • +
.""" + sub_types: Optional[List[str]] = rest_field(name="subTypes") + """An array of sub types.""" + super_types: Optional[List[str]] = rest_field(name="superTypes") + """An array of super types.""" + + @overload + def __init__( + self, + *, + category: Optional[Union[str, "_models.TypeCategory"]] = None, + create_time: Optional[int] = None, + created_by: Optional[str] = None, + date_formatter: Optional["_models.DateFormat"] = None, + description: Optional[str] = None, + guid: Optional[str] = None, + name: Optional[str] = None, + options: Optional[Dict[str, str]] = None, + service_type: Optional[str] = None, + type_version: Optional[str] = None, + update_time: Optional[int] = None, + updated_by: Optional[str] = None, + version: Optional[int] = None, + last_modified_t_s: Optional[str] = None, + attribute_defs: Optional[List["_models.AtlasAttributeDef"]] = None, + entity_types: Optional[List[str]] = None, + sub_types: Optional[List[str]] = None, + super_types: Optional[List[str]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasClassifications(_model_base.Model): + """REST serialization friendly list. + + :ivar list: An array of objects. + :vartype list: list[any] + :ivar page_size: The size of the page. + :vartype page_size: int + :ivar sort_by: The sorted by field. + :vartype sort_by: str + :ivar sort_type: to specify whether the result should be sorted? If yes, whether asc or desc. + Known values are: "NONE", "ASC", and "DESC". + :vartype sort_type: str or ~azure.analytics.purview.datamap.models.SortType + :ivar start_index: The start index of the page. + :vartype start_index: int + :ivar total_count: The total count of items. + :vartype total_count: int + """ + + list: Optional[List[Any]] = rest_field() + """An array of objects.""" + page_size: Optional[int] = rest_field(name="pageSize") + """The size of the page.""" + sort_by: Optional[str] = rest_field(name="sortBy") + """The sorted by field.""" + sort_type: Optional[Union[str, "_models.SortType"]] = rest_field(name="sortType") + """to specify whether the result should be sorted? If yes, whether asc or desc. Known values are: + \"NONE\", \"ASC\", and \"DESC\".""" + start_index: Optional[int] = rest_field(name="startIndex") + """The start index of the page.""" + total_count: Optional[int] = rest_field(name="totalCount") + """The total count of items.""" + + @overload + def __init__( + self, + *, + list: Optional[List[Any]] = None, + page_size: Optional[int] = None, + sort_by: Optional[str] = None, + sort_type: Optional[Union[str, "_models.SortType"]] = None, + start_index: Optional[int] = None, + total_count: Optional[int] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasConstraintDef(_model_base.Model): + """class that captures details of a constraint. + + :ivar params: The parameters of the constraint definition. + :vartype params: dict[str, any] + :ivar type: The type of the constraint. + :vartype type: str + """ + + params: Optional[Dict[str, Any]] = rest_field() + """The parameters of the constraint definition.""" + type: Optional[str] = rest_field() + """The type of the constraint.""" + + @overload + def __init__( + self, + *, + params: Optional[Dict[str, Any]] = None, + type: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasEntitiesWithExtInfo(_model_base.Model): + """An instance of an entity along with extended info - like hive_table, + hive_database. + + :ivar referred_entities: The referred entities. + :vartype referred_entities: dict[str, ~azure.analytics.purview.datamap.models.AtlasEntity] + :ivar entities: An array of entities. + :vartype entities: list[~azure.analytics.purview.datamap.models.AtlasEntity] + """ + + referred_entities: Optional[Dict[str, "_models.AtlasEntity"]] = rest_field(name="referredEntities") + """The referred entities.""" + entities: Optional[List["_models.AtlasEntity"]] = rest_field() + """An array of entities.""" + + @overload + def __init__( + self, + *, + referred_entities: Optional[Dict[str, "_models.AtlasEntity"]] = None, + entities: Optional[List["_models.AtlasEntity"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasEntity(_model_base.Model): # pylint: disable=too-many-instance-attributes + """An instance of an entity - like hive_table, hive_database. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar attributes: The attributes of the struct. + :vartype attributes: dict[str, any] + :ivar type_name: The name of the type. + :vartype type_name: str + :ivar last_modified_t_s: ETag for concurrency control. + :vartype last_modified_t_s: str + :ivar business_attributes: Business attributes. + :vartype business_attributes: dict[str, any] + :ivar classifications: An array of classifications. + :vartype classifications: list[~azure.analytics.purview.datamap.models.AtlasClassification] + :ivar create_time: The created time of the record. + :vartype create_time: int + :ivar created_by: The user who created the record. + :vartype created_by: str + :ivar custom_attributes: Custom Attribute. + :vartype custom_attributes: dict[str, str] + :ivar guid: The GUID of the entity. + :vartype guid: str + :ivar home_id: The home ID of the entity. + :vartype home_id: str + :ivar collection_id: The collection ID of the entity. + :vartype collection_id: str + :ivar is_incomplete: Whether it is a shell entity. + :vartype is_incomplete: bool + :ivar labels: labels. + :vartype labels: list[str] + :ivar meanings: An array of term assignment headers indicating the meanings of the entity. + :vartype meanings: list[~azure.analytics.purview.datamap.models.AtlasTermAssignmentHeader] + :ivar provenance_type: Used to record the provenance of an instance of an entity or + relationship. + :vartype provenance_type: int + :ivar proxy: Determines if there's a proxy. + :vartype proxy: bool + :ivar relationship_attributes: The attributes of relationship. + :vartype relationship_attributes: dict[str, any] + :ivar status: Status of the entity - can be active or deleted. Deleted entities are not + removed. Known values are: "ACTIVE" and "DELETED". + :vartype status: str or ~azure.analytics.purview.datamap.models.Status + :ivar update_time: The update time of the record. + :vartype update_time: int + :ivar updated_by: The user who updated the record. + :vartype updated_by: str + :ivar version: The version of the entity. + :vartype version: int + :ivar contacts: The dictionary of contacts for entities. Key could be Expert or Owner. + :vartype contacts: dict[str, list[~azure.analytics.purview.datamap.models.ContactBasic]] + """ + + attributes: Optional[Dict[str, Any]] = rest_field() + """The attributes of the struct.""" + type_name: Optional[str] = rest_field(name="typeName") + """The name of the type.""" + last_modified_t_s: Optional[str] = rest_field(name="lastModifiedTS") + """ETag for concurrency control.""" + business_attributes: Optional[Dict[str, Any]] = rest_field(name="businessAttributes") + """Business attributes.""" + classifications: Optional[List["_models.AtlasClassification"]] = rest_field() + """An array of classifications.""" + create_time: Optional[int] = rest_field(name="createTime") + """The created time of the record.""" + created_by: Optional[str] = rest_field(name="createdBy") + """The user who created the record.""" + custom_attributes: Optional[Dict[str, str]] = rest_field(name="customAttributes") + """Custom Attribute.""" + guid: Optional[str] = rest_field() + """The GUID of the entity.""" + home_id: Optional[str] = rest_field(name="homeId") + """The home ID of the entity.""" + collection_id: Optional[str] = rest_field(name="collectionId", visibility=["read"]) + """The collection ID of the entity.""" + is_incomplete: Optional[bool] = rest_field(name="isIncomplete") + """Whether it is a shell entity.""" + labels: Optional[List[str]] = rest_field() + """labels.""" + meanings: Optional[List["_models.AtlasTermAssignmentHeader"]] = rest_field() + """An array of term assignment headers indicating the meanings of the entity.""" + provenance_type: Optional[int] = rest_field(name="provenanceType") + """Used to record the provenance of an instance of an entity or relationship.""" + proxy: Optional[bool] = rest_field() + """Determines if there's a proxy.""" + relationship_attributes: Optional[Dict[str, Any]] = rest_field(name="relationshipAttributes") + """The attributes of relationship.""" + status: Optional[Union[str, "_models.Status"]] = rest_field() + """Status of the entity - can be active or deleted. Deleted entities are not + removed. Known values are: \"ACTIVE\" and \"DELETED\".""" + update_time: Optional[int] = rest_field(name="updateTime") + """The update time of the record.""" + updated_by: Optional[str] = rest_field(name="updatedBy") + """The user who updated the record.""" + version: Optional[int] = rest_field() + """The version of the entity.""" + contacts: Optional[Dict[str, List["_models.ContactBasic"]]] = rest_field() + """The dictionary of contacts for entities. Key could be Expert or Owner.""" + + @overload + def __init__( + self, + *, + attributes: Optional[Dict[str, Any]] = None, + type_name: Optional[str] = None, + last_modified_t_s: Optional[str] = None, + business_attributes: Optional[Dict[str, Any]] = None, + classifications: Optional[List["_models.AtlasClassification"]] = None, + create_time: Optional[int] = None, + created_by: Optional[str] = None, + custom_attributes: Optional[Dict[str, str]] = None, + guid: Optional[str] = None, + home_id: Optional[str] = None, + is_incomplete: Optional[bool] = None, + labels: Optional[List[str]] = None, + meanings: Optional[List["_models.AtlasTermAssignmentHeader"]] = None, + provenance_type: Optional[int] = None, + proxy: Optional[bool] = None, + relationship_attributes: Optional[Dict[str, Any]] = None, + status: Optional[Union[str, "_models.Status"]] = None, + update_time: Optional[int] = None, + updated_by: Optional[str] = None, + version: Optional[int] = None, + contacts: Optional[Dict[str, List["_models.ContactBasic"]]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasEntityDef(_model_base.Model): # pylint: disable=too-many-instance-attributes + """class that captures details of a entity-type. + + :ivar category: The enum of type category. Known values are: "PRIMITIVE", "OBJECT_ID_TYPE", + "ENUM", "STRUCT", "CLASSIFICATION", "ENTITY", "ARRAY", "MAP", "RELATIONSHIP", and + "TERM_TEMPLATE". + :vartype category: str or ~azure.analytics.purview.datamap.models.TypeCategory + :ivar create_time: The created time of the record. + :vartype create_time: int + :ivar created_by: The user who created the record. + :vartype created_by: str + :ivar date_formatter: The date format. + :vartype date_formatter: ~azure.analytics.purview.datamap.models.DateFormat + :ivar description: The description of the type definition. + :vartype description: str + :ivar guid: The GUID of the type definition. + :vartype guid: str + :ivar name: The name of the type definition. + :vartype name: str + :ivar options: The options for the type definition. + :vartype options: dict[str, str] + :ivar service_type: The service type. + :vartype service_type: str + :ivar type_version: The version of the type. + :vartype type_version: str + :ivar update_time: The update time of the record. + :vartype update_time: int + :ivar updated_by: The user who updated the record. + :vartype updated_by: str + :ivar version: The version of the record. + :vartype version: int + :ivar last_modified_t_s: ETag for concurrency control. + :vartype last_modified_t_s: str + :ivar attribute_defs: An array of attribute definitions. + :vartype attribute_defs: list[~azure.analytics.purview.datamap.models.AtlasAttributeDef] + :ivar sub_types: An array of sub types. + :vartype sub_types: list[str] + :ivar super_types: An array of super types. + :vartype super_types: list[str] + :ivar relationship_attribute_defs: An array of relationship attributes. + :vartype relationship_attribute_defs: + list[~azure.analytics.purview.datamap.models.AtlasRelationshipAttributeDef] + """ + + category: Optional[Union[str, "_models.TypeCategory"]] = rest_field() + """The enum of type category. Known values are: \"PRIMITIVE\", \"OBJECT_ID_TYPE\", \"ENUM\", + \"STRUCT\", \"CLASSIFICATION\", \"ENTITY\", \"ARRAY\", \"MAP\", \"RELATIONSHIP\", and + \"TERM_TEMPLATE\".""" + create_time: Optional[int] = rest_field(name="createTime") + """The created time of the record.""" + created_by: Optional[str] = rest_field(name="createdBy") + """The user who created the record.""" + date_formatter: Optional["_models.DateFormat"] = rest_field(name="dateFormatter") + """The date format.""" + description: Optional[str] = rest_field() + """The description of the type definition.""" + guid: Optional[str] = rest_field() + """The GUID of the type definition.""" + name: Optional[str] = rest_field() + """The name of the type definition.""" + options: Optional[Dict[str, str]] = rest_field() + """The options for the type definition.""" + service_type: Optional[str] = rest_field(name="serviceType") + """The service type.""" + type_version: Optional[str] = rest_field(name="typeVersion") + """The version of the type.""" + update_time: Optional[int] = rest_field(name="updateTime") + """The update time of the record.""" + updated_by: Optional[str] = rest_field(name="updatedBy") + """The user who updated the record.""" + version: Optional[int] = rest_field() + """The version of the record.""" + last_modified_t_s: Optional[str] = rest_field(name="lastModifiedTS") + """ETag for concurrency control.""" + attribute_defs: Optional[List["_models.AtlasAttributeDef"]] = rest_field(name="attributeDefs") + """An array of attribute definitions.""" + sub_types: Optional[List[str]] = rest_field(name="subTypes") + """An array of sub types.""" + super_types: Optional[List[str]] = rest_field(name="superTypes") + """An array of super types.""" + relationship_attribute_defs: Optional[List["_models.AtlasRelationshipAttributeDef"]] = rest_field( + name="relationshipAttributeDefs" + ) + """An array of relationship attributes.""" + + @overload + def __init__( + self, + *, + category: Optional[Union[str, "_models.TypeCategory"]] = None, + create_time: Optional[int] = None, + created_by: Optional[str] = None, + date_formatter: Optional["_models.DateFormat"] = None, + description: Optional[str] = None, + guid: Optional[str] = None, + name: Optional[str] = None, + options: Optional[Dict[str, str]] = None, + service_type: Optional[str] = None, + type_version: Optional[str] = None, + update_time: Optional[int] = None, + updated_by: Optional[str] = None, + version: Optional[int] = None, + last_modified_t_s: Optional[str] = None, + attribute_defs: Optional[List["_models.AtlasAttributeDef"]] = None, + sub_types: Optional[List[str]] = None, + super_types: Optional[List[str]] = None, + relationship_attribute_defs: Optional[List["_models.AtlasRelationshipAttributeDef"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasEntityHeader(_model_base.Model): # pylint: disable=too-many-instance-attributes + """An instance of an entity - like hive_table, hive_database. + + :ivar attributes: The attributes of the struct. + :vartype attributes: dict[str, any] + :ivar type_name: The name of the type. + :vartype type_name: str + :ivar last_modified_t_s: ETag for concurrency control. + :vartype last_modified_t_s: str + :ivar classification_names: An array of classification names. + :vartype classification_names: list[str] + :ivar classifications: An array of classifications. + :vartype classifications: list[~azure.analytics.purview.datamap.models.AtlasClassification] + :ivar display_text: The display text. + :vartype display_text: str + :ivar guid: The GUID of the record. + :vartype guid: str + :ivar is_incomplete: Whether it is a shell entity. + :vartype is_incomplete: bool + :ivar labels: labels. + :vartype labels: list[str] + :ivar meaning_names: An array of meanings. + :vartype meaning_names: list[str] + :ivar meanings: An array of term assignment headers. + :vartype meanings: list[~azure.analytics.purview.datamap.models.AtlasTermAssignmentHeader] + :ivar status: Status of the entity - can be active or deleted. Deleted entities are not + removed. Known values are: "ACTIVE" and "DELETED". + :vartype status: str or ~azure.analytics.purview.datamap.models.Status + """ + + attributes: Optional[Dict[str, Any]] = rest_field() + """The attributes of the struct.""" + type_name: Optional[str] = rest_field(name="typeName") + """The name of the type.""" + last_modified_t_s: Optional[str] = rest_field(name="lastModifiedTS") + """ETag for concurrency control.""" + classification_names: Optional[List[str]] = rest_field(name="classificationNames") + """An array of classification names.""" + classifications: Optional[List["_models.AtlasClassification"]] = rest_field() + """An array of classifications.""" + display_text: Optional[str] = rest_field(name="displayText") + """The display text.""" + guid: Optional[str] = rest_field() + """The GUID of the record.""" + is_incomplete: Optional[bool] = rest_field(name="isIncomplete") + """Whether it is a shell entity.""" + labels: Optional[List[str]] = rest_field() + """labels.""" + meaning_names: Optional[List[str]] = rest_field(name="meaningNames") + """An array of meanings.""" + meanings: Optional[List["_models.AtlasTermAssignmentHeader"]] = rest_field() + """An array of term assignment headers.""" + status: Optional[Union[str, "_models.Status"]] = rest_field() + """Status of the entity - can be active or deleted. Deleted entities are not + removed. Known values are: \"ACTIVE\" and \"DELETED\".""" + + @overload + def __init__( + self, + *, + attributes: Optional[Dict[str, Any]] = None, + type_name: Optional[str] = None, + last_modified_t_s: Optional[str] = None, + classification_names: Optional[List[str]] = None, + classifications: Optional[List["_models.AtlasClassification"]] = None, + display_text: Optional[str] = None, + guid: Optional[str] = None, + is_incomplete: Optional[bool] = None, + labels: Optional[List[str]] = None, + meaning_names: Optional[List[str]] = None, + meanings: Optional[List["_models.AtlasTermAssignmentHeader"]] = None, + status: Optional[Union[str, "_models.Status"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasEntityHeaders(_model_base.Model): + """An instance of an entity header map. + + :ivar guid_header_map: The description of the guid header map,. + :vartype guid_header_map: dict[str, ~azure.analytics.purview.datamap.models.AtlasEntityHeader] + """ + + guid_header_map: Optional[Dict[str, "_models.AtlasEntityHeader"]] = rest_field(name="guidHeaderMap") + """The description of the guid header map,.""" + + @overload + def __init__( + self, + *, + guid_header_map: Optional[Dict[str, "_models.AtlasEntityHeader"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasEntityWithExtInfo(_model_base.Model): + """An instance of an entity along with extended info - like hive_table, + hive_database. + + :ivar referred_entities: The referred entities. + :vartype referred_entities: dict[str, ~azure.analytics.purview.datamap.models.AtlasEntity] + :ivar entity: An instance of an entity - like hive_table, hive_database. + :vartype entity: ~azure.analytics.purview.datamap.models.AtlasEntity + """ + + referred_entities: Optional[Dict[str, "_models.AtlasEntity"]] = rest_field(name="referredEntities") + """The referred entities.""" + entity: Optional["_models.AtlasEntity"] = rest_field() + """An instance of an entity - like hive_table, hive_database.""" + + @overload + def __init__( + self, + *, + referred_entities: Optional[Dict[str, "_models.AtlasEntity"]] = None, + entity: Optional["_models.AtlasEntity"] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasEnumDef(_model_base.Model): # pylint: disable=too-many-instance-attributes + """class that captures details of an enum-type. + + :ivar category: The enum of type category. Known values are: "PRIMITIVE", "OBJECT_ID_TYPE", + "ENUM", "STRUCT", "CLASSIFICATION", "ENTITY", "ARRAY", "MAP", "RELATIONSHIP", and + "TERM_TEMPLATE". + :vartype category: str or ~azure.analytics.purview.datamap.models.TypeCategory + :ivar create_time: The created time of the record. + :vartype create_time: int + :ivar created_by: The user who created the record. + :vartype created_by: str + :ivar date_formatter: The date format. + :vartype date_formatter: ~azure.analytics.purview.datamap.models.DateFormat + :ivar description: The description of the type definition. + :vartype description: str + :ivar guid: The GUID of the type definition. + :vartype guid: str + :ivar name: The name of the type definition. + :vartype name: str + :ivar options: The options for the type definition. + :vartype options: dict[str, str] + :ivar service_type: The service type. + :vartype service_type: str + :ivar type_version: The version of the type. + :vartype type_version: str + :ivar update_time: The update time of the record. + :vartype update_time: int + :ivar updated_by: The user who updated the record. + :vartype updated_by: str + :ivar version: The version of the record. + :vartype version: int + :ivar last_modified_t_s: ETag for concurrency control. + :vartype last_modified_t_s: str + :ivar default_value: The default value. + :vartype default_value: str + :ivar element_defs: An array of enum element definitions. + :vartype element_defs: list[~azure.analytics.purview.datamap.models.AtlasEnumElementDef] + """ + + category: Optional[Union[str, "_models.TypeCategory"]] = rest_field() + """The enum of type category. Known values are: \"PRIMITIVE\", \"OBJECT_ID_TYPE\", \"ENUM\", + \"STRUCT\", \"CLASSIFICATION\", \"ENTITY\", \"ARRAY\", \"MAP\", \"RELATIONSHIP\", and + \"TERM_TEMPLATE\".""" + create_time: Optional[int] = rest_field(name="createTime") + """The created time of the record.""" + created_by: Optional[str] = rest_field(name="createdBy") + """The user who created the record.""" + date_formatter: Optional["_models.DateFormat"] = rest_field(name="dateFormatter") + """The date format.""" + description: Optional[str] = rest_field() + """The description of the type definition.""" + guid: Optional[str] = rest_field() + """The GUID of the type definition.""" + name: Optional[str] = rest_field() + """The name of the type definition.""" + options: Optional[Dict[str, str]] = rest_field() + """The options for the type definition.""" + service_type: Optional[str] = rest_field(name="serviceType") + """The service type.""" + type_version: Optional[str] = rest_field(name="typeVersion") + """The version of the type.""" + update_time: Optional[int] = rest_field(name="updateTime") + """The update time of the record.""" + updated_by: Optional[str] = rest_field(name="updatedBy") + """The user who updated the record.""" + version: Optional[int] = rest_field() + """The version of the record.""" + last_modified_t_s: Optional[str] = rest_field(name="lastModifiedTS") + """ETag for concurrency control.""" + default_value: Optional[str] = rest_field(name="defaultValue") + """The default value.""" + element_defs: Optional[List["_models.AtlasEnumElementDef"]] = rest_field(name="elementDefs") + """An array of enum element definitions.""" + + @overload + def __init__( + self, + *, + category: Optional[Union[str, "_models.TypeCategory"]] = None, + create_time: Optional[int] = None, + created_by: Optional[str] = None, + date_formatter: Optional["_models.DateFormat"] = None, + description: Optional[str] = None, + guid: Optional[str] = None, + name: Optional[str] = None, + options: Optional[Dict[str, str]] = None, + service_type: Optional[str] = None, + type_version: Optional[str] = None, + update_time: Optional[int] = None, + updated_by: Optional[str] = None, + version: Optional[int] = None, + last_modified_t_s: Optional[str] = None, + default_value: Optional[str] = None, + element_defs: Optional[List["_models.AtlasEnumElementDef"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasEnumElementDef(_model_base.Model): + """class that captures details of an enum-element. + + :ivar description: The description of the enum element definition. + :vartype description: str + :ivar ordinal: The ordinal of the enum element definition. + :vartype ordinal: int + :ivar value: The value of the enum element definition. + :vartype value: str + """ + + description: Optional[str] = rest_field() + """The description of the enum element definition.""" + ordinal: Optional[int] = rest_field() + """The ordinal of the enum element definition.""" + value: Optional[str] = rest_field() + """The value of the enum element definition.""" + + @overload + def __init__( + self, + *, + description: Optional[str] = None, + ordinal: Optional[int] = None, + value: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasGlossary(_model_base.Model): # pylint: disable=too-many-instance-attributes + """The glossary object. + + :ivar guid: The GUID of the object. + :vartype guid: str + :ivar classifications: An array of classifications. + :vartype classifications: list[~azure.analytics.purview.datamap.models.AtlasClassification] + :ivar long_description: The long version description. + :vartype long_description: str + :ivar name: The name of the glossary object. + :vartype name: str + :ivar qualified_name: The qualified name of the glossary object. + :vartype qualified_name: str + :ivar short_description: The short version of description. + :vartype short_description: str + :ivar last_modified_t_s: ETag for concurrency control. + :vartype last_modified_t_s: str + :ivar create_time: The created time of the record. + :vartype create_time: int + :ivar created_by: The user who created the record. + :vartype created_by: str + :ivar update_time: The update time of the record. + :vartype update_time: int + :ivar updated_by: The user who updated the record. + :vartype updated_by: str + :ivar categories: An array of categories. + :vartype categories: list[~azure.analytics.purview.datamap.models.AtlasRelatedCategoryHeader] + :ivar language: The language of the glossary. + :vartype language: str + :ivar terms: An array of related term headers. + :vartype terms: list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader] + :ivar usage: The usage of the glossary. + :vartype usage: str + """ + + guid: Optional[str] = rest_field() + """The GUID of the object.""" + classifications: Optional[List["_models.AtlasClassification"]] = rest_field() + """An array of classifications.""" + long_description: Optional[str] = rest_field(name="longDescription") + """The long version description.""" + name: Optional[str] = rest_field() + """The name of the glossary object.""" + qualified_name: Optional[str] = rest_field(name="qualifiedName") + """The qualified name of the glossary object.""" + short_description: Optional[str] = rest_field(name="shortDescription") + """The short version of description.""" + last_modified_t_s: Optional[str] = rest_field(name="lastModifiedTS") + """ETag for concurrency control.""" + create_time: Optional[int] = rest_field(name="createTime") + """The created time of the record.""" + created_by: Optional[str] = rest_field(name="createdBy") + """The user who created the record.""" + update_time: Optional[int] = rest_field(name="updateTime") + """The update time of the record.""" + updated_by: Optional[str] = rest_field(name="updatedBy") + """The user who updated the record.""" + categories: Optional[List["_models.AtlasRelatedCategoryHeader"]] = rest_field() + """An array of categories.""" + language: Optional[str] = rest_field() + """The language of the glossary.""" + terms: Optional[List["_models.AtlasRelatedTermHeader"]] = rest_field() + """An array of related term headers.""" + usage: Optional[str] = rest_field() + """The usage of the glossary.""" + + @overload + def __init__( + self, + *, + guid: Optional[str] = None, + classifications: Optional[List["_models.AtlasClassification"]] = None, + long_description: Optional[str] = None, + name: Optional[str] = None, + qualified_name: Optional[str] = None, + short_description: Optional[str] = None, + last_modified_t_s: Optional[str] = None, + create_time: Optional[int] = None, + created_by: Optional[str] = None, + update_time: Optional[int] = None, + updated_by: Optional[str] = None, + categories: Optional[List["_models.AtlasRelatedCategoryHeader"]] = None, + language: Optional[str] = None, + terms: Optional[List["_models.AtlasRelatedTermHeader"]] = None, + usage: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasGlossaryCategory(_model_base.Model): # pylint: disable=too-many-instance-attributes + """The glossary category. + + :ivar guid: The GUID of the object. + :vartype guid: str + :ivar classifications: An array of classifications. + :vartype classifications: list[~azure.analytics.purview.datamap.models.AtlasClassification] + :ivar long_description: The long version description. + :vartype long_description: str + :ivar name: The name of the glossary object. + :vartype name: str + :ivar qualified_name: The qualified name of the glossary object. + :vartype qualified_name: str + :ivar short_description: The short version of description. + :vartype short_description: str + :ivar last_modified_t_s: ETag for concurrency control. + :vartype last_modified_t_s: str + :ivar create_time: The created time of the record. + :vartype create_time: int + :ivar created_by: The user who created the record. + :vartype created_by: str + :ivar update_time: The update time of the record. + :vartype update_time: int + :ivar updated_by: The user who updated the record. + :vartype updated_by: str + :ivar anchor: The glossary header with basic information. + :vartype anchor: ~azure.analytics.purview.datamap.models.AtlasGlossaryHeader + :ivar children_categories: An array of children categories. + :vartype children_categories: + list[~azure.analytics.purview.datamap.models.AtlasRelatedCategoryHeader] + :ivar parent_category: The header of the related category. + :vartype parent_category: ~azure.analytics.purview.datamap.models.AtlasRelatedCategoryHeader + :ivar terms: An array of related term headers. + :vartype terms: list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader] + """ + + guid: Optional[str] = rest_field() + """The GUID of the object.""" + classifications: Optional[List["_models.AtlasClassification"]] = rest_field() + """An array of classifications.""" + long_description: Optional[str] = rest_field(name="longDescription") + """The long version description.""" + name: Optional[str] = rest_field() + """The name of the glossary object.""" + qualified_name: Optional[str] = rest_field(name="qualifiedName") + """The qualified name of the glossary object.""" + short_description: Optional[str] = rest_field(name="shortDescription") + """The short version of description.""" + last_modified_t_s: Optional[str] = rest_field(name="lastModifiedTS") + """ETag for concurrency control.""" + create_time: Optional[int] = rest_field(name="createTime") + """The created time of the record.""" + created_by: Optional[str] = rest_field(name="createdBy") + """The user who created the record.""" + update_time: Optional[int] = rest_field(name="updateTime") + """The update time of the record.""" + updated_by: Optional[str] = rest_field(name="updatedBy") + """The user who updated the record.""" + anchor: Optional["_models.AtlasGlossaryHeader"] = rest_field() + """The glossary header with basic information.""" + children_categories: Optional[List["_models.AtlasRelatedCategoryHeader"]] = rest_field(name="childrenCategories") + """An array of children categories.""" + parent_category: Optional["_models.AtlasRelatedCategoryHeader"] = rest_field(name="parentCategory") + """The header of the related category.""" + terms: Optional[List["_models.AtlasRelatedTermHeader"]] = rest_field() + """An array of related term headers.""" + + @overload + def __init__( + self, + *, + guid: Optional[str] = None, + classifications: Optional[List["_models.AtlasClassification"]] = None, + long_description: Optional[str] = None, + name: Optional[str] = None, + qualified_name: Optional[str] = None, + short_description: Optional[str] = None, + last_modified_t_s: Optional[str] = None, + create_time: Optional[int] = None, + created_by: Optional[str] = None, + update_time: Optional[int] = None, + updated_by: Optional[str] = None, + anchor: Optional["_models.AtlasGlossaryHeader"] = None, + children_categories: Optional[List["_models.AtlasRelatedCategoryHeader"]] = None, + parent_category: Optional["_models.AtlasRelatedCategoryHeader"] = None, + terms: Optional[List["_models.AtlasRelatedTermHeader"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasGlossaryExtInfo(_model_base.Model): # pylint: disable=too-many-instance-attributes + """The extended information of glossary. + + :ivar guid: The GUID of the object. + :vartype guid: str + :ivar classifications: An array of classifications. + :vartype classifications: list[~azure.analytics.purview.datamap.models.AtlasClassification] + :ivar long_description: The long version description. + :vartype long_description: str + :ivar name: The name of the glossary object. + :vartype name: str + :ivar qualified_name: The qualified name of the glossary object. + :vartype qualified_name: str + :ivar short_description: The short version of description. + :vartype short_description: str + :ivar last_modified_t_s: ETag for concurrency control. + :vartype last_modified_t_s: str + :ivar create_time: The created time of the record. + :vartype create_time: int + :ivar created_by: The user who created the record. + :vartype created_by: str + :ivar update_time: The update time of the record. + :vartype update_time: int + :ivar updated_by: The user who updated the record. + :vartype updated_by: str + :ivar categories: An array of categories. + :vartype categories: list[~azure.analytics.purview.datamap.models.AtlasRelatedCategoryHeader] + :ivar language: The language of the glossary. + :vartype language: str + :ivar terms: An array of related term headers. + :vartype terms: list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader] + :ivar usage: The usage of the glossary. + :vartype usage: str + :ivar category_info: The glossary category information. + :vartype category_info: dict[str, + ~azure.analytics.purview.datamap.models.AtlasGlossaryCategory] + :ivar term_info: The glossary term information. + :vartype term_info: dict[str, ~azure.analytics.purview.datamap.models.AtlasGlossaryTerm] + """ + + guid: Optional[str] = rest_field() + """The GUID of the object.""" + classifications: Optional[List["_models.AtlasClassification"]] = rest_field() + """An array of classifications.""" + long_description: Optional[str] = rest_field(name="longDescription") + """The long version description.""" + name: Optional[str] = rest_field() + """The name of the glossary object.""" + qualified_name: Optional[str] = rest_field(name="qualifiedName") + """The qualified name of the glossary object.""" + short_description: Optional[str] = rest_field(name="shortDescription") + """The short version of description.""" + last_modified_t_s: Optional[str] = rest_field(name="lastModifiedTS") + """ETag for concurrency control.""" + create_time: Optional[int] = rest_field(name="createTime") + """The created time of the record.""" + created_by: Optional[str] = rest_field(name="createdBy") + """The user who created the record.""" + update_time: Optional[int] = rest_field(name="updateTime") + """The update time of the record.""" + updated_by: Optional[str] = rest_field(name="updatedBy") + """The user who updated the record.""" + categories: Optional[List["_models.AtlasRelatedCategoryHeader"]] = rest_field() + """An array of categories.""" + language: Optional[str] = rest_field() + """The language of the glossary.""" + terms: Optional[List["_models.AtlasRelatedTermHeader"]] = rest_field() + """An array of related term headers.""" + usage: Optional[str] = rest_field() + """The usage of the glossary.""" + category_info: Optional[Dict[str, "_models.AtlasGlossaryCategory"]] = rest_field(name="categoryInfo") + """The glossary category information.""" + term_info: Optional[Dict[str, "_models.AtlasGlossaryTerm"]] = rest_field(name="termInfo") + """The glossary term information.""" + + @overload + def __init__( + self, + *, + guid: Optional[str] = None, + classifications: Optional[List["_models.AtlasClassification"]] = None, + long_description: Optional[str] = None, + name: Optional[str] = None, + qualified_name: Optional[str] = None, + short_description: Optional[str] = None, + last_modified_t_s: Optional[str] = None, + create_time: Optional[int] = None, + created_by: Optional[str] = None, + update_time: Optional[int] = None, + updated_by: Optional[str] = None, + categories: Optional[List["_models.AtlasRelatedCategoryHeader"]] = None, + language: Optional[str] = None, + terms: Optional[List["_models.AtlasRelatedTermHeader"]] = None, + usage: Optional[str] = None, + category_info: Optional[Dict[str, "_models.AtlasGlossaryCategory"]] = None, + term_info: Optional[Dict[str, "_models.AtlasGlossaryTerm"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasGlossaryHeader(_model_base.Model): + """The glossary header with basic information. + + :ivar display_text: The display text. + :vartype display_text: str + :ivar glossary_guid: The GUID of the glossary. + :vartype glossary_guid: str + :ivar relation_guid: The GUID of the relationship. + :vartype relation_guid: str + """ + + display_text: Optional[str] = rest_field(name="displayText") + """The display text.""" + glossary_guid: Optional[str] = rest_field(name="glossaryGuid") + """The GUID of the glossary.""" + relation_guid: Optional[str] = rest_field(name="relationGuid") + """The GUID of the relationship.""" + + @overload + def __init__( + self, + *, + display_text: Optional[str] = None, + glossary_guid: Optional[str] = None, + relation_guid: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasGlossaryTerm(_model_base.Model): # pylint: disable=too-many-instance-attributes + """The glossary term. + + :ivar guid: The GUID of the object. + :vartype guid: str + :ivar classifications: An array of classifications. + :vartype classifications: list[~azure.analytics.purview.datamap.models.AtlasClassification] + :ivar long_description: The long version description. + :vartype long_description: str + :ivar name: The name of the glossary object. + :vartype name: str + :ivar qualified_name: The qualified name of the glossary object. + :vartype qualified_name: str + :ivar short_description: The short version of description. + :vartype short_description: str + :ivar last_modified_t_s: ETag for concurrency control. + :vartype last_modified_t_s: str + :ivar create_time: The created time of the record. + :vartype create_time: int + :ivar created_by: The user who created the record. + :vartype created_by: str + :ivar update_time: The update time of the record. + :vartype update_time: int + :ivar updated_by: The user who updated the record. + :vartype updated_by: str + :ivar abbreviation: The abbreviation of the term. + :vartype abbreviation: str + :ivar template_name: The name of the template. + :vartype template_name: list[any] + :ivar anchor: The glossary header with basic information. + :vartype anchor: ~azure.analytics.purview.datamap.models.AtlasGlossaryHeader + :ivar antonyms: An array of related term headers as antonyms. + :vartype antonyms: list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader] + :ivar status: Status of the AtlasGlossaryTerm. Known values are: "Draft", "Approved", "Alert", + and "Expired". + :vartype status: str or ~azure.analytics.purview.datamap.models.TermStatus + :ivar nick_name: The nick name of the term. + :vartype nick_name: str + :ivar hierarchy_info: The hierarchy information of the term. + :vartype hierarchy_info: list[~azure.analytics.purview.datamap.models.PurviewObjectId] + :ivar resources: An array of resource link for term. + :vartype resources: list[~azure.analytics.purview.datamap.models.ResourceLink] + :ivar contacts: The dictionary of contacts for terms. Key could be Expert or Steward. + :vartype contacts: dict[str, list[~azure.analytics.purview.datamap.models.ContactBasic]] + :ivar attributes: The custom attributes of the term, which is map>. + The + key of the first layer map is term template name. + :vartype attributes: dict[str, dict[str, any]] + :ivar assigned_entities: An array of related object IDs. + :vartype assigned_entities: list[~azure.analytics.purview.datamap.models.AtlasRelatedObjectId] + :ivar categories: An array of term categorization headers. + :vartype categories: + list[~azure.analytics.purview.datamap.models.AtlasTermCategorizationHeader] + :ivar classifies: An array of related term headers. + :vartype classifies: list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader] + :ivar examples: An array of examples. + :vartype examples: list[str] + :ivar is_a: An array of related term headers indicating the is-a relationship. + :vartype is_a: list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader] + :ivar preferred_terms: An array of preferred related term headers. + :vartype preferred_terms: list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader] + :ivar preferred_to_terms: An array of related term headers that are preferred to. + :vartype preferred_to_terms: + list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader] + :ivar replaced_by: An array of related term headers that are replaced by. + :vartype replaced_by: list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader] + :ivar replacement_terms: An array of related term headers for replacement. + :vartype replacement_terms: + list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader] + :ivar see_also: An array of related term headers for see also. + :vartype see_also: list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader] + :ivar synonyms: An array of related term headers as synonyms. + :vartype synonyms: list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader] + :ivar translated_terms: An array of translated related term headers. + :vartype translated_terms: list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader] + :ivar translation_terms: An array of related term headers for translation. + :vartype translation_terms: + list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader] + :ivar usage: The usage of the term. + :vartype usage: str + :ivar valid_values: An array of related term headers as valid values. + :vartype valid_values: list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader] + :ivar valid_values_for: An array of related term headers as valid values for other records. + :vartype valid_values_for: list[~azure.analytics.purview.datamap.models.AtlasRelatedTermHeader] + """ + + guid: Optional[str] = rest_field() + """The GUID of the object.""" + classifications: Optional[List["_models.AtlasClassification"]] = rest_field() + """An array of classifications.""" + long_description: Optional[str] = rest_field(name="longDescription") + """The long version description.""" + name: Optional[str] = rest_field() + """The name of the glossary object.""" + qualified_name: Optional[str] = rest_field(name="qualifiedName") + """The qualified name of the glossary object.""" + short_description: Optional[str] = rest_field(name="shortDescription") + """The short version of description.""" + last_modified_t_s: Optional[str] = rest_field(name="lastModifiedTS") + """ETag for concurrency control.""" + create_time: Optional[int] = rest_field(name="createTime") + """The created time of the record.""" + created_by: Optional[str] = rest_field(name="createdBy") + """The user who created the record.""" + update_time: Optional[int] = rest_field(name="updateTime") + """The update time of the record.""" + updated_by: Optional[str] = rest_field(name="updatedBy") + """The user who updated the record.""" + abbreviation: Optional[str] = rest_field() + """The abbreviation of the term.""" + template_name: Optional[List[Any]] = rest_field(name="templateName") + """The name of the template.""" + anchor: Optional["_models.AtlasGlossaryHeader"] = rest_field() + """The glossary header with basic information.""" + antonyms: Optional[List["_models.AtlasRelatedTermHeader"]] = rest_field() + """An array of related term headers as antonyms.""" + status: Optional[Union[str, "_models.TermStatus"]] = rest_field() + """Status of the AtlasGlossaryTerm. Known values are: \"Draft\", \"Approved\", \"Alert\", and + \"Expired\".""" + nick_name: Optional[str] = rest_field(name="nickName") + """The nick name of the term.""" + hierarchy_info: Optional[List["_models.PurviewObjectId"]] = rest_field(name="hierarchyInfo") + """The hierarchy information of the term.""" + resources: Optional[List["_models.ResourceLink"]] = rest_field() + """An array of resource link for term.""" + contacts: Optional[Dict[str, List["_models.ContactBasic"]]] = rest_field() + """The dictionary of contacts for terms. Key could be Expert or Steward.""" + attributes: Optional[Dict[str, Dict[str, Any]]] = rest_field() + """The custom attributes of the term, which is map>. + The + key of the first layer map is term template name.""" + assigned_entities: Optional[List["_models.AtlasRelatedObjectId"]] = rest_field(name="assignedEntities") + """An array of related object IDs.""" + categories: Optional[List["_models.AtlasTermCategorizationHeader"]] = rest_field() + """An array of term categorization headers.""" + classifies: Optional[List["_models.AtlasRelatedTermHeader"]] = rest_field() + """An array of related term headers.""" + examples: Optional[List[str]] = rest_field() + """An array of examples.""" + is_a: Optional[List["_models.AtlasRelatedTermHeader"]] = rest_field(name="isA") + """An array of related term headers indicating the is-a relationship.""" + preferred_terms: Optional[List["_models.AtlasRelatedTermHeader"]] = rest_field(name="preferredTerms") + """An array of preferred related term headers.""" + preferred_to_terms: Optional[List["_models.AtlasRelatedTermHeader"]] = rest_field(name="preferredToTerms") + """An array of related term headers that are preferred to.""" + replaced_by: Optional[List["_models.AtlasRelatedTermHeader"]] = rest_field(name="replacedBy") + """An array of related term headers that are replaced by.""" + replacement_terms: Optional[List["_models.AtlasRelatedTermHeader"]] = rest_field(name="replacementTerms") + """An array of related term headers for replacement.""" + see_also: Optional[List["_models.AtlasRelatedTermHeader"]] = rest_field(name="seeAlso") + """An array of related term headers for see also.""" + synonyms: Optional[List["_models.AtlasRelatedTermHeader"]] = rest_field() + """An array of related term headers as synonyms.""" + translated_terms: Optional[List["_models.AtlasRelatedTermHeader"]] = rest_field(name="translatedTerms") + """An array of translated related term headers.""" + translation_terms: Optional[List["_models.AtlasRelatedTermHeader"]] = rest_field(name="translationTerms") + """An array of related term headers for translation.""" + usage: Optional[str] = rest_field() + """The usage of the term.""" + valid_values: Optional[List["_models.AtlasRelatedTermHeader"]] = rest_field(name="validValues") + """An array of related term headers as valid values.""" + valid_values_for: Optional[List["_models.AtlasRelatedTermHeader"]] = rest_field(name="validValuesFor") + """An array of related term headers as valid values for other records.""" + + @overload + def __init__( + self, + *, + guid: Optional[str] = None, + classifications: Optional[List["_models.AtlasClassification"]] = None, + long_description: Optional[str] = None, + name: Optional[str] = None, + qualified_name: Optional[str] = None, + short_description: Optional[str] = None, + last_modified_t_s: Optional[str] = None, + create_time: Optional[int] = None, + created_by: Optional[str] = None, + update_time: Optional[int] = None, + updated_by: Optional[str] = None, + abbreviation: Optional[str] = None, + template_name: Optional[List[Any]] = None, + anchor: Optional["_models.AtlasGlossaryHeader"] = None, + antonyms: Optional[List["_models.AtlasRelatedTermHeader"]] = None, + status: Optional[Union[str, "_models.TermStatus"]] = None, + nick_name: Optional[str] = None, + hierarchy_info: Optional[List["_models.PurviewObjectId"]] = None, + resources: Optional[List["_models.ResourceLink"]] = None, + contacts: Optional[Dict[str, List["_models.ContactBasic"]]] = None, + attributes: Optional[Dict[str, Dict[str, Any]]] = None, + assigned_entities: Optional[List["_models.AtlasRelatedObjectId"]] = None, + categories: Optional[List["_models.AtlasTermCategorizationHeader"]] = None, + classifies: Optional[List["_models.AtlasRelatedTermHeader"]] = None, + examples: Optional[List[str]] = None, + is_a: Optional[List["_models.AtlasRelatedTermHeader"]] = None, + preferred_terms: Optional[List["_models.AtlasRelatedTermHeader"]] = None, + preferred_to_terms: Optional[List["_models.AtlasRelatedTermHeader"]] = None, + replaced_by: Optional[List["_models.AtlasRelatedTermHeader"]] = None, + replacement_terms: Optional[List["_models.AtlasRelatedTermHeader"]] = None, + see_also: Optional[List["_models.AtlasRelatedTermHeader"]] = None, + synonyms: Optional[List["_models.AtlasRelatedTermHeader"]] = None, + translated_terms: Optional[List["_models.AtlasRelatedTermHeader"]] = None, + translation_terms: Optional[List["_models.AtlasRelatedTermHeader"]] = None, + usage: Optional[str] = None, + valid_values: Optional[List["_models.AtlasRelatedTermHeader"]] = None, + valid_values_for: Optional[List["_models.AtlasRelatedTermHeader"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasLineageInfo(_model_base.Model): + """The lineage information. + + :ivar base_entity_guid: The GUID of the base entity. + :vartype base_entity_guid: str + :ivar guid_entity_map: The GUID entity map. + :vartype guid_entity_map: dict[str, ~azure.analytics.purview.datamap.models.AtlasEntityHeader] + :ivar width_counts: The entity count in specific direction. + :vartype width_counts: dict[str, dict[str, any]] + :ivar lineage_depth: The depth of lineage. + :vartype lineage_depth: int + :ivar lineage_width: The width of lineage. + :vartype lineage_width: int + :ivar children_count: The number of children node. + :vartype children_count: int + :ivar lineage_direction: The enum of lineage direction. Known values are: "INPUT", "OUTPUT", + and "BOTH". + :vartype lineage_direction: str or ~azure.analytics.purview.datamap.models.LineageDirection + :ivar parent_relations: An array of parentRelations relations. + :vartype parent_relations: list[~azure.analytics.purview.datamap.models.ParentRelation] + :ivar relations: An array of lineage relations. + :vartype relations: list[~azure.analytics.purview.datamap.models.LineageRelation] + """ + + base_entity_guid: Optional[str] = rest_field(name="baseEntityGuid") + """The GUID of the base entity.""" + guid_entity_map: Optional[Dict[str, "_models.AtlasEntityHeader"]] = rest_field(name="guidEntityMap") + """The GUID entity map.""" + width_counts: Optional[Dict[str, Dict[str, Any]]] = rest_field(name="widthCounts") + """The entity count in specific direction.""" + lineage_depth: Optional[int] = rest_field(name="lineageDepth") + """The depth of lineage.""" + lineage_width: Optional[int] = rest_field(name="lineageWidth") + """The width of lineage.""" + children_count: Optional[int] = rest_field(name="childrenCount") + """The number of children node.""" + lineage_direction: Optional[Union[str, "_models.LineageDirection"]] = rest_field(name="lineageDirection") + """The enum of lineage direction. Known values are: \"INPUT\", \"OUTPUT\", and \"BOTH\".""" + parent_relations: Optional[List["_models.ParentRelation"]] = rest_field(name="parentRelations") + """An array of parentRelations relations.""" + relations: Optional[List["_models.LineageRelation"]] = rest_field() + """An array of lineage relations.""" + + @overload + def __init__( + self, + *, + base_entity_guid: Optional[str] = None, + guid_entity_map: Optional[Dict[str, "_models.AtlasEntityHeader"]] = None, + width_counts: Optional[Dict[str, Dict[str, Any]]] = None, + lineage_depth: Optional[int] = None, + lineage_width: Optional[int] = None, + children_count: Optional[int] = None, + lineage_direction: Optional[Union[str, "_models.LineageDirection"]] = None, + parent_relations: Optional[List["_models.ParentRelation"]] = None, + relations: Optional[List["_models.LineageRelation"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasObjectId(_model_base.Model): + """Reference to an object-instance of a type - like entity. + + :ivar guid: The GUID of the object. + :vartype guid: str + :ivar type_name: The name of the type. + :vartype type_name: str + :ivar unique_attributes: The unique attributes of the object. + :vartype unique_attributes: dict[str, any] + """ + + guid: Optional[str] = rest_field() + """The GUID of the object.""" + type_name: Optional[str] = rest_field(name="typeName") + """The name of the type.""" + unique_attributes: Optional[Dict[str, Any]] = rest_field(name="uniqueAttributes") + """The unique attributes of the object.""" + + @overload + def __init__( + self, + *, + guid: Optional[str] = None, + type_name: Optional[str] = None, + unique_attributes: Optional[Dict[str, Any]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasRelatedCategoryHeader(_model_base.Model): + """The header of the related category. + + :ivar category_guid: The GUID of the category. + :vartype category_guid: str + :ivar description: The description of the category header. + :vartype description: str + :ivar display_text: The display text. + :vartype display_text: str + :ivar parent_category_guid: The GUID of the parent category. + :vartype parent_category_guid: str + :ivar relation_guid: The GUID of the relationship. + :vartype relation_guid: str + """ + + category_guid: Optional[str] = rest_field(name="categoryGuid") + """The GUID of the category.""" + description: Optional[str] = rest_field() + """The description of the category header.""" + display_text: Optional[str] = rest_field(name="displayText") + """The display text.""" + parent_category_guid: Optional[str] = rest_field(name="parentCategoryGuid") + """The GUID of the parent category.""" + relation_guid: Optional[str] = rest_field(name="relationGuid") + """The GUID of the relationship.""" + + @overload + def __init__( + self, + *, + category_guid: Optional[str] = None, + description: Optional[str] = None, + display_text: Optional[str] = None, + parent_category_guid: Optional[str] = None, + relation_guid: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasRelatedObjectId(_model_base.Model): + """Reference to an object-instance of AtlasEntity type used in relationship + attribute values. + + :ivar guid: The GUID of the object. + :vartype guid: str + :ivar type_name: The name of the type. + :vartype type_name: str + :ivar unique_attributes: The unique attributes of the object. + :vartype unique_attributes: dict[str, any] + :ivar display_text: The display text. + :vartype display_text: str + :ivar entity_status: Status of the entity - can be active or deleted. Deleted entities are not + removed. Known values are: "ACTIVE" and "DELETED". + :vartype entity_status: str or ~azure.analytics.purview.datamap.models.Status + :ivar relationship_type: Relationship type. + :vartype relationship_type: str + :ivar relationship_attributes: Captures details of struct contents. Not instantiated directly, + used only via + AtlasEntity, AtlasClassification. + :vartype relationship_attributes: ~azure.analytics.purview.datamap.models.AtlasStruct + :ivar relationship_guid: The GUID of the relationship. + :vartype relationship_guid: str + :ivar relationship_status: The enum of relationship status. Known values are: "ACTIVE" and + "DELETED". + :vartype relationship_status: str or + ~azure.analytics.purview.datamap.models.StatusAtlasRelationship + """ + + guid: Optional[str] = rest_field() + """The GUID of the object.""" + type_name: Optional[str] = rest_field(name="typeName") + """The name of the type.""" + unique_attributes: Optional[Dict[str, Any]] = rest_field(name="uniqueAttributes") + """The unique attributes of the object.""" + display_text: Optional[str] = rest_field(name="displayText") + """The display text.""" + entity_status: Optional[Union[str, "_models.Status"]] = rest_field(name="entityStatus") + """Status of the entity - can be active or deleted. Deleted entities are not + removed. Known values are: \"ACTIVE\" and \"DELETED\".""" + relationship_type: Optional[str] = rest_field(name="relationshipType") + """Relationship type.""" + relationship_attributes: Optional["_models.AtlasStruct"] = rest_field(name="relationshipAttributes") + """Captures details of struct contents. Not instantiated directly, used only via + AtlasEntity, AtlasClassification.""" + relationship_guid: Optional[str] = rest_field(name="relationshipGuid") + """The GUID of the relationship.""" + relationship_status: Optional[Union[str, "_models.StatusAtlasRelationship"]] = rest_field(name="relationshipStatus") + """The enum of relationship status. Known values are: \"ACTIVE\" and \"DELETED\".""" + + @overload + def __init__( + self, + *, + guid: Optional[str] = None, + type_name: Optional[str] = None, + unique_attributes: Optional[Dict[str, Any]] = None, + display_text: Optional[str] = None, + entity_status: Optional[Union[str, "_models.Status"]] = None, + relationship_type: Optional[str] = None, + relationship_attributes: Optional["_models.AtlasStruct"] = None, + relationship_guid: Optional[str] = None, + relationship_status: Optional[Union[str, "_models.StatusAtlasRelationship"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasRelatedTermHeader(_model_base.Model): + """The header of the related term. + + :ivar description: The description of the related term. + :vartype description: str + :ivar display_text: The display text. + :vartype display_text: str + :ivar expression: The expression of the term. + :vartype expression: str + :ivar relation_guid: The GUID of the relationship. + :vartype relation_guid: str + :ivar status: The status of term relationship. Known values are: "DRAFT", "ACTIVE", + "DEPRECATED", "OBSOLETE", and "OTHER". + :vartype status: str or ~azure.analytics.purview.datamap.models.AtlasTermRelationshipStatus + :ivar steward: The steward of the term. + :vartype steward: str + :ivar term_guid: The GUID of the term. + :vartype term_guid: str + """ + + description: Optional[str] = rest_field() + """The description of the related term.""" + display_text: Optional[str] = rest_field(name="displayText") + """The display text.""" + expression: Optional[str] = rest_field() + """The expression of the term.""" + relation_guid: Optional[str] = rest_field(name="relationGuid") + """The GUID of the relationship.""" + status: Optional[Union[str, "_models.AtlasTermRelationshipStatus"]] = rest_field() + """The status of term relationship. Known values are: \"DRAFT\", \"ACTIVE\", \"DEPRECATED\", + \"OBSOLETE\", and \"OTHER\".""" + steward: Optional[str] = rest_field() + """The steward of the term.""" + term_guid: Optional[str] = rest_field(name="termGuid") + """The GUID of the term.""" + + @overload + def __init__( + self, + *, + description: Optional[str] = None, + display_text: Optional[str] = None, + expression: Optional[str] = None, + relation_guid: Optional[str] = None, + status: Optional[Union[str, "_models.AtlasTermRelationshipStatus"]] = None, + steward: Optional[str] = None, + term_guid: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasRelationship(_model_base.Model): # pylint: disable=too-many-instance-attributes + """Atlas relationship instance. + + :ivar attributes: The attributes of the struct. + :vartype attributes: dict[str, any] + :ivar type_name: The name of the type. + :vartype type_name: str + :ivar last_modified_t_s: ETag for concurrency control. + :vartype last_modified_t_s: str + :ivar create_time: The created time of the record. + :vartype create_time: int + :ivar created_by: The user who created the record. + :vartype created_by: str + :ivar end1: Reference to an object-instance of a type - like entity. + :vartype end1: ~azure.analytics.purview.datamap.models.AtlasObjectId + :ivar end2: Reference to an object-instance of a type - like entity. + :vartype end2: ~azure.analytics.purview.datamap.models.AtlasObjectId + :ivar guid: The GUID of the relationship. + :vartype guid: str + :ivar home_id: The home ID of the relationship. + :vartype home_id: str + :ivar label: The label of the relationship. + :vartype label: str + :ivar provenance_type: Used to record the provenance of an instance of an entity or + relationship. + :vartype provenance_type: int + :ivar status: The enum of relationship status. Known values are: "ACTIVE" and "DELETED". + :vartype status: str or ~azure.analytics.purview.datamap.models.StatusAtlasRelationship + :ivar update_time: The update time of the record. + :vartype update_time: int + :ivar updated_by: The user who updated the record. + :vartype updated_by: str + :ivar version: The version of the relationship. + :vartype version: int + """ + + attributes: Optional[Dict[str, Any]] = rest_field() + """The attributes of the struct.""" + type_name: Optional[str] = rest_field(name="typeName") + """The name of the type.""" + last_modified_t_s: Optional[str] = rest_field(name="lastModifiedTS") + """ETag for concurrency control.""" + create_time: Optional[int] = rest_field(name="createTime") + """The created time of the record.""" + created_by: Optional[str] = rest_field(name="createdBy") + """The user who created the record.""" + end1: Optional["_models.AtlasObjectId"] = rest_field() + """Reference to an object-instance of a type - like entity.""" + end2: Optional["_models.AtlasObjectId"] = rest_field() + """Reference to an object-instance of a type - like entity.""" + guid: Optional[str] = rest_field() + """The GUID of the relationship.""" + home_id: Optional[str] = rest_field(name="homeId") + """The home ID of the relationship.""" + label: Optional[str] = rest_field() + """The label of the relationship.""" + provenance_type: Optional[int] = rest_field(name="provenanceType") + """Used to record the provenance of an instance of an entity or relationship.""" + status: Optional[Union[str, "_models.StatusAtlasRelationship"]] = rest_field() + """The enum of relationship status. Known values are: \"ACTIVE\" and \"DELETED\".""" + update_time: Optional[int] = rest_field(name="updateTime") + """The update time of the record.""" + updated_by: Optional[str] = rest_field(name="updatedBy") + """The user who updated the record.""" + version: Optional[int] = rest_field() + """The version of the relationship.""" + + @overload + def __init__( + self, + *, + attributes: Optional[Dict[str, Any]] = None, + type_name: Optional[str] = None, + last_modified_t_s: Optional[str] = None, + create_time: Optional[int] = None, + created_by: Optional[str] = None, + end1: Optional["_models.AtlasObjectId"] = None, + end2: Optional["_models.AtlasObjectId"] = None, + guid: Optional[str] = None, + home_id: Optional[str] = None, + label: Optional[str] = None, + provenance_type: Optional[int] = None, + status: Optional[Union[str, "_models.StatusAtlasRelationship"]] = None, + update_time: Optional[int] = None, + updated_by: Optional[str] = None, + version: Optional[int] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasRelationshipAttributeDef(_model_base.Model): # pylint: disable=too-many-instance-attributes + """The relationshipEndDef represents an end of the relationship. The end of the + relationship is defined by a type, an + attribute name, cardinality and whether + it is the container end of the relationship. + + :ivar cardinality: single-valued attribute or multi-valued attribute. Known values are: + "SINGLE", "LIST", and "SET". + :vartype cardinality: str or ~azure.analytics.purview.datamap.models.Cardinality + :ivar constraints: An array of constraints. + :vartype constraints: list[~azure.analytics.purview.datamap.models.AtlasConstraintDef] + :ivar default_value: The default value of the attribute. + :vartype default_value: str + :ivar description: The description of the attribute. + :vartype description: str + :ivar include_in_notification: Determines if it is included in notification. + :vartype include_in_notification: bool + :ivar is_indexable: Determines if it is indexable. + :vartype is_indexable: bool + :ivar is_optional: Determines if it is optional. + :vartype is_optional: bool + :ivar is_unique: Determines if it unique. + :vartype is_unique: bool + :ivar name: The name of the attribute. + :vartype name: str + :ivar options: The options for the attribute. + :vartype options: dict[str, str] + :ivar type_name: The name of the type. + :vartype type_name: str + :ivar values_max_count: The maximum count of the values. + :vartype values_max_count: int + :ivar values_min_count: The minimum count of the values. + :vartype values_min_count: int + :ivar is_legacy_attribute: Determines if it is a legacy attribute. + :vartype is_legacy_attribute: bool + :ivar relationship_type_name: The name of the relationship type. + :vartype relationship_type_name: str + """ + + cardinality: Optional[Union[str, "_models.Cardinality"]] = rest_field() + """single-valued attribute or multi-valued attribute. Known values are: \"SINGLE\", \"LIST\", and + \"SET\".""" + constraints: Optional[List["_models.AtlasConstraintDef"]] = rest_field() + """An array of constraints.""" + default_value: Optional[str] = rest_field(name="defaultValue") + """The default value of the attribute.""" + description: Optional[str] = rest_field() + """The description of the attribute.""" + include_in_notification: Optional[bool] = rest_field(name="includeInNotification") + """Determines if it is included in notification.""" + is_indexable: Optional[bool] = rest_field(name="isIndexable") + """Determines if it is indexable.""" + is_optional: Optional[bool] = rest_field(name="isOptional") + """Determines if it is optional.""" + is_unique: Optional[bool] = rest_field(name="isUnique") + """Determines if it unique.""" + name: Optional[str] = rest_field() + """The name of the attribute.""" + options: Optional[Dict[str, str]] = rest_field() + """The options for the attribute.""" + type_name: Optional[str] = rest_field(name="typeName") + """The name of the type.""" + values_max_count: Optional[int] = rest_field(name="valuesMaxCount") + """The maximum count of the values.""" + values_min_count: Optional[int] = rest_field(name="valuesMinCount") + """The minimum count of the values.""" + is_legacy_attribute: Optional[bool] = rest_field(name="isLegacyAttribute") + """Determines if it is a legacy attribute.""" + relationship_type_name: Optional[str] = rest_field(name="relationshipTypeName") + """The name of the relationship type.""" + + @overload + def __init__( + self, + *, + cardinality: Optional[Union[str, "_models.Cardinality"]] = None, + constraints: Optional[List["_models.AtlasConstraintDef"]] = None, + default_value: Optional[str] = None, + description: Optional[str] = None, + include_in_notification: Optional[bool] = None, + is_indexable: Optional[bool] = None, + is_optional: Optional[bool] = None, + is_unique: Optional[bool] = None, + name: Optional[str] = None, + options: Optional[Dict[str, str]] = None, + type_name: Optional[str] = None, + values_max_count: Optional[int] = None, + values_min_count: Optional[int] = None, + is_legacy_attribute: Optional[bool] = None, + relationship_type_name: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasRelationshipDef(_model_base.Model): # pylint: disable=too-many-instance-attributes + """AtlasRelationshipDef is a TypeDef that defines a relationship. + + :code:`

` + As with + other typeDefs the AtlasRelationshipDef has a name. Once created the + RelationshipDef has a guid. + The name and the guid are the 2 ways that the + RelationshipDef is identified. + + :code:`

` + RelationshipDefs have 2 ends, each of which + specify cardinality, an EntityDef type name and name and optionally + whether the + end is a container. + + :code:`

` + RelationshipDefs can have AttributeDefs - though only + primitive types are allowed. :code:`
` + RelationshipDefs have a relationshipCategory + specifying the UML type of relationship required :code:`
` + The way EntityDefs and + RelationshipDefs are intended to be used is that EntityDefs will define + AttributeDefs these AttributeDefs + will not specify an EntityDef type name as + their types. + + :code:`

` + RelationshipDefs introduce new attributes to the entity + instances. For example + + :code:`

` + EntityDef A might have attributes attr1,attr2,attr3 + :code:`
` + EntityDef B might have attributes attr4,attr5,attr6 :code:`
` + RelationshipDef + AtoB might define 2 ends :code:`
` + + + .. raw:: html + +

+          end1:  type A, name attr7
+          end2:
+       type B, name attr8  
+ + + :code:`

` + When an instance of EntityDef A is created, it + will have attributes attr1,attr2,attr3,attr7 :code:`
` + When an instance of EntityDef + B is created, it will have attributes attr4,attr5,attr6,attr8 + + :code:`

` + In this way + relationshipDefs can be authored separately from entityDefs and can inject + relationship attributes into + the entity instances. + + :ivar category: The enum of type category. Known values are: "PRIMITIVE", "OBJECT_ID_TYPE", + "ENUM", "STRUCT", "CLASSIFICATION", "ENTITY", "ARRAY", "MAP", "RELATIONSHIP", and + "TERM_TEMPLATE". + :vartype category: str or ~azure.analytics.purview.datamap.models.TypeCategory + :ivar create_time: The created time of the record. + :vartype create_time: int + :ivar created_by: The user who created the record. + :vartype created_by: str + :ivar date_formatter: The date format. + :vartype date_formatter: ~azure.analytics.purview.datamap.models.DateFormat + :ivar description: The description of the type definition. + :vartype description: str + :ivar guid: The GUID of the type definition. + :vartype guid: str + :ivar name: The name of the type definition. + :vartype name: str + :ivar options: The options for the type definition. + :vartype options: dict[str, str] + :ivar service_type: The service type. + :vartype service_type: str + :ivar type_version: The version of the type. + :vartype type_version: str + :ivar update_time: The update time of the record. + :vartype update_time: int + :ivar updated_by: The user who updated the record. + :vartype updated_by: str + :ivar version: The version of the record. + :vartype version: int + :ivar last_modified_t_s: ETag for concurrency control. + :vartype last_modified_t_s: str + :ivar attribute_defs: An array of attribute definitions. + :vartype attribute_defs: list[~azure.analytics.purview.datamap.models.AtlasAttributeDef] + :ivar end_def1: The relationshipEndDef represents an end of the relationship. The end of the + relationship is defined by a type, an + attribute name, cardinality and whether + it is the container end of the relationship. + :vartype end_def1: ~azure.analytics.purview.datamap.models.AtlasRelationshipEndDef + :ivar end_def2: The relationshipEndDef represents an end of the relationship. The end of the + relationship is defined by a type, an + attribute name, cardinality and whether + it is the container end of the relationship. + :vartype end_def2: ~azure.analytics.purview.datamap.models.AtlasRelationshipEndDef + :ivar relationship_category: The Relationship category determines the style of relationship + around + containment and lifecycle. + UML terminology is used for the + values. + + :code:`

` + ASSOCIATION is a relationship with no containment. :code:`
` + COMPOSITION + and AGGREGATION are containment relationships. + + :code:`

` + The difference being in the + lifecycles of the container and its children. In the COMPOSITION case, + the + children cannot exist without the container. For AGGREGATION, the life + cycles + of the container and children are totally independent. Known values are: "ASSOCIATION", + "AGGREGATION", and "COMPOSITION". + :vartype relationship_category: str or + ~azure.analytics.purview.datamap.models.RelationshipCategory + :ivar relationship_label: The label of the relationship. + :vartype relationship_label: str + """ + + category: Optional[Union[str, "_models.TypeCategory"]] = rest_field() + """The enum of type category. Known values are: \"PRIMITIVE\", \"OBJECT_ID_TYPE\", \"ENUM\", + \"STRUCT\", \"CLASSIFICATION\", \"ENTITY\", \"ARRAY\", \"MAP\", \"RELATIONSHIP\", and + \"TERM_TEMPLATE\".""" + create_time: Optional[int] = rest_field(name="createTime") + """The created time of the record.""" + created_by: Optional[str] = rest_field(name="createdBy") + """The user who created the record.""" + date_formatter: Optional["_models.DateFormat"] = rest_field(name="dateFormatter") + """The date format.""" + description: Optional[str] = rest_field() + """The description of the type definition.""" + guid: Optional[str] = rest_field() + """The GUID of the type definition.""" + name: Optional[str] = rest_field() + """The name of the type definition.""" + options: Optional[Dict[str, str]] = rest_field() + """The options for the type definition.""" + service_type: Optional[str] = rest_field(name="serviceType") + """The service type.""" + type_version: Optional[str] = rest_field(name="typeVersion") + """The version of the type.""" + update_time: Optional[int] = rest_field(name="updateTime") + """The update time of the record.""" + updated_by: Optional[str] = rest_field(name="updatedBy") + """The user who updated the record.""" + version: Optional[int] = rest_field() + """The version of the record.""" + last_modified_t_s: Optional[str] = rest_field(name="lastModifiedTS") + """ETag for concurrency control.""" + attribute_defs: Optional[List["_models.AtlasAttributeDef"]] = rest_field(name="attributeDefs") + """An array of attribute definitions.""" + end_def1: Optional["_models.AtlasRelationshipEndDef"] = rest_field(name="endDef1") + """The relationshipEndDef represents an end of the relationship. The end of the + relationship is defined by a type, an + attribute name, cardinality and whether + it is the container end of the relationship.""" + end_def2: Optional["_models.AtlasRelationshipEndDef"] = rest_field(name="endDef2") + """The relationshipEndDef represents an end of the relationship. The end of the + relationship is defined by a type, an + attribute name, cardinality and whether + it is the container end of the relationship.""" + relationship_category: Optional[Union[str, "_models.RelationshipCategory"]] = rest_field( + name="relationshipCategory" + ) + """The Relationship category determines the style of relationship around + containment and lifecycle. + UML terminology is used for the + values. + + :code:`

` + ASSOCIATION is a relationship with no containment. :code:`
` + COMPOSITION + and AGGREGATION are containment relationships. + + :code:`

` + The difference being in the + lifecycles of the container and its children. In the COMPOSITION case, + the + children cannot exist without the container. For AGGREGATION, the life + cycles + of the container and children are totally independent. Known values are: \"ASSOCIATION\", + \"AGGREGATION\", and \"COMPOSITION\".""" + relationship_label: Optional[str] = rest_field(name="relationshipLabel") + """The label of the relationship.""" + + @overload + def __init__( + self, + *, + category: Optional[Union[str, "_models.TypeCategory"]] = None, + create_time: Optional[int] = None, + created_by: Optional[str] = None, + date_formatter: Optional["_models.DateFormat"] = None, + description: Optional[str] = None, + guid: Optional[str] = None, + name: Optional[str] = None, + options: Optional[Dict[str, str]] = None, + service_type: Optional[str] = None, + type_version: Optional[str] = None, + update_time: Optional[int] = None, + updated_by: Optional[str] = None, + version: Optional[int] = None, + last_modified_t_s: Optional[str] = None, + attribute_defs: Optional[List["_models.AtlasAttributeDef"]] = None, + end_def1: Optional["_models.AtlasRelationshipEndDef"] = None, + end_def2: Optional["_models.AtlasRelationshipEndDef"] = None, + relationship_category: Optional[Union[str, "_models.RelationshipCategory"]] = None, + relationship_label: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasRelationshipEndDef(_model_base.Model): + """The relationshipEndDef represents an end of the relationship. The end of the + relationship is defined by a type, an + attribute name, cardinality and whether + it is the container end of the relationship. + + :ivar cardinality: single-valued attribute or multi-valued attribute. Known values are: + "SINGLE", "LIST", and "SET". + :vartype cardinality: str or ~azure.analytics.purview.datamap.models.Cardinality + :ivar description: The description of the relationship end definition. + :vartype description: str + :ivar is_container: Determines if it is container. + :vartype is_container: bool + :ivar is_legacy_attribute: Determines if it is a legacy attribute. + :vartype is_legacy_attribute: bool + :ivar name: The name of the relationship end definition. + :vartype name: str + :ivar type: The type of the relationship end. + :vartype type: str + """ + + cardinality: Optional[Union[str, "_models.Cardinality"]] = rest_field() + """single-valued attribute or multi-valued attribute. Known values are: \"SINGLE\", \"LIST\", and + \"SET\".""" + description: Optional[str] = rest_field() + """The description of the relationship end definition.""" + is_container: Optional[bool] = rest_field(name="isContainer") + """Determines if it is container.""" + is_legacy_attribute: Optional[bool] = rest_field(name="isLegacyAttribute") + """Determines if it is a legacy attribute.""" + name: Optional[str] = rest_field() + """The name of the relationship end definition.""" + type: Optional[str] = rest_field() + """The type of the relationship end.""" + + @overload + def __init__( + self, + *, + cardinality: Optional[Union[str, "_models.Cardinality"]] = None, + description: Optional[str] = None, + is_container: Optional[bool] = None, + is_legacy_attribute: Optional[bool] = None, + name: Optional[str] = None, + type: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasRelationshipWithExtInfo(_model_base.Model): + """The relationship with extended information. + + :ivar referred_entities: The referred entity header. + :vartype referred_entities: dict[str, + ~azure.analytics.purview.datamap.models.AtlasEntityHeader] + :ivar relationship: Atlas relationship instance. + :vartype relationship: ~azure.analytics.purview.datamap.models.AtlasRelationship + """ + + referred_entities: Optional[Dict[str, "_models.AtlasEntityHeader"]] = rest_field(name="referredEntities") + """The referred entity header.""" + relationship: Optional["_models.AtlasRelationship"] = rest_field() + """Atlas relationship instance.""" + + @overload + def __init__( + self, + *, + referred_entities: Optional[Dict[str, "_models.AtlasEntityHeader"]] = None, + relationship: Optional["_models.AtlasRelationship"] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasStruct(_model_base.Model): + """Captures details of struct contents. Not instantiated directly, used only via + AtlasEntity, AtlasClassification. + + :ivar attributes: The attributes of the struct. + :vartype attributes: dict[str, any] + :ivar type_name: The name of the type. + :vartype type_name: str + :ivar last_modified_t_s: ETag for concurrency control. + :vartype last_modified_t_s: str + """ + + attributes: Optional[Dict[str, Any]] = rest_field() + """The attributes of the struct.""" + type_name: Optional[str] = rest_field(name="typeName") + """The name of the type.""" + last_modified_t_s: Optional[str] = rest_field(name="lastModifiedTS") + """ETag for concurrency control.""" + + @overload + def __init__( + self, + *, + attributes: Optional[Dict[str, Any]] = None, + type_name: Optional[str] = None, + last_modified_t_s: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasStructDef(_model_base.Model): # pylint: disable=too-many-instance-attributes + """class that captures details of a struct-type. + + :ivar category: The enum of type category. Known values are: "PRIMITIVE", "OBJECT_ID_TYPE", + "ENUM", "STRUCT", "CLASSIFICATION", "ENTITY", "ARRAY", "MAP", "RELATIONSHIP", and + "TERM_TEMPLATE". + :vartype category: str or ~azure.analytics.purview.datamap.models.TypeCategory + :ivar create_time: The created time of the record. + :vartype create_time: int + :ivar created_by: The user who created the record. + :vartype created_by: str + :ivar date_formatter: The date format. + :vartype date_formatter: ~azure.analytics.purview.datamap.models.DateFormat + :ivar description: The description of the type definition. + :vartype description: str + :ivar guid: The GUID of the type definition. + :vartype guid: str + :ivar name: The name of the type definition. + :vartype name: str + :ivar options: The options for the type definition. + :vartype options: dict[str, str] + :ivar service_type: The service type. + :vartype service_type: str + :ivar type_version: The version of the type. + :vartype type_version: str + :ivar update_time: The update time of the record. + :vartype update_time: int + :ivar updated_by: The user who updated the record. + :vartype updated_by: str + :ivar version: The version of the record. + :vartype version: int + :ivar last_modified_t_s: ETag for concurrency control. + :vartype last_modified_t_s: str + :ivar attribute_defs: An array of attribute definitions. + :vartype attribute_defs: list[~azure.analytics.purview.datamap.models.AtlasAttributeDef] + """ + + category: Optional[Union[str, "_models.TypeCategory"]] = rest_field() + """The enum of type category. Known values are: \"PRIMITIVE\", \"OBJECT_ID_TYPE\", \"ENUM\", + \"STRUCT\", \"CLASSIFICATION\", \"ENTITY\", \"ARRAY\", \"MAP\", \"RELATIONSHIP\", and + \"TERM_TEMPLATE\".""" + create_time: Optional[int] = rest_field(name="createTime") + """The created time of the record.""" + created_by: Optional[str] = rest_field(name="createdBy") + """The user who created the record.""" + date_formatter: Optional["_models.DateFormat"] = rest_field(name="dateFormatter") + """The date format.""" + description: Optional[str] = rest_field() + """The description of the type definition.""" + guid: Optional[str] = rest_field() + """The GUID of the type definition.""" + name: Optional[str] = rest_field() + """The name of the type definition.""" + options: Optional[Dict[str, str]] = rest_field() + """The options for the type definition.""" + service_type: Optional[str] = rest_field(name="serviceType") + """The service type.""" + type_version: Optional[str] = rest_field(name="typeVersion") + """The version of the type.""" + update_time: Optional[int] = rest_field(name="updateTime") + """The update time of the record.""" + updated_by: Optional[str] = rest_field(name="updatedBy") + """The user who updated the record.""" + version: Optional[int] = rest_field() + """The version of the record.""" + last_modified_t_s: Optional[str] = rest_field(name="lastModifiedTS") + """ETag for concurrency control.""" + attribute_defs: Optional[List["_models.AtlasAttributeDef"]] = rest_field(name="attributeDefs") + """An array of attribute definitions.""" + + @overload + def __init__( + self, + *, + category: Optional[Union[str, "_models.TypeCategory"]] = None, + create_time: Optional[int] = None, + created_by: Optional[str] = None, + date_formatter: Optional["_models.DateFormat"] = None, + description: Optional[str] = None, + guid: Optional[str] = None, + name: Optional[str] = None, + options: Optional[Dict[str, str]] = None, + service_type: Optional[str] = None, + type_version: Optional[str] = None, + update_time: Optional[int] = None, + updated_by: Optional[str] = None, + version: Optional[int] = None, + last_modified_t_s: Optional[str] = None, + attribute_defs: Optional[List["_models.AtlasAttributeDef"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasTermAssignmentHeader(_model_base.Model): + """The header for term assignment. + + :ivar confidence: The confidence of the term assignment. + :vartype confidence: int + :ivar created_by: The user who created the record. + :vartype created_by: str + :ivar description: The description of the term assignment. + :vartype description: str + :ivar display_text: The display text. + :vartype display_text: str + :ivar expression: The expression of the term assignment. + :vartype expression: str + :ivar relation_guid: The GUID of the relationship. + :vartype relation_guid: str + :ivar status: The status of terms assignment. Known values are: "DISCOVERED", "PROPOSED", + "IMPORTED", "VALIDATED", "DEPRECATED", "OBSOLETE", and "OTHER". + :vartype status: str or ~azure.analytics.purview.datamap.models.AtlasTermAssignmentStatus + :ivar steward: The steward of the term. + :vartype steward: str + :ivar term_guid: The GUID of the term. + :vartype term_guid: str + """ + + confidence: Optional[int] = rest_field() + """The confidence of the term assignment.""" + created_by: Optional[str] = rest_field(name="createdBy") + """The user who created the record.""" + description: Optional[str] = rest_field() + """The description of the term assignment.""" + display_text: Optional[str] = rest_field(name="displayText") + """The display text.""" + expression: Optional[str] = rest_field() + """The expression of the term assignment.""" + relation_guid: Optional[str] = rest_field(name="relationGuid") + """The GUID of the relationship.""" + status: Optional[Union[str, "_models.AtlasTermAssignmentStatus"]] = rest_field() + """The status of terms assignment. Known values are: \"DISCOVERED\", \"PROPOSED\", \"IMPORTED\", + \"VALIDATED\", \"DEPRECATED\", \"OBSOLETE\", and \"OTHER\".""" + steward: Optional[str] = rest_field() + """The steward of the term.""" + term_guid: Optional[str] = rest_field(name="termGuid") + """The GUID of the term.""" + + @overload + def __init__( + self, + *, + confidence: Optional[int] = None, + created_by: Optional[str] = None, + description: Optional[str] = None, + display_text: Optional[str] = None, + expression: Optional[str] = None, + relation_guid: Optional[str] = None, + status: Optional[Union[str, "_models.AtlasTermAssignmentStatus"]] = None, + steward: Optional[str] = None, + term_guid: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasTermCategorizationHeader(_model_base.Model): + """The basic information for term categorization. + + :ivar category_guid: The GUID of the category. + :vartype category_guid: str + :ivar description: The description of the record. + :vartype description: str + :ivar display_text: The display text. + :vartype display_text: str + :ivar relation_guid: The GUID of the relationship. + :vartype relation_guid: str + :ivar status: The status of term relationship. Known values are: "DRAFT", "ACTIVE", + "DEPRECATED", "OBSOLETE", and "OTHER". + :vartype status: str or ~azure.analytics.purview.datamap.models.AtlasTermRelationshipStatus + """ + + category_guid: Optional[str] = rest_field(name="categoryGuid") + """The GUID of the category.""" + description: Optional[str] = rest_field() + """The description of the record.""" + display_text: Optional[str] = rest_field(name="displayText") + """The display text.""" + relation_guid: Optional[str] = rest_field(name="relationGuid") + """The GUID of the relationship.""" + status: Optional[Union[str, "_models.AtlasTermRelationshipStatus"]] = rest_field() + """The status of term relationship. Known values are: \"DRAFT\", \"ACTIVE\", \"DEPRECATED\", + \"OBSOLETE\", and \"OTHER\".""" + + @overload + def __init__( + self, + *, + category_guid: Optional[str] = None, + description: Optional[str] = None, + display_text: Optional[str] = None, + relation_guid: Optional[str] = None, + status: Optional[Union[str, "_models.AtlasTermRelationshipStatus"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasTypeDef(_model_base.Model): # pylint: disable=too-many-instance-attributes + """The definitions of type. + + :ivar category: The enum of type category. Known values are: "PRIMITIVE", "OBJECT_ID_TYPE", + "ENUM", "STRUCT", "CLASSIFICATION", "ENTITY", "ARRAY", "MAP", "RELATIONSHIP", and + "TERM_TEMPLATE". + :vartype category: str or ~azure.analytics.purview.datamap.models.TypeCategory + :ivar create_time: The created time of the record. + :vartype create_time: int + :ivar created_by: The user who created the record. + :vartype created_by: str + :ivar date_formatter: The date format. + :vartype date_formatter: ~azure.analytics.purview.datamap.models.DateFormat + :ivar description: The description of the type definition. + :vartype description: str + :ivar guid: The GUID of the type definition. + :vartype guid: str + :ivar name: The name of the type definition. + :vartype name: str + :ivar options: The options for the type definition. + :vartype options: dict[str, str] + :ivar service_type: The service type. + :vartype service_type: str + :ivar type_version: The version of the type. + :vartype type_version: str + :ivar update_time: The update time of the record. + :vartype update_time: int + :ivar updated_by: The user who updated the record. + :vartype updated_by: str + :ivar version: The version of the record. + :vartype version: int + :ivar last_modified_t_s: ETag for concurrency control. + :vartype last_modified_t_s: str + :ivar entity_types: Specifying a list of entityType names in the classificationDef, ensures + that + classifications can + only be applied to those entityTypes. + + + .. raw:: html + +

    +
  • Any subtypes + of the entity types inherit the restriction
  • +
  • Any classificationDef + subtypes inherit the parents entityTypes restrictions
  • +
  • Any + classificationDef subtypes can further restrict the parents entityTypes + restrictions by specifying a subset of the entityTypes
  • +
  • An empty + entityTypes list when there are no parent restrictions means there are no + restrictions
  • +
  • An empty entityTypes list when there are parent + restrictions means that the subtype picks up the parents + restrictions
  • +
  • If a list of entityTypes are supplied, where one inherits + from another, this will be rejected. This should encourage cleaner + classificationsDefs
  • +
. + :vartype entity_types: list[str] + :ivar sub_types: An array of sub types. + :vartype sub_types: list[str] + :ivar super_types: An array of super types. + :vartype super_types: list[str] + :ivar relationship_attribute_defs: An array of relationship attributes. + :vartype relationship_attribute_defs: + list[~azure.analytics.purview.datamap.models.AtlasRelationshipAttributeDef] + :ivar default_value: The default value. + :vartype default_value: str + :ivar element_defs: An array of enum element definitions. + :vartype element_defs: list[~azure.analytics.purview.datamap.models.AtlasEnumElementDef] + :ivar end_def1: The relationshipEndDef represents an end of the relationship. The end of the + relationship is defined by a type, an + attribute name, cardinality and whether + it is the container end of the relationship. + :vartype end_def1: ~azure.analytics.purview.datamap.models.AtlasRelationshipEndDef + :ivar end_def2: The relationshipEndDef represents an end of the relationship. The end of the + relationship is defined by a type, an + attribute name, cardinality and whether + it is the container end of the relationship. + :vartype end_def2: ~azure.analytics.purview.datamap.models.AtlasRelationshipEndDef + :ivar relationship_category: The Relationship category determines the style of relationship + around + containment and lifecycle. + UML terminology is used for the + values. + + :code:`

` + ASSOCIATION is a relationship with no containment. :code:`
` + COMPOSITION + and AGGREGATION are containment relationships. + + :code:`

` + The difference being in the + lifecycles of the container and its children. In the COMPOSITION case, + the + children cannot exist without the container. For AGGREGATION, the life + cycles + of the container and children are totally independent. Known values are: "ASSOCIATION", + "AGGREGATION", and "COMPOSITION". + :vartype relationship_category: str or + ~azure.analytics.purview.datamap.models.RelationshipCategory + :ivar relationship_label: The label of the relationship. + :vartype relationship_label: str + :ivar attribute_defs: An array of attribute definitions. + :vartype attribute_defs: list[~azure.analytics.purview.datamap.models.AtlasAttributeDef] + """ + + category: Optional[Union[str, "_models.TypeCategory"]] = rest_field() + """The enum of type category. Known values are: \"PRIMITIVE\", \"OBJECT_ID_TYPE\", \"ENUM\", + \"STRUCT\", \"CLASSIFICATION\", \"ENTITY\", \"ARRAY\", \"MAP\", \"RELATIONSHIP\", and + \"TERM_TEMPLATE\".""" + create_time: Optional[int] = rest_field(name="createTime") + """The created time of the record.""" + created_by: Optional[str] = rest_field(name="createdBy") + """The user who created the record.""" + date_formatter: Optional["_models.DateFormat"] = rest_field(name="dateFormatter") + """The date format.""" + description: Optional[str] = rest_field() + """The description of the type definition.""" + guid: Optional[str] = rest_field() + """The GUID of the type definition.""" + name: Optional[str] = rest_field() + """The name of the type definition.""" + options: Optional[Dict[str, str]] = rest_field() + """The options for the type definition.""" + service_type: Optional[str] = rest_field(name="serviceType") + """The service type.""" + type_version: Optional[str] = rest_field(name="typeVersion") + """The version of the type.""" + update_time: Optional[int] = rest_field(name="updateTime") + """The update time of the record.""" + updated_by: Optional[str] = rest_field(name="updatedBy") + """The user who updated the record.""" + version: Optional[int] = rest_field() + """The version of the record.""" + last_modified_t_s: Optional[str] = rest_field(name="lastModifiedTS") + """ETag for concurrency control.""" + entity_types: Optional[List[str]] = rest_field(name="entityTypes") + """Specifying a list of entityType names in the classificationDef, ensures that + classifications can + only be applied to those entityTypes. + + + .. raw:: html + +

    +
  • Any subtypes + of the entity types inherit the restriction
  • +
  • Any classificationDef + subtypes inherit the parents entityTypes restrictions
  • +
  • Any + classificationDef subtypes can further restrict the parents entityTypes + restrictions by specifying a subset of the entityTypes
  • +
  • An empty + entityTypes list when there are no parent restrictions means there are no + restrictions
  • +
  • An empty entityTypes list when there are parent + restrictions means that the subtype picks up the parents + restrictions
  • +
  • If a list of entityTypes are supplied, where one inherits + from another, this will be rejected. This should encourage cleaner + classificationsDefs
  • +
.""" + sub_types: Optional[List[str]] = rest_field(name="subTypes") + """An array of sub types.""" + super_types: Optional[List[str]] = rest_field(name="superTypes") + """An array of super types.""" + relationship_attribute_defs: Optional[List["_models.AtlasRelationshipAttributeDef"]] = rest_field( + name="relationshipAttributeDefs" + ) + """An array of relationship attributes.""" + default_value: Optional[str] = rest_field(name="defaultValue") + """The default value.""" + element_defs: Optional[List["_models.AtlasEnumElementDef"]] = rest_field(name="elementDefs") + """An array of enum element definitions.""" + end_def1: Optional["_models.AtlasRelationshipEndDef"] = rest_field(name="endDef1") + """The relationshipEndDef represents an end of the relationship. The end of the + relationship is defined by a type, an + attribute name, cardinality and whether + it is the container end of the relationship.""" + end_def2: Optional["_models.AtlasRelationshipEndDef"] = rest_field(name="endDef2") + """The relationshipEndDef represents an end of the relationship. The end of the + relationship is defined by a type, an + attribute name, cardinality and whether + it is the container end of the relationship.""" + relationship_category: Optional[Union[str, "_models.RelationshipCategory"]] = rest_field( + name="relationshipCategory" + ) + """The Relationship category determines the style of relationship around + containment and lifecycle. + UML terminology is used for the + values. + + :code:`

` + ASSOCIATION is a relationship with no containment. :code:`
` + COMPOSITION + and AGGREGATION are containment relationships. + + :code:`

` + The difference being in the + lifecycles of the container and its children. In the COMPOSITION case, + the + children cannot exist without the container. For AGGREGATION, the life + cycles + of the container and children are totally independent. Known values are: \"ASSOCIATION\", + \"AGGREGATION\", and \"COMPOSITION\".""" + relationship_label: Optional[str] = rest_field(name="relationshipLabel") + """The label of the relationship.""" + attribute_defs: Optional[List["_models.AtlasAttributeDef"]] = rest_field(name="attributeDefs") + """An array of attribute definitions.""" + + @overload + def __init__( + self, + *, + category: Optional[Union[str, "_models.TypeCategory"]] = None, + create_time: Optional[int] = None, + created_by: Optional[str] = None, + date_formatter: Optional["_models.DateFormat"] = None, + description: Optional[str] = None, + guid: Optional[str] = None, + name: Optional[str] = None, + options: Optional[Dict[str, str]] = None, + service_type: Optional[str] = None, + type_version: Optional[str] = None, + update_time: Optional[int] = None, + updated_by: Optional[str] = None, + version: Optional[int] = None, + last_modified_t_s: Optional[str] = None, + entity_types: Optional[List[str]] = None, + sub_types: Optional[List[str]] = None, + super_types: Optional[List[str]] = None, + relationship_attribute_defs: Optional[List["_models.AtlasRelationshipAttributeDef"]] = None, + default_value: Optional[str] = None, + element_defs: Optional[List["_models.AtlasEnumElementDef"]] = None, + end_def1: Optional["_models.AtlasRelationshipEndDef"] = None, + end_def2: Optional["_models.AtlasRelationshipEndDef"] = None, + relationship_category: Optional[Union[str, "_models.RelationshipCategory"]] = None, + relationship_label: Optional[str] = None, + attribute_defs: Optional[List["_models.AtlasAttributeDef"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasTypeDefHeader(_model_base.Model): + """The basic information of the type definition. + + :ivar category: The enum of type category. Known values are: "PRIMITIVE", "OBJECT_ID_TYPE", + "ENUM", "STRUCT", "CLASSIFICATION", "ENTITY", "ARRAY", "MAP", "RELATIONSHIP", and + "TERM_TEMPLATE". + :vartype category: str or ~azure.analytics.purview.datamap.models.TypeCategory + :ivar guid: The GUID of the type definition. + :vartype guid: str + :ivar name: The name of the type definition. + :vartype name: str + """ + + category: Optional[Union[str, "_models.TypeCategory"]] = rest_field() + """The enum of type category. Known values are: \"PRIMITIVE\", \"OBJECT_ID_TYPE\", \"ENUM\", + \"STRUCT\", \"CLASSIFICATION\", \"ENTITY\", \"ARRAY\", \"MAP\", \"RELATIONSHIP\", and + \"TERM_TEMPLATE\".""" + guid: Optional[str] = rest_field() + """The GUID of the type definition.""" + name: Optional[str] = rest_field() + """The name of the type definition.""" + + @overload + def __init__( + self, + *, + category: Optional[Union[str, "_models.TypeCategory"]] = None, + guid: Optional[str] = None, + name: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AtlasTypesDef(_model_base.Model): + """The definitions of types. + + :ivar business_metadata_defs: businessMetadataDefs. + :vartype business_metadata_defs: + list[~azure.analytics.purview.datamap.models.AtlasBusinessMetadataDef] + :ivar classification_defs: An array of classification definitions. + :vartype classification_defs: + list[~azure.analytics.purview.datamap.models.AtlasClassificationDef] + :ivar entity_defs: An array of entity definitions. + :vartype entity_defs: list[~azure.analytics.purview.datamap.models.AtlasEntityDef] + :ivar enum_defs: An array of enum definitions. + :vartype enum_defs: list[~azure.analytics.purview.datamap.models.AtlasEnumDef] + :ivar relationship_defs: An array of relationship definitions. + :vartype relationship_defs: list[~azure.analytics.purview.datamap.models.AtlasRelationshipDef] + :ivar struct_defs: An array of struct definitions. + :vartype struct_defs: list[~azure.analytics.purview.datamap.models.AtlasStructDef] + :ivar term_template_defs: An array of term template definitions. + :vartype term_template_defs: list[~azure.analytics.purview.datamap.models.TermTemplateDef] + """ + + business_metadata_defs: Optional[List["_models.AtlasBusinessMetadataDef"]] = rest_field(name="businessMetadataDefs") + """businessMetadataDefs.""" + classification_defs: Optional[List["_models.AtlasClassificationDef"]] = rest_field(name="classificationDefs") + """An array of classification definitions.""" + entity_defs: Optional[List["_models.AtlasEntityDef"]] = rest_field(name="entityDefs") + """An array of entity definitions.""" + enum_defs: Optional[List["_models.AtlasEnumDef"]] = rest_field(name="enumDefs") + """An array of enum definitions.""" + relationship_defs: Optional[List["_models.AtlasRelationshipDef"]] = rest_field(name="relationshipDefs") + """An array of relationship definitions.""" + struct_defs: Optional[List["_models.AtlasStructDef"]] = rest_field(name="structDefs") + """An array of struct definitions.""" + term_template_defs: Optional[List["_models.TermTemplateDef"]] = rest_field(name="termTemplateDefs") + """An array of term template definitions.""" + + @overload + def __init__( + self, + *, + business_metadata_defs: Optional[List["_models.AtlasBusinessMetadataDef"]] = None, + classification_defs: Optional[List["_models.AtlasClassificationDef"]] = None, + entity_defs: Optional[List["_models.AtlasEntityDef"]] = None, + enum_defs: Optional[List["_models.AtlasEnumDef"]] = None, + relationship_defs: Optional[List["_models.AtlasRelationshipDef"]] = None, + struct_defs: Optional[List["_models.AtlasStructDef"]] = None, + term_template_defs: Optional[List["_models.TermTemplateDef"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AutoCompleteRequest(_model_base.Model): + """The query of autocomplete request. + + :ivar keywords: The keywords applied to all fields that support autocomplete operation. It must + be at least 1 character, and no more than 100 characters. + :vartype keywords: str + :ivar limit: The number of autocomplete results we hope to return. The default value is 50. + The value must be a number between 1 and 100. + :vartype limit: int + :ivar filter: The filter for the autocomplete request. + :vartype filter: any + """ + + keywords: Optional[str] = rest_field() + """The keywords applied to all fields that support autocomplete operation. It must + be at least 1 character, and no more than 100 characters.""" + limit: Optional[int] = rest_field() + """The number of autocomplete results we hope to return. The default value is 50. + The value must be a number between 1 and 100.""" + filter: Optional[Any] = rest_field() + """The filter for the autocomplete request.""" + + @overload + def __init__( + self, + *, + keywords: Optional[str] = None, + limit: Optional[int] = None, + filter: Optional[Any] = None, # pylint: disable=redefined-builtin + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AutoCompleteResult(_model_base.Model): + """The result of the autocomplete request. + + :ivar value: The result value. + :vartype value: list[~azure.analytics.purview.datamap.models.AutoCompleteResultValue] + """ + + value: Optional[List["_models.AutoCompleteResultValue"]] = rest_field() + """The result value.""" + + @overload + def __init__( + self, + *, + value: Optional[List["_models.AutoCompleteResultValue"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AutoCompleteResultValue(_model_base.Model): + """The value item of the autocomplete suggest. + + :ivar text: The completed term or phrase. + :vartype text: str + :ivar query_plus_text: The completed search query text. + :vartype query_plus_text: str + """ + + text: Optional[str] = rest_field() + """The completed term or phrase.""" + query_plus_text: Optional[str] = rest_field(name="queryPlusText") + """The completed search query text.""" + + @overload + def __init__( + self, + *, + text: Optional[str] = None, + query_plus_text: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class BulkImportResponse(_model_base.Model): + """example. + + :ivar failed_import_info_list: failed importInfoList. + :vartype failed_import_info_list: list[~azure.analytics.purview.datamap.models.ImportInfo] + :ivar success_import_info_list: successful importInfoList. + :vartype success_import_info_list: list[~azure.analytics.purview.datamap.models.ImportInfo] + """ + + failed_import_info_list: Optional[List["_models.ImportInfo"]] = rest_field(name="failedImportInfoList") + """failed importInfoList.""" + success_import_info_list: Optional[List["_models.ImportInfo"]] = rest_field(name="successImportInfoList") + """successful importInfoList.""" + + @overload + def __init__( + self, + *, + failed_import_info_list: Optional[List["_models.ImportInfo"]] = None, + success_import_info_list: Optional[List["_models.ImportInfo"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class ClassificationAssociateRequest(_model_base.Model): + """The request for classification association. + + :ivar classification: An instance of a classification; it doesn't have an identity, this object + exists only when associated with an entity. + :vartype classification: ~azure.analytics.purview.datamap.models.AtlasClassification + :ivar entity_guids: The GUID of the entity. + :vartype entity_guids: list[str] + """ + + classification: Optional["_models.AtlasClassification"] = rest_field() + """An instance of a classification; it doesn't have an identity, this object + exists only when associated with an entity.""" + entity_guids: Optional[List[str]] = rest_field(name="entityGuids") + """The GUID of the entity.""" + + @overload + def __init__( + self, + *, + classification: Optional["_models.AtlasClassification"] = None, + entity_guids: Optional[List[str]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class ContactBasic(_model_base.Model): + """ContactBasic. + + :ivar id: Azure Active Directory object Id. + :vartype id: str + :ivar info: additional information to describe this contact. + :vartype info: str + """ + + id: Optional[str] = rest_field() + """Azure Active Directory object Id.""" + info: Optional[str] = rest_field() + """additional information to describe this contact.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + info: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class ContactSearchResultValue(_model_base.Model): + """The contact in the search and suggest result. + + :ivar id: The GUID of the contact. + :vartype id: str + :ivar info: The description of the contact. + :vartype info: str + :ivar contact_type: The type of the contact. It can be Expert or Owner for an entity. It can be + Expert or Steward for a glossary term. + :vartype contact_type: str + """ + + id: Optional[str] = rest_field() + """The GUID of the contact.""" + info: Optional[str] = rest_field() + """The description of the contact.""" + contact_type: Optional[str] = rest_field(name="contactType") + """The type of the contact. It can be Expert or Owner for an entity. It can be + Expert or Steward for a glossary term.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + info: Optional[str] = None, + contact_type: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class DateFormat(_model_base.Model): + """The date format. + + :ivar available_locales: An array of available locales. + :vartype available_locales: list[str] + :ivar calendar: Calendar. + :vartype calendar: float + :ivar date_instance: The date format. + :vartype date_instance: ~azure.analytics.purview.datamap.models.DateFormat + :ivar date_time_instance: The date format. + :vartype date_time_instance: ~azure.analytics.purview.datamap.models.DateFormat + :ivar instance: The date format. + :vartype instance: ~azure.analytics.purview.datamap.models.DateFormat + :ivar lenient: Determines the leniency of the date format. + :vartype lenient: bool + :ivar number_format: The number format. + :vartype number_format: ~azure.analytics.purview.datamap.models.NumberFormat + :ivar time_instance: The date format. + :vartype time_instance: ~azure.analytics.purview.datamap.models.DateFormat + :ivar time_zone: The timezone information. + :vartype time_zone: ~azure.analytics.purview.datamap.models.TimeZone + """ + + available_locales: Optional[List[str]] = rest_field(name="availableLocales") + """An array of available locales.""" + calendar: Optional[float] = rest_field() + """Calendar.""" + date_instance: Optional["_models.DateFormat"] = rest_field(name="dateInstance") + """The date format.""" + date_time_instance: Optional["_models.DateFormat"] = rest_field(name="dateTimeInstance") + """The date format.""" + instance: Optional["_models.DateFormat"] = rest_field() + """The date format.""" + lenient: Optional[bool] = rest_field() + """Determines the leniency of the date format.""" + number_format: Optional["_models.NumberFormat"] = rest_field(name="numberFormat") + """The number format.""" + time_instance: Optional["_models.DateFormat"] = rest_field(name="timeInstance") + """The date format.""" + time_zone: Optional["_models.TimeZone"] = rest_field(name="timeZone") + """The timezone information.""" + + @overload + def __init__( + self, + *, + available_locales: Optional[List[str]] = None, + calendar: Optional[float] = None, + date_instance: Optional["_models.DateFormat"] = None, + date_time_instance: Optional["_models.DateFormat"] = None, + instance: Optional["_models.DateFormat"] = None, + lenient: Optional[bool] = None, + number_format: Optional["_models.NumberFormat"] = None, + time_instance: Optional["_models.DateFormat"] = None, + time_zone: Optional["_models.TimeZone"] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class EntityMutationResponse(_model_base.Model): + """The mutation response of entity. + + :ivar guid_assignments: A map of GUID assignments with entities. + :vartype guid_assignments: dict[str, str] + :ivar mutated_entities: The entity headers of mutated entities. + :vartype mutated_entities: dict[str, + list[~azure.analytics.purview.datamap.models.AtlasEntityHeader]] + :ivar partial_updated_entities: An array of entity headers that partially updated. + :vartype partial_updated_entities: + list[~azure.analytics.purview.datamap.models.AtlasEntityHeader] + """ + + guid_assignments: Optional[Dict[str, str]] = rest_field(name="guidAssignments") + """A map of GUID assignments with entities.""" + mutated_entities: Optional[Dict[str, List["_models.AtlasEntityHeader"]]] = rest_field(name="mutatedEntities") + """The entity headers of mutated entities.""" + partial_updated_entities: Optional[List["_models.AtlasEntityHeader"]] = rest_field(name="partialUpdatedEntities") + """An array of entity headers that partially updated.""" + + @overload + def __init__( + self, + *, + guid_assignments: Optional[Dict[str, str]] = None, + mutated_entities: Optional[Dict[str, List["_models.AtlasEntityHeader"]]] = None, + partial_updated_entities: Optional[List["_models.AtlasEntityHeader"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class ErrorResponse(_model_base.Model): + """An error response from the service. + + :ivar request_id: The request ID. + :vartype request_id: str + :ivar error_code: The error code. + :vartype error_code: str + :ivar error_message: The error message. + :vartype error_message: str + """ + + request_id: Optional[str] = rest_field(name="requestId") + """The request ID.""" + error_code: Optional[str] = rest_field(name="errorCode") + """The error code.""" + error_message: Optional[str] = rest_field(name="errorMessage") + """The error message.""" + + @overload + def __init__( + self, + *, + request_id: Optional[str] = None, + error_code: Optional[str] = None, + error_message: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class ImportInfo(_model_base.Model): + """ImportInfo. + + :ivar child_object_name: childObjectName. + :vartype child_object_name: str + :ivar import_status: importStatus. Known values are: "SUCCESS" and "FAILED". + :vartype import_status: str or ~azure.analytics.purview.datamap.models.ImportStatus + :ivar parent_object_name: parentObjectName. + :vartype parent_object_name: str + :ivar remarks: remarks. + :vartype remarks: str + """ + + child_object_name: Optional[str] = rest_field(name="childObjectName") + """childObjectName.""" + import_status: Optional[Union[str, "_models.ImportStatus"]] = rest_field(name="importStatus") + """importStatus. Known values are: \"SUCCESS\" and \"FAILED\".""" + parent_object_name: Optional[str] = rest_field(name="parentObjectName") + """parentObjectName.""" + remarks: Optional[str] = rest_field() + """remarks.""" + + @overload + def __init__( + self, + *, + child_object_name: Optional[str] = None, + import_status: Optional[Union[str, "_models.ImportStatus"]] = None, + parent_object_name: Optional[str] = None, + remarks: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class LineageRelation(_model_base.Model): + """The lineage relation with GUID of the from and to entity. + + :ivar from_entity_id: The GUID of from-entity. + :vartype from_entity_id: str + :ivar relationship_id: The GUID of relationship. + :vartype relationship_id: str + :ivar to_entity_id: The GUID of to-entity. + :vartype to_entity_id: str + """ + + from_entity_id: Optional[str] = rest_field(name="fromEntityId") + """The GUID of from-entity.""" + relationship_id: Optional[str] = rest_field(name="relationshipId") + """The GUID of relationship.""" + to_entity_id: Optional[str] = rest_field(name="toEntityId") + """The GUID of to-entity.""" + + @overload + def __init__( + self, + *, + from_entity_id: Optional[str] = None, + relationship_id: Optional[str] = None, + to_entity_id: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class MoveEntitiesRequest(_model_base.Model): + """MoveEntitiesRequest. + + :ivar entity_guids: An array of entity guids to be moved to target collection. + :vartype entity_guids: list[str] + """ + + entity_guids: Optional[List[str]] = rest_field(name="entityGuids") + """An array of entity guids to be moved to target collection.""" + + @overload + def __init__( + self, + *, + entity_guids: Optional[List[str]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class NumberFormat(_model_base.Model): # pylint: disable=too-many-instance-attributes + """The number format. + + :ivar available_locales: The number format. + :vartype available_locales: list[str] + :ivar currency: The currency. + :vartype currency: str + :ivar currency_instance: The number format. + :vartype currency_instance: ~azure.analytics.purview.datamap.models.NumberFormat + :ivar grouping_used: Determines if grouping is used. + :vartype grouping_used: bool + :ivar instance: The number format. + :vartype instance: ~azure.analytics.purview.datamap.models.NumberFormat + :ivar integer_instance: The number format. + :vartype integer_instance: ~azure.analytics.purview.datamap.models.NumberFormat + :ivar maximum_fraction_digits: The maximum of fraction digits. + :vartype maximum_fraction_digits: int + :ivar maximum_integer_digits: The maximum of integer digits. + :vartype maximum_integer_digits: int + :ivar minimum_fraction_digits: The minimum of fraction digits. + :vartype minimum_fraction_digits: int + :ivar minimum_integer_digits: The minimum of integer digits. + :vartype minimum_integer_digits: int + :ivar number_instance: The number format. + :vartype number_instance: ~azure.analytics.purview.datamap.models.NumberFormat + :ivar parse_integer_only: Determines if only integer is parsed. + :vartype parse_integer_only: bool + :ivar percent_instance: The number format. + :vartype percent_instance: ~azure.analytics.purview.datamap.models.NumberFormat + :ivar rounding_mode: The enum of rounding mode. Known values are: "UP", "DOWN", "CEILING", + "FLOOR", "HALF_UP", "HALF_DOWN", "HALF_EVEN", and "UNNECESSARY". + :vartype rounding_mode: str or ~azure.analytics.purview.datamap.models.RoundingMode + """ + + available_locales: Optional[List[str]] = rest_field(name="availableLocales") + """The number format.""" + currency: Optional[str] = rest_field() + """The currency.""" + currency_instance: Optional["_models.NumberFormat"] = rest_field(name="currencyInstance") + """The number format.""" + grouping_used: Optional[bool] = rest_field(name="groupingUsed") + """Determines if grouping is used.""" + instance: Optional["_models.NumberFormat"] = rest_field() + """The number format.""" + integer_instance: Optional["_models.NumberFormat"] = rest_field(name="integerInstance") + """The number format.""" + maximum_fraction_digits: Optional[int] = rest_field(name="maximumFractionDigits") + """The maximum of fraction digits.""" + maximum_integer_digits: Optional[int] = rest_field(name="maximumIntegerDigits") + """The maximum of integer digits.""" + minimum_fraction_digits: Optional[int] = rest_field(name="minimumFractionDigits") + """The minimum of fraction digits.""" + minimum_integer_digits: Optional[int] = rest_field(name="minimumIntegerDigits") + """The minimum of integer digits.""" + number_instance: Optional["_models.NumberFormat"] = rest_field(name="numberInstance") + """The number format.""" + parse_integer_only: Optional[bool] = rest_field(name="parseIntegerOnly") + """Determines if only integer is parsed.""" + percent_instance: Optional["_models.NumberFormat"] = rest_field(name="percentInstance") + """The number format.""" + rounding_mode: Optional[Union[str, "_models.RoundingMode"]] = rest_field(name="roundingMode") + """The enum of rounding mode. Known values are: \"UP\", \"DOWN\", \"CEILING\", \"FLOOR\", + \"HALF_UP\", \"HALF_DOWN\", \"HALF_EVEN\", and \"UNNECESSARY\".""" + + @overload + def __init__( + self, + *, + available_locales: Optional[List[str]] = None, + currency: Optional[str] = None, + currency_instance: Optional["_models.NumberFormat"] = None, + grouping_used: Optional[bool] = None, + instance: Optional["_models.NumberFormat"] = None, + integer_instance: Optional["_models.NumberFormat"] = None, + maximum_fraction_digits: Optional[int] = None, + maximum_integer_digits: Optional[int] = None, + minimum_fraction_digits: Optional[int] = None, + minimum_integer_digits: Optional[int] = None, + number_instance: Optional["_models.NumberFormat"] = None, + parse_integer_only: Optional[bool] = None, + percent_instance: Optional["_models.NumberFormat"] = None, + rounding_mode: Optional[Union[str, "_models.RoundingMode"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class ParentRelation(_model_base.Model): + """The lineage parents relation with GUID of the parent entity and to child entity. + + :ivar child_entity_id: The GUID of child entity. + :vartype child_entity_id: str + :ivar relationship_id: The GUID of relationship. + :vartype relationship_id: str + :ivar parent_entity_id: The GUID of parent entity. + :vartype parent_entity_id: str + """ + + child_entity_id: Optional[str] = rest_field(name="childEntityId") + """The GUID of child entity.""" + relationship_id: Optional[str] = rest_field(name="relationshipId") + """The GUID of relationship.""" + parent_entity_id: Optional[str] = rest_field(name="parentEntityId") + """The GUID of parent entity.""" + + @overload + def __init__( + self, + *, + child_entity_id: Optional[str] = None, + relationship_id: Optional[str] = None, + parent_entity_id: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class PurviewObjectId(_model_base.Model): + """PurviewObjectId. + + :ivar guid: The GUID of the object. + :vartype guid: str + :ivar type_name: The name of the type. + :vartype type_name: str + :ivar unique_attributes: The unique attributes of the object. + :vartype unique_attributes: dict[str, any] + :ivar name: Name. + :vartype name: str + :ivar display_text: Display text. + :vartype display_text: str + :ivar item_path: Item path. + :vartype item_path: str + :ivar resource_id: Resource Id. + :vartype resource_id: str + :ivar properties: Dictionary of :code:``. + :vartype properties: dict[str, any] + """ + + guid: Optional[str] = rest_field() + """The GUID of the object.""" + type_name: Optional[str] = rest_field(name="typeName") + """The name of the type.""" + unique_attributes: Optional[Dict[str, Any]] = rest_field(name="uniqueAttributes") + """The unique attributes of the object.""" + name: Optional[str] = rest_field() + """Name.""" + display_text: Optional[str] = rest_field(name="displayText") + """Display text.""" + item_path: Optional[str] = rest_field(name="itemPath") + """Item path.""" + resource_id: Optional[str] = rest_field(name="resourceId") + """Resource Id.""" + properties: Optional[Dict[str, Any]] = rest_field() + """Dictionary of :code:``.""" + + @overload + def __init__( + self, + *, + guid: Optional[str] = None, + type_name: Optional[str] = None, + unique_attributes: Optional[Dict[str, Any]] = None, + name: Optional[str] = None, + display_text: Optional[str] = None, + item_path: Optional[str] = None, + resource_id: Optional[str] = None, + properties: Optional[Dict[str, Any]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class ResourceLink(_model_base.Model): + """ResourceLink. + + :ivar display_name: Display name for url. + :vartype display_name: str + :ivar url: web url. http or https. + :vartype url: str + """ + + display_name: Optional[str] = rest_field(name="displayName") + """Display name for url.""" + url: Optional[str] = rest_field() + """web url. http or https.""" + + @overload + def __init__( + self, + *, + display_name: Optional[str] = None, + url: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class SearchFacetItem(_model_base.Model): + """The content of a search facet result item. + + :ivar count: The count of the facet item. + :vartype count: int + :ivar facet: The name of the facet item. + :vartype facet: str + :ivar sort: Any object. + :vartype sort: any + """ + + count: Optional[int] = rest_field() + """The count of the facet item.""" + facet: Optional[str] = rest_field() + """The name of the facet item.""" + sort: Optional[Any] = rest_field() + """Any object.""" + + @overload + def __init__( + self, + *, + count: Optional[int] = None, + facet: Optional[str] = None, + sort: Optional[Any] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class SearchFacetItemValue(_model_base.Model): + """The content of a search facet result item. + + :ivar count: The count of the facet item. + :vartype count: int + :ivar value: The name of the facet item. + :vartype value: str + """ + + count: Optional[int] = rest_field() + """The count of the facet item.""" + value: Optional[str] = rest_field() + """The name of the facet item.""" + + @overload + def __init__( + self, + *, + count: Optional[int] = None, + value: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class SearchFacetResultValue(_model_base.Model): + """A facet list that consists of index fields assetType ,classification, + contactId, and label. When the facet is specified in the request, the value of + the facet is returned as an element of @search.facets. + + :ivar entity_type: Entity type. + :vartype entity_type: list[~azure.analytics.purview.datamap.models.SearchFacetItemValue] + :ivar asset_type: Asset type. + :vartype asset_type: list[~azure.analytics.purview.datamap.models.SearchFacetItemValue] + :ivar classification: Classification. + :vartype classification: list[~azure.analytics.purview.datamap.models.SearchFacetItemValue] + :ivar term: Term. + :vartype term: list[~azure.analytics.purview.datamap.models.SearchFacetItemValue] + :ivar contact_id: Contact id. + :vartype contact_id: list[~azure.analytics.purview.datamap.models.SearchFacetItemValue] + :ivar contact_type: Contact type. + :vartype contact_type: list[~azure.analytics.purview.datamap.models.SearchFacetItemValue] + :ivar label: Label. + :vartype label: list[~azure.analytics.purview.datamap.models.SearchFacetItemValue] + :ivar glossary_type: Glossary type. + :vartype glossary_type: list[~azure.analytics.purview.datamap.models.SearchFacetItemValue] + :ivar term_status: Term status. + :vartype term_status: list[~azure.analytics.purview.datamap.models.SearchFacetItemValue] + :ivar term_template: Term template. + :vartype term_template: list[~azure.analytics.purview.datamap.models.SearchFacetItemValue] + """ + + entity_type: Optional[List["_models.SearchFacetItemValue"]] = rest_field(name="entityType") + """Entity type.""" + asset_type: Optional[List["_models.SearchFacetItemValue"]] = rest_field(name="assetType") + """Asset type.""" + classification: Optional[List["_models.SearchFacetItemValue"]] = rest_field() + """Classification.""" + term: Optional[List["_models.SearchFacetItemValue"]] = rest_field() + """Term.""" + contact_id: Optional[List["_models.SearchFacetItemValue"]] = rest_field(name="contactId") + """Contact id.""" + contact_type: Optional[List["_models.SearchFacetItemValue"]] = rest_field(name="contactType") + """Contact type.""" + label: Optional[List["_models.SearchFacetItemValue"]] = rest_field() + """Label.""" + glossary_type: Optional[List["_models.SearchFacetItemValue"]] = rest_field(name="glossaryType") + """Glossary type.""" + term_status: Optional[List["_models.SearchFacetItemValue"]] = rest_field(name="termStatus") + """Term status.""" + term_template: Optional[List["_models.SearchFacetItemValue"]] = rest_field(name="termTemplate") + """Term template.""" + + @overload + def __init__( + self, + *, + entity_type: Optional[List["_models.SearchFacetItemValue"]] = None, + asset_type: Optional[List["_models.SearchFacetItemValue"]] = None, + classification: Optional[List["_models.SearchFacetItemValue"]] = None, + term: Optional[List["_models.SearchFacetItemValue"]] = None, + contact_id: Optional[List["_models.SearchFacetItemValue"]] = None, + contact_type: Optional[List["_models.SearchFacetItemValue"]] = None, + label: Optional[List["_models.SearchFacetItemValue"]] = None, + glossary_type: Optional[List["_models.SearchFacetItemValue"]] = None, + term_status: Optional[List["_models.SearchFacetItemValue"]] = None, + term_template: Optional[List["_models.SearchFacetItemValue"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class SearchHighlights(_model_base.Model): + """A highlight list that consists of index fields id ,qualifiedName, name, + description, entityType. When the keyword appears in those fields, the value of + the field, attached with emphasis mark, is returned as an element of + @search.highlights. + + :ivar id: Id. + :vartype id: list[str] + :ivar qualified_name: Qualified name. + :vartype qualified_name: list[str] + :ivar name: Name. + :vartype name: list[str] + :ivar description: Description. + :vartype description: list[str] + :ivar entity_type: Entity type. + :vartype entity_type: list[str] + """ + + id: Optional[List[str]] = rest_field() + """Id.""" + qualified_name: Optional[List[str]] = rest_field(name="qualifiedName") + """Qualified name.""" + name: Optional[List[str]] = rest_field() + """Name.""" + description: Optional[List[str]] = rest_field() + """Description.""" + entity_type: Optional[List[str]] = rest_field(name="entityType") + """Entity type.""" + + @overload + def __init__( + self, + *, + id: Optional[List[str]] = None, # pylint: disable=redefined-builtin + qualified_name: Optional[List[str]] = None, + name: Optional[List[str]] = None, + description: Optional[List[str]] = None, + entity_type: Optional[List[str]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class SearchRequest(_model_base.Model): + """The search query of advanced search request. + + :ivar keywords: The keywords applied to all searchable fields. + :vartype keywords: str + :ivar limit: The limit of the number of the search result. default value is 50; maximum + value is 1000. + :vartype limit: int + :ivar continuation_token: The token used to get next batch of data. Default 'Null' to get the + first + batch, and will return new token in each response unless there's no more data. + :vartype continuation_token: str + :ivar orderby: The sort order of search results, can specify multiple fields. + :vartype orderby: list[any] + :ivar filter: The filter for the search. See examples for the usage of supported filters. + :vartype filter: any + :ivar facets: The facets for search. See examples for the usage of supported facets. + :vartype facets: list[~azure.analytics.purview.datamap.models.SearchFacetItem] + :ivar taxonomy_setting: The taxonomy setting for search. + :vartype taxonomy_setting: ~azure.analytics.purview.datamap.models.SearchRequestTaxonomySetting + """ + + keywords: Optional[str] = rest_field() + """The keywords applied to all searchable fields.""" + limit: Optional[int] = rest_field() + """The limit of the number of the search result. default value is 50; maximum + value is 1000.""" + continuation_token: Optional[str] = rest_field(name="continuationToken") + """The token used to get next batch of data. Default 'Null' to get the first + batch, and will return new token in each response unless there's no more data.""" + orderby: Optional[List[Any]] = rest_field() + """The sort order of search results, can specify multiple fields.""" + filter: Optional[Any] = rest_field() + """The filter for the search. See examples for the usage of supported filters.""" + facets: Optional[List["_models.SearchFacetItem"]] = rest_field() + """The facets for search. See examples for the usage of supported facets.""" + taxonomy_setting: Optional["_models.SearchRequestTaxonomySetting"] = rest_field(name="taxonomySetting") + """The taxonomy setting for search.""" + + @overload + def __init__( + self, + *, + keywords: Optional[str] = None, + limit: Optional[int] = None, + continuation_token: Optional[str] = None, + orderby: Optional[List[Any]] = None, + filter: Optional[Any] = None, # pylint: disable=redefined-builtin + facets: Optional[List["_models.SearchFacetItem"]] = None, + taxonomy_setting: Optional["_models.SearchRequestTaxonomySetting"] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class SearchRequestTaxonomySetting(_model_base.Model): + """Taxonomy setting for search request. + + :ivar asset_types: Asset types. + :vartype asset_types: list[str] + :ivar facet: The content of a search facet result item. + :vartype facet: ~azure.analytics.purview.datamap.models.SearchFacetItem + """ + + asset_types: Optional[List[str]] = rest_field(name="assetTypes") + """Asset types.""" + facet: Optional["_models.SearchFacetItem"] = rest_field() + """The content of a search facet result item.""" + + @overload + def __init__( + self, + *, + asset_types: Optional[List[str]] = None, + facet: Optional["_models.SearchFacetItem"] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class SearchResult(_model_base.Model): + """The result of the search result. + + :ivar search_count: The total number of search results (not the number of documents in a single + page). + :vartype search_count: int + :ivar search_count_approximate: 'True' if the '@search.count' is an approximate value and vise + versa. + :vartype search_count_approximate: bool + :ivar continuation_token: The token used to get next batch of data. Absent if there's no more + data. + :vartype continuation_token: str + :ivar search_facets: A facet list that consists of index fields assetType ,classification, + contactId, and label. When the facet is specified in the request, the value of + the facet is returned as an element of @search.facets. + :vartype search_facets: ~azure.analytics.purview.datamap.models.SearchFacetResultValue + :ivar value: Search result value. + :vartype value: list[~azure.analytics.purview.datamap.models.SearchResultValue] + """ + + search_count: Optional[int] = rest_field(name="@search.count") + """The total number of search results (not the number of documents in a single + page).""" + search_count_approximate: Optional[bool] = rest_field(name="@search.count.approximate") + """'True' if the '@search.count' is an approximate value and vise versa.""" + continuation_token: Optional[str] = rest_field(name="continuationToken") + """The token used to get next batch of data. Absent if there's no more data.""" + search_facets: Optional["_models.SearchFacetResultValue"] = rest_field(name="@search.facets") + """A facet list that consists of index fields assetType ,classification, + contactId, and label. When the facet is specified in the request, the value of + the facet is returned as an element of @search.facets.""" + value: Optional[List["_models.SearchResultValue"]] = rest_field() + """Search result value.""" + + @overload + def __init__( + self, + *, + search_count: Optional[int] = None, + search_count_approximate: Optional[bool] = None, + continuation_token: Optional[str] = None, + search_facets: Optional["_models.SearchFacetResultValue"] = None, + value: Optional[List["_models.SearchResultValue"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class SearchResultValue(_model_base.Model): # pylint: disable=too-many-instance-attributes + """The value item of the search result. + + :ivar search_score: The search score calculated by the search engine. The results are ordered + by + search score by default. + :vartype search_score: float + :ivar search_highlights: A highlight list that consists of index fields id ,qualifiedName, + name, + description, entityType. When the keyword appears in those fields, the value of + the field, attached with emphasis mark, is returned as an element of + @search.highlights. + :vartype search_highlights: ~azure.analytics.purview.datamap.models.SearchHighlights + :ivar object_type: The object type of the record. Object type is the top-level property to + distinguish whether a record is an asset or a term. + :vartype object_type: str + :ivar create_time: The create time of the record. The Unix epoch format. + :vartype create_time: int + :ivar update_time: The last update time of the record. The Unix epoch format. + :vartype update_time: int + :ivar id: The GUID of the record. + :vartype id: str + :ivar name: The name of the record. + :vartype name: str + :ivar qualified_name: The qualified name of the record. + :vartype qualified_name: str + :ivar entity_type: The type name of the asset. + :vartype entity_type: str + :ivar description: The description of the asset. + :vartype description: str + :ivar endorsement: The endorsement of the asset. + :vartype endorsement: str + :ivar owner: The owner of the record. + :vartype owner: str + :ivar classification: The classifications of the record. + :vartype classification: list[str] + :ivar label: The labels of the asset. + :vartype label: list[str] + :ivar term: The terms assigned to the asset. + :vartype term: list[~azure.analytics.purview.datamap.models.TermSearchResultValue] + :ivar contact: The contacts of the asset. + :vartype contact: list[~azure.analytics.purview.datamap.models.ContactSearchResultValue] + :ivar asset_type: The asset types of the asset. + :vartype asset_type: list[str] + :ivar glossary_type: The type name of the term. Could be AtlasGlossary, AtlasGlossaryTerm or + AtlasGlossaryCategory. + :vartype glossary_type: str + :ivar glossary: The glossary name of the term. + :vartype glossary: str + :ivar term_status: The status of the term. + :vartype term_status: str + :ivar term_template: The term template names used by the term. + :vartype term_template: list[str] + :ivar long_description: The definition of the term. + :vartype long_description: str + """ + + search_score: Optional[float] = rest_field(name="@search.score") + """The search score calculated by the search engine. The results are ordered by + search score by default.""" + search_highlights: Optional["_models.SearchHighlights"] = rest_field(name="@search.highlights") + """A highlight list that consists of index fields id ,qualifiedName, name, + description, entityType. When the keyword appears in those fields, the value of + the field, attached with emphasis mark, is returned as an element of + @search.highlights.""" + object_type: Optional[str] = rest_field(name="objectType") + """The object type of the record. Object type is the top-level property to + distinguish whether a record is an asset or a term.""" + create_time: Optional[int] = rest_field(name="createTime") + """The create time of the record. The Unix epoch format.""" + update_time: Optional[int] = rest_field(name="updateTime") + """The last update time of the record. The Unix epoch format.""" + id: Optional[str] = rest_field() + """The GUID of the record.""" + name: Optional[str] = rest_field() + """The name of the record.""" + qualified_name: Optional[str] = rest_field(name="qualifiedName") + """The qualified name of the record.""" + entity_type: Optional[str] = rest_field(name="entityType") + """The type name of the asset.""" + description: Optional[str] = rest_field() + """The description of the asset.""" + endorsement: Optional[str] = rest_field() + """The endorsement of the asset.""" + owner: Optional[str] = rest_field() + """The owner of the record.""" + classification: Optional[List[str]] = rest_field() + """The classifications of the record.""" + label: Optional[List[str]] = rest_field() + """The labels of the asset.""" + term: Optional[List["_models.TermSearchResultValue"]] = rest_field() + """The terms assigned to the asset.""" + contact: Optional[List["_models.ContactSearchResultValue"]] = rest_field() + """The contacts of the asset.""" + asset_type: Optional[List[str]] = rest_field(name="assetType") + """The asset types of the asset.""" + glossary_type: Optional[str] = rest_field(name="glossaryType") + """The type name of the term. Could be AtlasGlossary, AtlasGlossaryTerm or + AtlasGlossaryCategory.""" + glossary: Optional[str] = rest_field() + """The glossary name of the term.""" + term_status: Optional[str] = rest_field(name="termStatus") + """The status of the term.""" + term_template: Optional[List[str]] = rest_field(name="termTemplate") + """The term template names used by the term.""" + long_description: Optional[str] = rest_field(name="longDescription") + """The definition of the term.""" + + @overload + def __init__( + self, + *, + search_score: Optional[float] = None, + search_highlights: Optional["_models.SearchHighlights"] = None, + object_type: Optional[str] = None, + create_time: Optional[int] = None, + update_time: Optional[int] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + qualified_name: Optional[str] = None, + entity_type: Optional[str] = None, + description: Optional[str] = None, + endorsement: Optional[str] = None, + owner: Optional[str] = None, + classification: Optional[List[str]] = None, + label: Optional[List[str]] = None, + term: Optional[List["_models.TermSearchResultValue"]] = None, + contact: Optional[List["_models.ContactSearchResultValue"]] = None, + asset_type: Optional[List[str]] = None, + glossary_type: Optional[str] = None, + glossary: Optional[str] = None, + term_status: Optional[str] = None, + term_template: Optional[List[str]] = None, + long_description: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class SuggestRequest(_model_base.Model): + """The query of suggest request. + + :ivar keywords: The keywords applied to all fields that support suggest operation. It must be + at least 1 character, and no more than 100 characters. In the index schema we + defined a default suggester which lists all the supported fields and specifies + a search mode. + :vartype keywords: str + :ivar limit: The number of suggestions we hope to return. The default value is 5. The value + must be a number between 1 and 100. + :vartype limit: int + :ivar filter: The filter for the search. + :vartype filter: any + """ + + keywords: Optional[str] = rest_field() + """The keywords applied to all fields that support suggest operation. It must be + at least 1 character, and no more than 100 characters. In the index schema we + defined a default suggester which lists all the supported fields and specifies + a search mode.""" + limit: Optional[int] = rest_field() + """The number of suggestions we hope to return. The default value is 5. The value + must be a number between 1 and 100.""" + filter: Optional[Any] = rest_field() + """The filter for the search.""" + + @overload + def __init__( + self, + *, + keywords: Optional[str] = None, + limit: Optional[int] = None, + filter: Optional[Any] = None, # pylint: disable=redefined-builtin + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class SuggestResult(_model_base.Model): + """The result item of the search suggest. + + :ivar value: The result value. + :vartype value: list[~azure.analytics.purview.datamap.models.SuggestResultValue] + """ + + value: Optional[List["_models.SuggestResultValue"]] = rest_field() + """The result value.""" + + @overload + def __init__( + self, + *, + value: Optional[List["_models.SuggestResultValue"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class SuggestResultValue(_model_base.Model): # pylint: disable=too-many-instance-attributes + """The value item of the search suggest. + + :ivar search_score: The search score calculated by the search engine. The results are ordered + by + search score by default. + :vartype search_score: float + :ivar search_text: The target text that contains the keyword as prefix. The keyword is wrapped + with emphasis mark. + :vartype search_text: str + :ivar object_type: The object type of the record. Object type is the top-level property to + distinguish whether a record is an asset or a term. + :vartype object_type: str + :ivar create_time: The create time of the record. The Unix epoch format. + :vartype create_time: int + :ivar update_time: The last update time of the record. The Unix epoch format. + :vartype update_time: int + :ivar id: The GUID of the record. + :vartype id: str + :ivar name: The name of the record. + :vartype name: str + :ivar qualified_name: The qualified name of the record. + :vartype qualified_name: str + :ivar entity_type: The type name of the asset. + :vartype entity_type: str + :ivar description: The description of the asset. + :vartype description: str + :ivar endorsement: The endorsement of the asset. + :vartype endorsement: str + :ivar owner: The owner of the record. + :vartype owner: str + :ivar classification: The classifications of the record. + :vartype classification: list[str] + :ivar label: The labels of the asset. + :vartype label: list[str] + :ivar term: The terms assigned to the asset. + :vartype term: list[~azure.analytics.purview.datamap.models.TermSearchResultValue] + :ivar contact: The contacts of the asset. + :vartype contact: list[~azure.analytics.purview.datamap.models.ContactSearchResultValue] + :ivar asset_type: The asset types of the asset. + :vartype asset_type: list[str] + :ivar glossary_type: The type name of the term. Could be AtlasGlossary, AtlasGlossaryTerm or + AtlasGlossaryCategory. + :vartype glossary_type: str + :ivar glossary: The glossary name of the term. + :vartype glossary: str + :ivar term_status: The status of the term. + :vartype term_status: str + :ivar term_template: The term template names used by the term. + :vartype term_template: list[str] + :ivar long_description: The definition of the term. + :vartype long_description: str + """ + + search_score: Optional[float] = rest_field(name="@search.score") + """The search score calculated by the search engine. The results are ordered by + search score by default.""" + search_text: Optional[str] = rest_field(name="@search.text") + """The target text that contains the keyword as prefix. The keyword is wrapped + with emphasis mark.""" + object_type: Optional[str] = rest_field(name="objectType") + """The object type of the record. Object type is the top-level property to + distinguish whether a record is an asset or a term.""" + create_time: Optional[int] = rest_field(name="createTime") + """The create time of the record. The Unix epoch format.""" + update_time: Optional[int] = rest_field(name="updateTime") + """The last update time of the record. The Unix epoch format.""" + id: Optional[str] = rest_field() + """The GUID of the record.""" + name: Optional[str] = rest_field() + """The name of the record.""" + qualified_name: Optional[str] = rest_field(name="qualifiedName") + """The qualified name of the record.""" + entity_type: Optional[str] = rest_field(name="entityType") + """The type name of the asset.""" + description: Optional[str] = rest_field() + """The description of the asset.""" + endorsement: Optional[str] = rest_field() + """The endorsement of the asset.""" + owner: Optional[str] = rest_field() + """The owner of the record.""" + classification: Optional[List[str]] = rest_field() + """The classifications of the record.""" + label: Optional[List[str]] = rest_field() + """The labels of the asset.""" + term: Optional[List["_models.TermSearchResultValue"]] = rest_field() + """The terms assigned to the asset.""" + contact: Optional[List["_models.ContactSearchResultValue"]] = rest_field() + """The contacts of the asset.""" + asset_type: Optional[List[str]] = rest_field(name="assetType") + """The asset types of the asset.""" + glossary_type: Optional[str] = rest_field(name="glossaryType") + """The type name of the term. Could be AtlasGlossary, AtlasGlossaryTerm or + AtlasGlossaryCategory.""" + glossary: Optional[str] = rest_field() + """The glossary name of the term.""" + term_status: Optional[str] = rest_field(name="termStatus") + """The status of the term.""" + term_template: Optional[List[str]] = rest_field(name="termTemplate") + """The term template names used by the term.""" + long_description: Optional[str] = rest_field(name="longDescription") + """The definition of the term.""" + + @overload + def __init__( + self, + *, + search_score: Optional[float] = None, + search_text: Optional[str] = None, + object_type: Optional[str] = None, + create_time: Optional[int] = None, + update_time: Optional[int] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + qualified_name: Optional[str] = None, + entity_type: Optional[str] = None, + description: Optional[str] = None, + endorsement: Optional[str] = None, + owner: Optional[str] = None, + classification: Optional[List[str]] = None, + label: Optional[List[str]] = None, + term: Optional[List["_models.TermSearchResultValue"]] = None, + contact: Optional[List["_models.ContactSearchResultValue"]] = None, + asset_type: Optional[List[str]] = None, + glossary_type: Optional[str] = None, + glossary: Optional[str] = None, + term_status: Optional[str] = None, + term_template: Optional[List[str]] = None, + long_description: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class TermSearchResultValue(_model_base.Model): + """The context. + + :ivar name: The name of the term. + :vartype name: str + :ivar glossary_name: The name of the glossary which contains the term. + :vartype glossary_name: str + :ivar guid: The GUID of the term. + :vartype guid: str + """ + + name: Optional[str] = rest_field() + """The name of the term.""" + glossary_name: Optional[str] = rest_field(name="glossaryName") + """The name of the glossary which contains the term.""" + guid: Optional[str] = rest_field() + """The GUID of the term.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + glossary_name: Optional[str] = None, + guid: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class TermTemplateDef(_model_base.Model): # pylint: disable=too-many-instance-attributes + """Term template definition for glossary term. + + :ivar category: The enum of type category. Known values are: "PRIMITIVE", "OBJECT_ID_TYPE", + "ENUM", "STRUCT", "CLASSIFICATION", "ENTITY", "ARRAY", "MAP", "RELATIONSHIP", and + "TERM_TEMPLATE". + :vartype category: str or ~azure.analytics.purview.datamap.models.TypeCategory + :ivar create_time: The created time of the record. + :vartype create_time: int + :ivar created_by: The user who created the record. + :vartype created_by: str + :ivar date_formatter: The date format. + :vartype date_formatter: ~azure.analytics.purview.datamap.models.DateFormat + :ivar description: The description of the type definition. + :vartype description: str + :ivar guid: The GUID of the type definition. + :vartype guid: str + :ivar name: The name of the type definition. + :vartype name: str + :ivar options: The options for the type definition. + :vartype options: dict[str, str] + :ivar service_type: The service type. + :vartype service_type: str + :ivar type_version: The version of the type. + :vartype type_version: str + :ivar update_time: The update time of the record. + :vartype update_time: int + :ivar updated_by: The user who updated the record. + :vartype updated_by: str + :ivar version: The version of the record. + :vartype version: int + :ivar last_modified_t_s: ETag for concurrency control. + :vartype last_modified_t_s: str + :ivar attribute_defs: An array of attribute definitions. + :vartype attribute_defs: list[~azure.analytics.purview.datamap.models.AtlasAttributeDef] + """ + + category: Optional[Union[str, "_models.TypeCategory"]] = rest_field() + """The enum of type category. Known values are: \"PRIMITIVE\", \"OBJECT_ID_TYPE\", \"ENUM\", + \"STRUCT\", \"CLASSIFICATION\", \"ENTITY\", \"ARRAY\", \"MAP\", \"RELATIONSHIP\", and + \"TERM_TEMPLATE\".""" + create_time: Optional[int] = rest_field(name="createTime") + """The created time of the record.""" + created_by: Optional[str] = rest_field(name="createdBy") + """The user who created the record.""" + date_formatter: Optional["_models.DateFormat"] = rest_field(name="dateFormatter") + """The date format.""" + description: Optional[str] = rest_field() + """The description of the type definition.""" + guid: Optional[str] = rest_field() + """The GUID of the type definition.""" + name: Optional[str] = rest_field() + """The name of the type definition.""" + options: Optional[Dict[str, str]] = rest_field() + """The options for the type definition.""" + service_type: Optional[str] = rest_field(name="serviceType") + """The service type.""" + type_version: Optional[str] = rest_field(name="typeVersion") + """The version of the type.""" + update_time: Optional[int] = rest_field(name="updateTime") + """The update time of the record.""" + updated_by: Optional[str] = rest_field(name="updatedBy") + """The user who updated the record.""" + version: Optional[int] = rest_field() + """The version of the record.""" + last_modified_t_s: Optional[str] = rest_field(name="lastModifiedTS") + """ETag for concurrency control.""" + attribute_defs: Optional[List["_models.AtlasAttributeDef"]] = rest_field(name="attributeDefs") + """An array of attribute definitions.""" + + @overload + def __init__( + self, + *, + category: Optional[Union[str, "_models.TypeCategory"]] = None, + create_time: Optional[int] = None, + created_by: Optional[str] = None, + date_formatter: Optional["_models.DateFormat"] = None, + description: Optional[str] = None, + guid: Optional[str] = None, + name: Optional[str] = None, + options: Optional[Dict[str, str]] = None, + service_type: Optional[str] = None, + type_version: Optional[str] = None, + update_time: Optional[int] = None, + updated_by: Optional[str] = None, + version: Optional[int] = None, + last_modified_t_s: Optional[str] = None, + attribute_defs: Optional[List["_models.AtlasAttributeDef"]] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class TimeBoundary(_model_base.Model): + """Captures time-boundary details. + + :ivar end_time: The end of the time boundary. + :vartype end_time: str + :ivar start_time: The start of the time boundary. + :vartype start_time: str + :ivar time_zone: The timezone of the time boundary. + :vartype time_zone: str + """ + + end_time: Optional[str] = rest_field(name="endTime") + """The end of the time boundary.""" + start_time: Optional[str] = rest_field(name="startTime") + """The start of the time boundary.""" + time_zone: Optional[str] = rest_field(name="timeZone") + """The timezone of the time boundary.""" + + @overload + def __init__( + self, + *, + end_time: Optional[str] = None, + start_time: Optional[str] = None, + time_zone: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class TimeZone(_model_base.Model): + """The timezone information. + + :ivar dst_savings: The value of the daylight saving time. + :vartype dst_savings: int + :ivar id: The ID of the timezone. + :vartype id: str + :ivar available_ids: An array of available IDs. + :vartype available_ids: list[str] + :ivar default: The timezone information. + :vartype default: ~azure.analytics.purview.datamap.models.TimeZone + :ivar display_name: The display name of the timezone. + :vartype display_name: str + :ivar raw_offset: The raw offset of the timezone. + :vartype raw_offset: int + """ + + dst_savings: Optional[int] = rest_field(name="dstSavings") + """The value of the daylight saving time.""" + id: Optional[str] = rest_field() + """The ID of the timezone.""" + available_ids: Optional[List[str]] = rest_field(name="availableIds") + """An array of available IDs.""" + default: Optional["_models.TimeZone"] = rest_field() + """The timezone information.""" + display_name: Optional[str] = rest_field(name="displayName") + """The display name of the timezone.""" + raw_offset: Optional[int] = rest_field(name="rawOffset") + """The raw offset of the timezone.""" + + @overload + def __init__( + self, + *, + dst_savings: Optional[int] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + available_ids: Optional[List[str]] = None, + default: Optional["_models.TimeZone"] = None, + display_name: Optional[str] = None, + raw_offset: Optional[int] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/models/_patch.py b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/models/_patch.py new file mode 100644 index 0000000000000..f7dd32510333d --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/py.typed b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/py.typed new file mode 100644 index 0000000000000..e5aff4f83af86 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/azure/analytics/purview/datamap/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/purview/azure-analytics-purview-datamap/dev_requirements.txt b/sdk/purview/azure-analytics-purview-datamap/dev_requirements.txt new file mode 100644 index 0000000000000..c4e89ba26d715 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/dev_requirements.txt @@ -0,0 +1,5 @@ +-e ../../../tools/azure-devtools +-e ../../../tools/azure-sdk-tools +../../core/azure-core +../../identity/azure-identity +aiohttp \ No newline at end of file diff --git a/sdk/purview/azure-analytics-purview-datamap/sdk_packaging.toml b/sdk/purview/azure-analytics-purview-datamap/sdk_packaging.toml new file mode 100644 index 0000000000000..e7687fdae93bc --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/sdk_packaging.toml @@ -0,0 +1,2 @@ +[packaging] +auto_update = false \ No newline at end of file diff --git a/sdk/purview/azure-analytics-purview-datamap/setup.py b/sdk/purview/azure-analytics-purview-datamap/setup.py new file mode 100644 index 0000000000000..912702b57a2e2 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/setup.py @@ -0,0 +1,72 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# coding: utf-8 + +import os +import re +from setuptools import setup, find_packages + + +PACKAGE_NAME = "azure-analytics-purview-datamap" +PACKAGE_PPRINT_NAME = "Azure Analytics Purview Datamap" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace("-", "/") + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, "_version.py"), "r") as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError("Cannot find version information") + + +setup( + name=PACKAGE_NAME, + version=version, + description="Microsoft {} Client Library for Python".format(PACKAGE_PPRINT_NAME), + long_description=open("README.md", "r").read(), + long_description_content_type="text/markdown", + license="MIT License", + author="Microsoft Corporation", + author_email="azpysdkhelp@microsoft.com", + url="https://github.com/Azure/azure-sdk-for-python/tree/main/sdk", + keywords="azure, azure sdk", + classifiers=[ + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "License :: OSI Approved :: MIT License", + ], + zip_safe=False, + packages=find_packages( + exclude=[ + "tests", + # Exclude packages that will be covered by PEP420 or nspkg + "azure", + "azure.analytics", + "azure.analytics.purview", + ] + ), + include_package_data=True, + package_data={ + "azure.analytics.purview.datamap": ["py.typed"], + }, + install_requires=[ + "isodate<1.0.0,>=0.6.1", + "azure-core<2.0.0,>=1.28.0", + "typing-extensions>=4.3.0; python_version<'3.8.0'", + ], + python_requires=">=3.7", +) diff --git a/sdk/purview/azure-analytics-purview-datamap/tsp-location.yaml b/sdk/purview/azure-analytics-purview-datamap/tsp-location.yaml new file mode 100644 index 0000000000000..cec23cc89fb31 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-datamap/tsp-location.yaml @@ -0,0 +1,5 @@ +additionalDirectories: [] +directory: specification/purview/Azure.Analytics.Purview.DataMap +commit: e2d12f2c2352e634cbb405b7ceca438ead8b53fd +repo: Azure/azure-rest-api-specs + diff --git a/sdk/purview/ci.yml b/sdk/purview/ci.yml index 7f450e452a842..51f1f5203019c 100644 --- a/sdk/purview/ci.yml +++ b/sdk/purview/ci.yml @@ -42,3 +42,5 @@ extends: safeName: azurepurviewworkflow - name: azure-purview-sharing safeNAme: azurepurviewsharing + - name: azure-analytics-purview-datamap + safeName: azureanalyticspurviewdatamap