From e1b1787005d9dce590d69981a723d860effffa9d Mon Sep 17 00:00:00 2001 From: msyyc <70930885+msyyc@users.noreply.github.com> Date: Wed, 18 Aug 2021 11:23:41 +0800 Subject: [PATCH 1/8] purview account --- .../azure-purview-account/CHANGELOG.md | 5 + sdk/purview/azure-purview-account/MANIFEST.in | 5 + sdk/purview/azure-purview-account/README.md | 164 ++++ .../azure-purview-account/azure/__init__.py | 1 + .../azure/purview/__init__.py | 1 + .../azure/purview/account/__init__.py | 19 + .../azure/purview/account/_configuration.py | 70 ++ .../account/_purview_account_client.py | 98 +++ .../azure/purview/account/_version.py | 9 + .../azure/purview/account/aio/__init__.py | 10 + .../purview/account/aio/_configuration.py | 66 ++ .../account/aio/_purview_account_client.py | 93 +++ .../azure/purview/account/py.typed | 1 + .../azure/purview/account/rest/__init__.py | 6 + .../purview/account/rest/accounts/__init__.py | 25 + .../rest/accounts/_request_builders.py | 358 +++++++++ .../rest/accounts/_request_builders_py3.py | 359 +++++++++ .../account/rest/collections/__init__.py | 31 + .../rest/collections/_request_builders.py | 427 +++++++++++ .../rest/collections/_request_builders_py3.py | 421 +++++++++++ .../rest/resource_set_rules/__init__.py | 25 + .../resource_set_rules/_request_builders.py | 715 ++++++++++++++++++ .../_request_builders_py3.py | 711 +++++++++++++++++ .../dev_requirements.txt | 6 + .../azure-purview-account/sdk_packaging.toml | 9 + sdk/purview/azure-purview-account/setup.cfg | 2 + sdk/purview/azure-purview-account/setup.py | 89 +++ .../azure-purview-account/swagger/README.md | 36 + .../azure-purview-account/tests/_util.py | 13 + .../azure-purview-account/tests/conftest.py | 15 + .../test_smoke.test_basic_smoke_test.yaml | 34 + ...est_smoke_async.test_basic_smoke_test.yaml | 24 + .../azure-purview-account/tests/test_smoke.py | 21 + .../tests/test_smoke_async.py | 21 + .../azure-purview-account/tests/testcase.py | 32 + .../tests/testcase_async.py | 23 + sdk/purview/ci.yml | 2 + 37 files changed, 3947 insertions(+) create mode 100644 sdk/purview/azure-purview-account/CHANGELOG.md create mode 100644 sdk/purview/azure-purview-account/MANIFEST.in create mode 100644 sdk/purview/azure-purview-account/README.md create mode 100644 sdk/purview/azure-purview-account/azure/__init__.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/__init__.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/__init__.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/_configuration.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/_purview_account_client.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/_version.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/aio/__init__.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/aio/_configuration.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/aio/_purview_account_client.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/py.typed create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/rest/__init__.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/__init__.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/_request_builders.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/_request_builders_py3.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/rest/collections/__init__.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/rest/collections/_request_builders.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/rest/collections/_request_builders_py3.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/__init__.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/_request_builders.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/_request_builders_py3.py create mode 100644 sdk/purview/azure-purview-account/dev_requirements.txt create mode 100644 sdk/purview/azure-purview-account/sdk_packaging.toml create mode 100644 sdk/purview/azure-purview-account/setup.cfg create mode 100644 sdk/purview/azure-purview-account/setup.py create mode 100644 sdk/purview/azure-purview-account/swagger/README.md create mode 100644 sdk/purview/azure-purview-account/tests/_util.py create mode 100644 sdk/purview/azure-purview-account/tests/conftest.py create mode 100644 sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_basic_smoke_test.yaml create mode 100644 sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_basic_smoke_test.yaml create mode 100644 sdk/purview/azure-purview-account/tests/test_smoke.py create mode 100644 sdk/purview/azure-purview-account/tests/test_smoke_async.py create mode 100644 sdk/purview/azure-purview-account/tests/testcase.py create mode 100644 sdk/purview/azure-purview-account/tests/testcase_async.py diff --git a/sdk/purview/azure-purview-account/CHANGELOG.md b/sdk/purview/azure-purview-account/CHANGELOG.md new file mode 100644 index 000000000000..6e4194adf085 --- /dev/null +++ b/sdk/purview/azure-purview-account/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0b1 (2021-08-11) + +- This is the initial release of the Azure Purview Account library. diff --git a/sdk/purview/azure-purview-account/MANIFEST.in b/sdk/purview/azure-purview-account/MANIFEST.in new file mode 100644 index 000000000000..f15ff0ee5293 --- /dev/null +++ b/sdk/purview/azure-purview-account/MANIFEST.in @@ -0,0 +1,5 @@ +recursive-include tests *.py +recursive-include samples *.py *.md +include *.md +include azure/__init__.py +include azure/purview/__init__.py \ No newline at end of file diff --git a/sdk/purview/azure-purview-account/README.md b/sdk/purview/azure-purview-account/README.md new file mode 100644 index 000000000000..c7b1421a766d --- /dev/null +++ b/sdk/purview/azure-purview-account/README.md @@ -0,0 +1,164 @@ +# Azure Purview Account client library for Python + +Azure Purview Account is a fully managed cloud service. + +**Please rely heavily on the [service's documentation][account_product_documentation] and our [client docs][request_builders_and_client] to use this library** + +[Source code][source_code] | [Package (PyPI)][account_pypi] | [API reference documentation][account_ref_docs]| [Product documentation][account_product_documentation] + +## Getting started + +### Prerequisites + +- Python 2.7, or 3.6 or later is required to use this package. +- You must have an [Azure subscription][azure_subscription] and a [Purview][purview_resource] to use this package. + +#### Create a Purview Resource + +Follow [these][purview_resource] instructions to create your Purview resource + +### Install the package + +Install the Azure Purview Account client library for Python with [pip][pip]: + +```bash +pip install azure-purview-account +``` + +### Authenticate the client + +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] and +[enable AAD authentication on your Purview resource][enable_aad] + +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.purview.account import PurviewAccountClient +from azure.identity import DefaultAzureCredential + +credential = DefaultAzureCredential() +client = PurviewAccountClient(endpoint="https://.purview.azure.com", credential=credential) +``` + +## Key concepts + +### Client + +This package offers request builders so you can build http requests and send these requests to the service using the `send_request` method. +For more information on how to use request builders and our clients, see [here][request_builders_and_client]. + +## Examples + +The following section shows you how to initialize and authenticate your client, then list all of your keys. + +- [List All Keys](#list-all-keys "List All Keys") + +### List All Keys + +```python +from azure.purview.account import PurviewAccountClient +from azure.identity import DefaultAzureCredential +from azure.purview.account.rest import accounts +from azure.core.exceptions import HttpResponseError + +credential = DefaultAzureCredential() +client = PurviewAccountClient(endpoint="https://.purview.azure.com", credential=credential) + +request = accounts.build_list_keys_request() + +response = client.send_request(request) +try: + response.raise_for_status() + assert response.status_code == 200 + +except HttpResponseError as e: + print(e) +``` + +## Troubleshooting + +### General + +The Purview Account client will raise exceptions defined in [Azure Core][azure_core] if you call `.raise_for_status()` on your responses. + +### Logging + +This library uses the standard +[logging][python_logging] library for logging. +Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO +level. + +Detailed DEBUG level logging, including request/response bodies and unredacted +headers, can be enabled on a client with the `logging_enable` keyword argument: + +```python +import sys +import logging +from azure.identity import DefaultAzureCredential +from azure.purview.account import PurviewAccountClient + +# Create a logger for the 'azure' SDK +logger = logging.getLogger('azure') +logger.setLevel(logging.DEBUG) + +# Configure a console output +handler = logging.StreamHandler(stream=sys.stdout) +logger.addHandler(handler) + +endpoint = "https://.purview.azure.com" +credential = DefaultAzureCredential() + +# This client will log detailed information about its HTTP sessions, at DEBUG level +client = PurviewAccountClient(endpoint=endpoint, credential=credential, logging_enable=True) +``` + +Similarly, `logging_enable` can enable detailed logging for a single `send_request` call, +even when it isn't enabled for the client: + +```python +result = client.send_request(request, logging_enable=True) +``` + +## Next steps + +For more generic samples, see our [client docs][request_builders_and_client]. + +## 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 [cla.microsoft.com][cla]. + +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][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments. + + + +[source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/purview/ +[account_pypi]: https://pypi.org/project/azure-purview-catalog/#history +[account_ref_docs]: https://azure.github.io/azure-sdk-for-python/ +[account_product_documentation]: https://azure.microsoft.com/services/purview/ +[azure_subscription]: https://azure.microsoft.com/free/ +[purview_resource]: https://docs.microsoft.com/azure/purview/create-catalog-portal +[pip]: https://pypi.org/project/pip/ +[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 +[request_builders_and_client]: https://aka.ms/azsdk/python/protocol/quickstart +[enable_aad]: https://docs.microsoft.com/azure/purview/create-catalog-portal#add-a-security-principal-to-a-data-plane-role +[python_logging]: https://docs.python.org/3.5/library/logging.html +[cla]: https://cla.microsoft.com +[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ +[coc_contact]: mailto:opencode@microsoft.com diff --git a/sdk/purview/azure-purview-account/azure/__init__.py b/sdk/purview/azure-purview-account/azure/__init__.py new file mode 100644 index 000000000000..5960c353a898 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore \ No newline at end of file diff --git a/sdk/purview/azure-purview-account/azure/purview/__init__.py b/sdk/purview/azure-purview-account/azure/purview/__init__.py new file mode 100644 index 000000000000..5960c353a898 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore \ No newline at end of file diff --git a/sdk/purview/azure-purview-account/azure/purview/account/__init__.py b/sdk/purview/azure-purview-account/azure/purview/account/__init__.py new file mode 100644 index 000000000000..d5c53ba7d43e --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/__init__.py @@ -0,0 +1,19 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._purview_account_client import PurviewAccountClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['PurviewAccountClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/purview/azure-purview-account/azure/purview/account/_configuration.py b/sdk/purview/azure-purview-account/azure/purview/account/_configuration.py new file mode 100644 index 000000000000..afa56e46859b --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/_configuration.py @@ -0,0 +1,70 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class PurviewAccountClientConfiguration(Configuration): + """Configuration for PurviewAccountClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param endpoint: The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com. + :type endpoint: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + endpoint, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + super(PurviewAccountClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.endpoint = endpoint + self.api_version = "2019-11-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://purview.azure.net/.default']) + kwargs.setdefault('sdk_moniker', 'purview-account/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> 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.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**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.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-purview-account/azure/purview/account/_purview_account_client.py b/sdk/purview/azure-purview-account/azure/purview/account/_purview_account_client.py new file mode 100644 index 000000000000..bab0b292867b --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/_purview_account_client.py @@ -0,0 +1,98 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import TYPE_CHECKING + +from azure.core import PipelineClient +from msrest import Deserializer, Serializer + +from ._configuration import PurviewAccountClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Dict + + from azure.core.credentials import TokenCredential + from azure.core.rest import HttpRequest, HttpResponse + +class PurviewAccountClient(object): + """Creates a Microsoft.Purview data plane account client. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param endpoint: The account endpoint of your Purview account. Example: + https://{accountName}.purview.azure.com. + :type endpoint: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + endpoint, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + base_url = '{endpoint}' + self._config = PurviewAccountClientConfiguration(credential, endpoint, **kwargs) + self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + + + def send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> HttpResponse + """Runs the network request through the client's chained policies. + + We have helper methods to create requests specific to this service in `azure.purview.account.rest`. + Use these helper methods to create the request you pass to this method. + + >>> from azure.purview.account.rest import accounts + >>> request = accounts.build_get_account_properties_request(**kwargs) + + >>> response = client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + For advanced cases, you can also create your own :class:`~azure.core.rest.HttpRequest` + and pass it in. + + :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, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> PurviewAccountClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/purview/azure-purview-account/azure/purview/account/_version.py b/sdk/purview/azure-purview-account/azure/purview/account/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/_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) AutoRest 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-purview-account/azure/purview/account/aio/__init__.py b/sdk/purview/azure-purview-account/azure/purview/account/aio/__init__.py new file mode 100644 index 000000000000..1e668f62d8c2 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/aio/__init__.py @@ -0,0 +1,10 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._purview_account_client import PurviewAccountClient +__all__ = ['PurviewAccountClient'] diff --git a/sdk/purview/azure-purview-account/azure/purview/account/aio/_configuration.py b/sdk/purview/azure-purview-account/azure/purview/account/aio/_configuration.py new file mode 100644 index 000000000000..bfd9b6b02f66 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/aio/_configuration.py @@ -0,0 +1,66 @@ +# 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) AutoRest 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.configuration import Configuration +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 PurviewAccountClientConfiguration(Configuration): + """Configuration for PurviewAccountClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param endpoint: The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com. + :type endpoint: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + endpoint: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + super(PurviewAccountClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.endpoint = endpoint + self.api_version = "2019-11-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://purview.azure.net/.default']) + kwargs.setdefault('sdk_moniker', 'purview-account/{}'.format(VERSION)) + 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.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**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.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-purview-account/azure/purview/account/aio/_purview_account_client.py b/sdk/purview/azure-purview-account/azure/purview/account/aio/_purview_account_client.py new file mode 100644 index 000000000000..66904282a240 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/aio/_purview_account_client.py @@ -0,0 +1,93 @@ +# 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) AutoRest 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.rest import AsyncHttpResponse, HttpRequest +from msrest import Deserializer, Serializer + +from ._configuration import PurviewAccountClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Dict + + from azure.core.credentials_async import AsyncTokenCredential + +class PurviewAccountClient: + """Creates a Microsoft.Purview data plane account client. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param endpoint: The account endpoint of your Purview account. Example: + https://{accountName}.purview.azure.com. + :type endpoint: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + endpoint: str, + **kwargs: Any + ) -> None: + base_url = '{endpoint}' + self._config = PurviewAccountClientConfiguration(credential, endpoint, **kwargs) + self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + We have helper methods to create requests specific to this service in `azure.purview.account.rest`. + Use these helper methods to create the request you pass to this method. + + >>> from azure.purview.account.rest import accounts + >>> request = accounts.build_get_account_properties_request(**kwargs) + + >>> response = await client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + For advanced cases, you can also create your own :class:`~azure.core.rest.HttpRequest` + and pass it in. + + :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, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "PurviewAccountClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/purview/azure-purview-account/azure/purview/account/py.typed b/sdk/purview/azure-purview-account/azure/purview/account/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/purview/azure-purview-account/azure/purview/account/rest/__init__.py b/sdk/purview/azure-purview-account/azure/purview/account/rest/__init__.py new file mode 100644 index 000000000000..8e6cf7ef9438 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/rest/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/__init__.py b/sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/__init__.py new file mode 100644 index 000000000000..cf4233c5c1cb --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/__init__.py @@ -0,0 +1,25 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._request_builders_py3 import build_get_account_properties_request + from ._request_builders_py3 import build_update_account_properties_request + from ._request_builders_py3 import build_get_access_keys_request + from ._request_builders_py3 import build_regenerate_access_key_request +except (SyntaxError, ImportError): + from ._request_builders import build_get_account_properties_request # type: ignore + from ._request_builders import build_update_account_properties_request # type: ignore + from ._request_builders import build_get_access_keys_request # type: ignore + from ._request_builders import build_regenerate_access_key_request # type: ignore + +__all__ = [ + 'build_get_account_properties_request', + 'build_update_account_properties_request', + 'build_get_access_keys_request', + 'build_regenerate_access_key_request', +] diff --git a/sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/_request_builders.py b/sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/_request_builders.py new file mode 100644 index 000000000000..e313fdfa6c14 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/_request_builders.py @@ -0,0 +1,358 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport._base import _format_url_section +from azure.core.rest import HttpRequest +from msrest import Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + +_SERIALIZER = Serializer() + +# fmt: off + +def build_get_account_properties_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """Get an account. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "id": "str (optional)", + "identity": { + "principalId": "str (optional)", + "tenantId": "str (optional)", + "type": "str (optional)" + }, + "location": "str (optional)", + "name": "str (optional)", + "properties": { + "cloudConnectors": { + "awsExternalId": "str (optional)" + }, + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByObjectId": "str (optional)", + "endpoints": { + "catalog": "str (optional)", + "guardian": "str (optional)", + "scan": "str (optional)" + }, + "friendlyName": "str (optional)", + "managedResourceGroupName": "str (optional)", + "managedResources": { + "eventHubNamespace": "str (optional)", + "resourceGroup": "str (optional)", + "storageAccount": "str (optional)" + }, + "privateEndpointConnections": [ + { + "id": "str (optional)", + "name": "str (optional)", + "properties": { + "privateEndpoint": { + "id": "str (optional)" + }, + "privateLinkServiceConnectionState": { + "actionsRequired": "str (optional)", + "description": "str (optional)", + "status": "str (optional)" + }, + "provisioningState": "str (optional)" + }, + "type": "str (optional)" + } + ], + "provisioningState": "str (optional)", + "publicNetworkAccess": "str (optional). Default value is \"Enabled\"" + }, + "sku": { + "capacity": "int (optional)", + "name": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + }, + "tags": { + "str": "str (optional)" + }, + "type": "str (optional)" + } + """ + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_account_properties_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """Updates an account. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in + our example to find the input shape. + :paramtype json: any + :keyword content: Pass in binary content you want in the body of the request (typically bytes, + a byte iterator, or stream input). + :paramtype content: any + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + json = { + "friendlyName": "str (optional)" + } + + # response body for status code(s): 200 + response.json() == { + "id": "str (optional)", + "identity": { + "principalId": "str (optional)", + "tenantId": "str (optional)", + "type": "str (optional)" + }, + "location": "str (optional)", + "name": "str (optional)", + "properties": { + "cloudConnectors": { + "awsExternalId": "str (optional)" + }, + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByObjectId": "str (optional)", + "endpoints": { + "catalog": "str (optional)", + "guardian": "str (optional)", + "scan": "str (optional)" + }, + "friendlyName": "str (optional)", + "managedResourceGroupName": "str (optional)", + "managedResources": { + "eventHubNamespace": "str (optional)", + "resourceGroup": "str (optional)", + "storageAccount": "str (optional)" + }, + "privateEndpointConnections": [ + { + "id": "str (optional)", + "name": "str (optional)", + "properties": { + "privateEndpoint": { + "id": "str (optional)" + }, + "privateLinkServiceConnectionState": { + "actionsRequired": "str (optional)", + "description": "str (optional)", + "status": "str (optional)" + }, + "provisioningState": "str (optional)" + }, + "type": "str (optional)" + } + ], + "provisioningState": "str (optional)", + "publicNetworkAccess": "str (optional). Default value is \"Enabled\"" + }, + "sku": { + "capacity": "int (optional)", + "name": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + }, + "tags": { + "str": "str (optional)" + }, + "type": "str (optional)" + } + """ + + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_access_keys_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """List the authorization keys associated with this account. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "atlasKafkaPrimaryEndpoint": "str (optional)", + "atlasKafkaSecondaryEndpoint": "str (optional)" + } + """ + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/listkeys') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_access_key_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """Regenerate the authorization keys associated with this data catalog. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in + our example to find the input shape. + :paramtype json: any + :keyword content: Pass in binary content you want in the body of the request (typically bytes, + a byte iterator, or stream input). + :paramtype content: any + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + json = { + "keyType": "str (optional)" + } + + # response body for status code(s): 200 + response.json() == { + "atlasKafkaPrimaryEndpoint": "str (optional)", + "atlasKafkaSecondaryEndpoint": "str (optional)" + } + """ + + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/regeneratekeys') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + diff --git a/sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/_request_builders_py3.py b/sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/_request_builders_py3.py new file mode 100644 index 000000000000..c2e85a7d1445 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/_request_builders_py3.py @@ -0,0 +1,359 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Optional + +from azure.core.pipeline.transport._base import _format_url_section +from azure.core.rest import HttpRequest +from msrest import Serializer + +_SERIALIZER = Serializer() + + +def build_get_account_properties_request( + **kwargs: Any +) -> HttpRequest: + """Get an account. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "id": "str (optional)", + "identity": { + "principalId": "str (optional)", + "tenantId": "str (optional)", + "type": "str (optional)" + }, + "location": "str (optional)", + "name": "str (optional)", + "properties": { + "cloudConnectors": { + "awsExternalId": "str (optional)" + }, + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByObjectId": "str (optional)", + "endpoints": { + "catalog": "str (optional)", + "guardian": "str (optional)", + "scan": "str (optional)" + }, + "friendlyName": "str (optional)", + "managedResourceGroupName": "str (optional)", + "managedResources": { + "eventHubNamespace": "str (optional)", + "resourceGroup": "str (optional)", + "storageAccount": "str (optional)" + }, + "privateEndpointConnections": [ + { + "id": "str (optional)", + "name": "str (optional)", + "properties": { + "privateEndpoint": { + "id": "str (optional)" + }, + "privateLinkServiceConnectionState": { + "actionsRequired": "str (optional)", + "description": "str (optional)", + "status": "str (optional)" + }, + "provisioningState": "str (optional)" + }, + "type": "str (optional)" + } + ], + "provisioningState": "str (optional)", + "publicNetworkAccess": "str (optional). Default value is \"Enabled\"" + }, + "sku": { + "capacity": "int (optional)", + "name": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + }, + "tags": { + "str": "str (optional)" + }, + "type": "str (optional)" + } + """ + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_account_properties_request( + *, + json: Any = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + """Updates an account. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in + our example to find the input shape. + :paramtype json: any + :keyword content: Pass in binary content you want in the body of the request (typically bytes, + a byte iterator, or stream input). + :paramtype content: any + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + json = { + "friendlyName": "str (optional)" + } + + # response body for status code(s): 200 + response.json() == { + "id": "str (optional)", + "identity": { + "principalId": "str (optional)", + "tenantId": "str (optional)", + "type": "str (optional)" + }, + "location": "str (optional)", + "name": "str (optional)", + "properties": { + "cloudConnectors": { + "awsExternalId": "str (optional)" + }, + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByObjectId": "str (optional)", + "endpoints": { + "catalog": "str (optional)", + "guardian": "str (optional)", + "scan": "str (optional)" + }, + "friendlyName": "str (optional)", + "managedResourceGroupName": "str (optional)", + "managedResources": { + "eventHubNamespace": "str (optional)", + "resourceGroup": "str (optional)", + "storageAccount": "str (optional)" + }, + "privateEndpointConnections": [ + { + "id": "str (optional)", + "name": "str (optional)", + "properties": { + "privateEndpoint": { + "id": "str (optional)" + }, + "privateLinkServiceConnectionState": { + "actionsRequired": "str (optional)", + "description": "str (optional)", + "status": "str (optional)" + }, + "provisioningState": "str (optional)" + }, + "type": "str (optional)" + } + ], + "provisioningState": "str (optional)", + "publicNetworkAccess": "str (optional). Default value is \"Enabled\"" + }, + "sku": { + "capacity": "int (optional)", + "name": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + }, + "tags": { + "str": "str (optional)" + }, + "type": "str (optional)" + } + """ + + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_access_keys_request( + **kwargs: Any +) -> HttpRequest: + """List the authorization keys associated with this account. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "atlasKafkaPrimaryEndpoint": "str (optional)", + "atlasKafkaSecondaryEndpoint": "str (optional)" + } + """ + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/listkeys') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_access_key_request( + *, + json: Any = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + """Regenerate the authorization keys associated with this data catalog. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in + our example to find the input shape. + :paramtype json: any + :keyword content: Pass in binary content you want in the body of the request (typically bytes, + a byte iterator, or stream input). + :paramtype content: any + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + json = { + "keyType": "str (optional)" + } + + # response body for status code(s): 200 + response.json() == { + "atlasKafkaPrimaryEndpoint": "str (optional)", + "atlasKafkaSecondaryEndpoint": "str (optional)" + } + """ + + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/regeneratekeys') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + diff --git a/sdk/purview/azure-purview-account/azure/purview/account/rest/collections/__init__.py b/sdk/purview/azure-purview-account/azure/purview/account/rest/collections/__init__.py new file mode 100644 index 000000000000..3e1ee19e1e30 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/rest/collections/__init__.py @@ -0,0 +1,31 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._request_builders_py3 import build_get_collection_request + from ._request_builders_py3 import build_create_or_update_collection_request + from ._request_builders_py3 import build_delete_collection_request + from ._request_builders_py3 import build_list_collections_request + from ._request_builders_py3 import build_list_child_collection_names_request + from ._request_builders_py3 import build_get_collection_path_request +except (SyntaxError, ImportError): + from ._request_builders import build_get_collection_request # type: ignore + from ._request_builders import build_create_or_update_collection_request # type: ignore + from ._request_builders import build_delete_collection_request # type: ignore + from ._request_builders import build_list_collections_request # type: ignore + from ._request_builders import build_list_child_collection_names_request # type: ignore + from ._request_builders import build_get_collection_path_request # type: ignore + +__all__ = [ + 'build_get_collection_request', + 'build_create_or_update_collection_request', + 'build_delete_collection_request', + 'build_list_collections_request', + 'build_list_child_collection_names_request', + 'build_get_collection_path_request', +] diff --git a/sdk/purview/azure-purview-account/azure/purview/account/rest/collections/_request_builders.py b/sdk/purview/azure-purview-account/azure/purview/account/rest/collections/_request_builders.py new file mode 100644 index 000000000000..3546bc416134 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/rest/collections/_request_builders.py @@ -0,0 +1,427 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport._base import _format_url_section +from azure.core.rest import HttpRequest +from msrest import Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + +_SERIALIZER = Serializer() + +# fmt: off + +def build_get_collection_request( + collection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """Get a collection. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :param collection_name: + :type collection_name: str + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + """ + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections/{collectionName}') + path_format_arguments = { + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_collection_request( + collection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """Creates or updates a collection entity. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :param collection_name: + :type collection_name: str + :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in + our example to find the input shape. + :paramtype json: any + :keyword content: Pass in binary content you want in the body of the request (typically bytes, + a byte iterator, or stream input). + :paramtype content: any + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + json = { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + + # response body for status code(s): 200 + response.json() == { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + """ + + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections/{collectionName}') + path_format_arguments = { + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_collection_request( + collection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """Deletes a Collection entity. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :param collection_name: + :type collection_name: str + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + """ + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections/{collectionName}') + path_format_arguments = { + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_collections_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """List the collections in the account. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword skip_token: + :paramtype skip_token: str + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "count": "long (optional)", + "nextLink": "str (optional)", + "value": [ + { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + ] + } + """ + + skip_token = kwargs.pop('skip_token', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_child_collection_names_request( + collection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """Lists the child collections names in the collection. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :param collection_name: + :type collection_name: str + :keyword skip_token: + :paramtype skip_token: str + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "count": "long (optional)", + "nextLink": "str (optional)", + "value": [ + { + "friendlyName": "str (optional)", + "name": "str (optional)" + } + ] + } + """ + + skip_token = kwargs.pop('skip_token', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections/{collectionName}/getChildCollectionNames') + path_format_arguments = { + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_collection_path_request( + collection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """Gets the parent name and parent friendly name chains that represent the collection path. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :param collection_name: + :type collection_name: str + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "parentFriendlyNameChain": [ + "str (optional)" + ], + "parentNameChain": [ + "str (optional)" + ] + } + """ + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections/{collectionName}/getCollectionPath') + path_format_arguments = { + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + diff --git a/sdk/purview/azure-purview-account/azure/purview/account/rest/collections/_request_builders_py3.py b/sdk/purview/azure-purview-account/azure/purview/account/rest/collections/_request_builders_py3.py new file mode 100644 index 000000000000..e34bbaeb689a --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/rest/collections/_request_builders_py3.py @@ -0,0 +1,421 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Optional + +from azure.core.pipeline.transport._base import _format_url_section +from azure.core.rest import HttpRequest +from msrest import Serializer + +_SERIALIZER = Serializer() + + +def build_get_collection_request( + collection_name: str, + **kwargs: Any +) -> HttpRequest: + """Get a collection. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :param collection_name: + :type collection_name: str + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + """ + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections/{collectionName}') + path_format_arguments = { + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_collection_request( + collection_name: str, + *, + json: Any = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + """Creates or updates a collection entity. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :param collection_name: + :type collection_name: str + :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in + our example to find the input shape. + :paramtype json: any + :keyword content: Pass in binary content you want in the body of the request (typically bytes, + a byte iterator, or stream input). + :paramtype content: any + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + json = { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + + # response body for status code(s): 200 + response.json() == { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + """ + + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections/{collectionName}') + path_format_arguments = { + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_collection_request( + collection_name: str, + **kwargs: Any +) -> HttpRequest: + """Deletes a Collection entity. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :param collection_name: + :type collection_name: str + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + """ + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections/{collectionName}') + path_format_arguments = { + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_collections_request( + *, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + """List the collections in the account. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword skip_token: + :paramtype skip_token: str + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "count": "long (optional)", + "nextLink": "str (optional)", + "value": [ + { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + ] + } + """ + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_child_collection_names_request( + collection_name: str, + *, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + """Lists the child collections names in the collection. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :param collection_name: + :type collection_name: str + :keyword skip_token: + :paramtype skip_token: str + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "count": "long (optional)", + "nextLink": "str (optional)", + "value": [ + { + "friendlyName": "str (optional)", + "name": "str (optional)" + } + ] + } + """ + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections/{collectionName}/getChildCollectionNames') + path_format_arguments = { + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_collection_path_request( + collection_name: str, + **kwargs: Any +) -> HttpRequest: + """Gets the parent name and parent friendly name chains that represent the collection path. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :param collection_name: + :type collection_name: str + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "parentFriendlyNameChain": [ + "str (optional)" + ], + "parentNameChain": [ + "str (optional)" + ] + } + """ + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections/{collectionName}/getCollectionPath') + path_format_arguments = { + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + diff --git a/sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/__init__.py b/sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/__init__.py new file mode 100644 index 000000000000..72fe3c4cb97c --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/__init__.py @@ -0,0 +1,25 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._request_builders_py3 import build_get_resource_set_rule_request + from ._request_builders_py3 import build_create_or_update_resource_set_rule_request + from ._request_builders_py3 import build_delete_resource_set_rule_request + from ._request_builders_py3 import build_list_resource_set_rules_request +except (SyntaxError, ImportError): + from ._request_builders import build_get_resource_set_rule_request # type: ignore + from ._request_builders import build_create_or_update_resource_set_rule_request # type: ignore + from ._request_builders import build_delete_resource_set_rule_request # type: ignore + from ._request_builders import build_list_resource_set_rules_request # type: ignore + +__all__ = [ + 'build_get_resource_set_rule_request', + 'build_create_or_update_resource_set_rule_request', + 'build_delete_resource_set_rule_request', + 'build_list_resource_set_rules_request', +] diff --git a/sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/_request_builders.py b/sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/_request_builders.py new file mode 100644 index 000000000000..737be339b4f5 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/_request_builders.py @@ -0,0 +1,715 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport._base import _format_url_section +from azure.core.rest import HttpRequest +from msrest import Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + +_SERIALIZER = Serializer() + +# fmt: off + +def build_get_resource_set_rule_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """Get a resource set config service model. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + """ + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/resourceSetRuleConfigs/defaultResourceSetRuleConfig') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_resource_set_rule_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """Creates or updates an resource set config. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in + our example to find the input shape. + :paramtype json: any + :keyword content: Pass in binary content you want in the body of the request (typically bytes, + a byte iterator, or stream input). + :paramtype content: any + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + json = { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + + # response body for status code(s): 200 + response.json() == { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + """ + + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/resourceSetRuleConfigs/defaultResourceSetRuleConfig') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_resource_set_rule_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """Deletes a ResourceSetRuleConfig resource. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + """ + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/resourceSetRuleConfigs/defaultResourceSetRuleConfig') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_resource_set_rules_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """Get a resource set config service model. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword skip_token: + :paramtype skip_token: str + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "count": "long (optional)", + "nextLink": "str (optional)", + "value": [ + { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + ] + } + """ + + skip_token = kwargs.pop('skip_token', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/resourceSetRuleConfigs') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + diff --git a/sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/_request_builders_py3.py b/sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/_request_builders_py3.py new file mode 100644 index 000000000000..364ec5a8625d --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/_request_builders_py3.py @@ -0,0 +1,711 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Optional + +from azure.core.pipeline.transport._base import _format_url_section +from azure.core.rest import HttpRequest +from msrest import Serializer + +_SERIALIZER = Serializer() + + +def build_get_resource_set_rule_request( + **kwargs: Any +) -> HttpRequest: + """Get a resource set config service model. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + """ + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/resourceSetRuleConfigs/defaultResourceSetRuleConfig') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_resource_set_rule_request( + *, + json: Any = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + """Creates or updates an resource set config. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in + our example to find the input shape. + :paramtype json: any + :keyword content: Pass in binary content you want in the body of the request (typically bytes, + a byte iterator, or stream input). + :paramtype content: any + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + json = { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + + # response body for status code(s): 200 + response.json() == { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + """ + + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/resourceSetRuleConfigs/defaultResourceSetRuleConfig') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_resource_set_rule_request( + **kwargs: Any +) -> HttpRequest: + """Deletes a ResourceSetRuleConfig resource. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + """ + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/resourceSetRuleConfigs/defaultResourceSetRuleConfig') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_resource_set_rules_request( + *, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + """Get a resource set config service model. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword skip_token: + :paramtype skip_token: str + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "count": "long (optional)", + "nextLink": "str (optional)", + "value": [ + { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + ] + } + """ + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/resourceSetRuleConfigs') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + diff --git a/sdk/purview/azure-purview-account/dev_requirements.txt b/sdk/purview/azure-purview-account/dev_requirements.txt new file mode 100644 index 000000000000..60e6d0eeff43 --- /dev/null +++ b/sdk/purview/azure-purview-account/dev_requirements.txt @@ -0,0 +1,6 @@ +-e ../../../tools/azure-sdk-tools +-e ../../../tools/azure-devtools +../../core/azure-core +-e ../../identity/azure-identity +../../nspkg/azure-purview-nspkg +aiohttp>=3.0; python_version >= '3.5' \ No newline at end of file diff --git a/sdk/purview/azure-purview-account/sdk_packaging.toml b/sdk/purview/azure-purview-account/sdk_packaging.toml new file mode 100644 index 000000000000..6f823f446798 --- /dev/null +++ b/sdk/purview/azure-purview-account/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +auto_update = false +package_name = "azure-purview-account" +package_pprint_name = "Azure Purview Account" +is_stable = false +is_arm = false + +# Package owners should uncomment and set this doc id. +# package_doc_id = "purview-account" \ No newline at end of file diff --git a/sdk/purview/azure-purview-account/setup.cfg b/sdk/purview/azure-purview-account/setup.cfg new file mode 100644 index 000000000000..3480374bc2f2 --- /dev/null +++ b/sdk/purview/azure-purview-account/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 \ No newline at end of file diff --git a/sdk/purview/azure-purview-account/setup.py b/sdk/purview/azure-purview-account/setup.py new file mode 100644 index 000000000000..43175e611ea0 --- /dev/null +++ b/sdk/purview/azure-purview-account/setup.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-purview-account" +PACKAGE_PPRINT_NAME = "Azure Purview Account" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# 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') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + "\n\n" + changelog, + 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', + classifiers=[ + "Development Status :: 4 - Beta", + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + '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.purview', + ]), + install_requires=[ + "azure-core<2.0.0,>=1.16.0", + "msrest>=0.6.21", + 'six>=1.11.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-purview-nspkg'], + ":python_version<'3.5'": ['typing'], + } +) \ No newline at end of file diff --git a/sdk/purview/azure-purview-account/swagger/README.md b/sdk/purview/azure-purview-account/swagger/README.md new file mode 100644 index 000000000000..3cefe5bdc56d --- /dev/null +++ b/sdk/purview/azure-purview-account/swagger/README.md @@ -0,0 +1,36 @@ +# Azure Purview for Python + +> see https://aka.ms/autorest + +### Setup + +Install Autorest v3 + +```ps +npm install -g autorest +``` + +### Generation + +```ps +cd +autorest +``` + +### Settings + +```yaml +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/purview/data-plane/Azure.Analytics.Purview.Account/preview/2019-11-01-preview/account.json +output-folder: ../azure/purview/account +namespace: azure.purview.account +package-name: azure-purview-account +license-header: MICROSOFT_MIT_NO_VERSION +clear-output-folder: true +no-namespace-folders: true +python: true +title: PurviewAccountClient +low-level-client: true +package-version: 1.0.0b1 +add-credential: true +credential-scopes: https://purview.azure.net/.default +``` diff --git a/sdk/purview/azure-purview-account/tests/_util.py b/sdk/purview/azure-purview-account/tests/_util.py new file mode 100644 index 000000000000..d33af186c670 --- /dev/null +++ b/sdk/purview/azure-purview-account/tests/_util.py @@ -0,0 +1,13 @@ +# 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. +# -------------------------------------------------------------------------- +from azure_devtools.scenario_tests import RecordingProcessor + + +class PurviewAccountRecordingProcessor(RecordingProcessor): + def process_response(self, response): + response["body"]["string"] = '{"atlasKafkaPrimaryEndpoint":"000","atlasKafkaSecondaryEndpoint":"000"}' + return response diff --git a/sdk/purview/azure-purview-account/tests/conftest.py b/sdk/purview/azure-purview-account/tests/conftest.py new file mode 100644 index 000000000000..a6ab83f7f5f0 --- /dev/null +++ b/sdk/purview/azure-purview-account/tests/conftest.py @@ -0,0 +1,15 @@ +# 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. +# -------------------------------------------------------------------------- + +import sys + +# fixture needs to be visible from conftest + +# Ignore async tests for Python < 3.5 +collect_ignore_glob = [] +if sys.version_info < (3, 5): + collect_ignore_glob.append("*_async.py") \ No newline at end of file diff --git a/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_basic_smoke_test.yaml b/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_basic_smoke_test.yaml new file mode 100644 index 000000000000..54ae6aa679c7 --- /dev/null +++ b/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_basic_smoke_test.yaml @@ -0,0 +1,34 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-purview-account/1.0.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://fake_account.account.purview.azure.com/listkeys?api-version=2019-11-01-preview + response: + body: + string: '{"atlasKafkaPrimaryEndpoint":"000","atlasKafkaSecondaryEndpoint":"000"}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Thu, 12 Aug 2021 02:40:41 GMT + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_basic_smoke_test.yaml b/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_basic_smoke_test.yaml new file mode 100644 index 000000000000..ab59555f0695 --- /dev/null +++ b/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_basic_smoke_test.yaml @@ -0,0 +1,24 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-purview-account/1.0.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://fake_account.account.purview.azure.com/listkeys?api-version=2019-11-01-preview + response: + body: + string: '{"atlasKafkaPrimaryEndpoint":"000","atlasKafkaSecondaryEndpoint":"000"}' + headers: + content-type: application/json; charset=utf-8 + date: Thu, 12 Aug 2021 02:40:37 GMT + server: Kestrel + strict-transport-security: max-age=31536000; includeSubDomains + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://purview-msyyc.purview.azure.com/listkeys?api-version=2019-11-01-preview +version: 1 diff --git a/sdk/purview/azure-purview-account/tests/test_smoke.py b/sdk/purview/azure-purview-account/tests/test_smoke.py new file mode 100644 index 000000000000..704a3ef5f59e --- /dev/null +++ b/sdk/purview/azure-purview-account/tests/test_smoke.py @@ -0,0 +1,21 @@ +# 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. +# ------------------------------------------------------------------------- +from testcase import PurviewAccountTest, PurviewAccountPowerShellPreparer +from azure.purview.account.rest import accounts + + +class PurviewAccountSmokeTest(PurviewAccountTest): + + @PurviewAccountPowerShellPreparer() + def test_basic_smoke_test(self, purviewaccount_endpoint): + client = self.create_client(endpoint=purviewaccount_endpoint) + request = accounts.build_get_access_keys_request() + response = client.send_request(request) + response.raise_for_status() + assert response.status_code == 200 + json_response = response.json() + assert set(json_response.keys()) == set(['atlasKafkaPrimaryEndpoint', 'atlasKafkaSecondaryEndpoint']) diff --git a/sdk/purview/azure-purview-account/tests/test_smoke_async.py b/sdk/purview/azure-purview-account/tests/test_smoke_async.py new file mode 100644 index 000000000000..915d03aec5fa --- /dev/null +++ b/sdk/purview/azure-purview-account/tests/test_smoke_async.py @@ -0,0 +1,21 @@ +# 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. +# ------------------------------------------------------------------------- +from testcase import PurviewAccountPowerShellPreparer +from testcase_async import PurviewAccountTestAsync +from azure.purview.account.rest import accounts + + +class PurviewAccountSmokeTestAsync(PurviewAccountTestAsync): + + @PurviewAccountPowerShellPreparer() + async def test_basic_smoke_test(self, purviewaccount_endpoint): + request = accounts.build_get_access_keys_request() + + client = self.create_async_client(endpoint=purviewaccount_endpoint) + response = await client.send_request(request) + response.raise_for_status() + assert response.status_code == 200 diff --git a/sdk/purview/azure-purview-account/tests/testcase.py b/sdk/purview/azure-purview-account/tests/testcase.py new file mode 100644 index 000000000000..11652d9107db --- /dev/null +++ b/sdk/purview/azure-purview-account/tests/testcase.py @@ -0,0 +1,32 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from devtools_testutils import AzureTestCase, PowerShellPreparer +from azure.purview.account import PurviewAccountClient +from _util import PurviewAccountRecordingProcessor + + +class PurviewAccountTest(AzureTestCase): + def __init__(self, method_name, **kwargs): + super(PurviewAccountTest, self).__init__(method_name, **kwargs) + self.recording_processors.append(PurviewAccountRecordingProcessor()) + + def create_client(self, endpoint): + self.recording_processors.append(PurviewAccountRecordingProcessor()) + credential = self.get_credential(PurviewAccountClient) + return self.create_client_from_credential( + PurviewAccountClient, + credential=credential, + endpoint=endpoint, + ) + + +PurviewAccountPowerShellPreparer = functools.partial( + PowerShellPreparer, + "purviewaccount", + purviewaccount_endpoint="https://fake_account.account.purview.azure.com" +) diff --git a/sdk/purview/azure-purview-account/tests/testcase_async.py b/sdk/purview/azure-purview-account/tests/testcase_async.py new file mode 100644 index 000000000000..ea2907c07b82 --- /dev/null +++ b/sdk/purview/azure-purview-account/tests/testcase_async.py @@ -0,0 +1,23 @@ +# 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. +# -------------------------------------------------------------------------- +from devtools_testutils import AzureTestCase +from azure.purview.account.aio import PurviewAccountClient as AsyncPurviewAccountClient +from _util import PurviewAccountRecordingProcessor + + +class PurviewAccountTestAsync(AzureTestCase): + def __init__(self, method_name, **kwargs): + super(PurviewAccountTestAsync, self).__init__(method_name, **kwargs) + self.recording_processors.append(PurviewAccountRecordingProcessor()) + + def create_async_client(self, endpoint): + credential = self.get_credential(AsyncPurviewAccountClient, is_async=True) + return self.create_client_from_credential( + AsyncPurviewAccountClient, + credential=credential, + endpoint=endpoint, + ) diff --git a/sdk/purview/ci.yml b/sdk/purview/ci.yml index ec7853234383..2eac49904741 100644 --- a/sdk/purview/ci.yml +++ b/sdk/purview/ci.yml @@ -35,3 +35,5 @@ extends: safeName: azurepurviewscanning - name: azure-purview-catalog safeName: azurepurviewcatalog + - name: azure-purview-account + safeName: azurepurviewaccount From c95e37f3da928fe6bbd2f55056b19129163e5145 Mon Sep 17 00:00:00 2001 From: msyyc <70930885+msyyc@users.noreply.github.com> Date: Wed, 18 Aug 2021 11:27:27 +0800 Subject: [PATCH 2/8] CI --- eng/.docsettings.yml | 1 + eng/tox/allowed_pylint_failures.py | 1 + shared_requirements.txt | 2 ++ 3 files changed, 4 insertions(+) diff --git a/eng/.docsettings.yml b/eng/.docsettings.yml index 2e5778981834..af881869d621 100644 --- a/eng/.docsettings.yml +++ b/eng/.docsettings.yml @@ -91,6 +91,7 @@ known_content_issues: - ['sdk/purview/azure-purview-catalog/swagger/README.md',  '#4554'] - ['sdk/purview/azure-purview-scanning/swagger/README.md',  '#4554'] - ['sdk/agrifood/azure-agrifood-farming/swagger/README.md',  '#4554'] + - ['sdk/purview/azure-purview-account/swagger/README.md', '#4554'] - ['sdk/containerregistry/azure-containerregistry/swagger/README.md', '#4554'] - ['sdk/appconfiguration/azure-appconfiguration/swagger/README.md', '#4554'] - ['sdk/attestation/azure-security-attestation/swagger/README.md', '#4554'] diff --git a/eng/tox/allowed_pylint_failures.py b/eng/tox/allowed_pylint_failures.py index b7a9fe1a1762..c929b50632ab 100644 --- a/eng/tox/allowed_pylint_failures.py +++ b/eng/tox/allowed_pylint_failures.py @@ -54,6 +54,7 @@ "azure-purview-nspkg", "azure-purview-scanning", "azure-purview-catalog", + "azure-purview-account", "azure-messaging-nspkg", "azure-agrifood-farming", "azure-eventhub", diff --git a/shared_requirements.txt b/shared_requirements.txt index 11da8a8a9fa8..e2ae8089f81a 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -278,6 +278,8 @@ opentelemetry-sdk<2.0.0,>=1.0.0 #override azure-mgmt-resourcegraph msrest>=0.6.21 #override azure-purview-scanning azure-core<2.0.0,>=1.8.2 #override azure-purview-scanning msrest>=0.6.21 +#override azure-purview-account msrest>=0.6.21 +#override azure-purview-account azure-core<2.0.0,>=1.16.0 #override azure-mgmt-rdbms msrest>=0.6.21 #override azure-mgmt-peering msrest>=0.6.21 #override azure-mgmt-elastic msrest>=0.6.21 From 29dc18af76f0778ea09758d12f70cf0b029b9b60 Mon Sep 17 00:00:00 2001 From: msyyc <70930885+msyyc@users.noreply.github.com> Date: Wed, 18 Aug 2021 13:25:49 +0800 Subject: [PATCH 3/8] verion-tolerant --- .../account/_purview_account_client.py | 15 +- .../account/aio/_purview_account_client.py | 15 +- .../{rest => aio/operations}/__init__.py | 13 +- .../aio/operations/_accounts_operations.py | 409 ++++++++ .../aio/operations/_collections_operations.py | 519 ++++++++++ .../_resource_set_rules_operations.py | 786 +++++++++++++++ .../purview/account/operations/__init__.py | 17 + .../operations/_accounts_operations.py | 531 ++++++++++ .../operations/_collections_operations.py | 729 ++++++++++++++ .../_resource_set_rules_operations.py | 907 ++++++++++++++++++ .../purview/account/rest/accounts/__init__.py | 25 - .../rest/accounts/_request_builders.py | 358 ------- .../rest/accounts/_request_builders_py3.py | 359 ------- .../account/rest/collections/__init__.py | 31 - .../rest/collections/_request_builders.py | 427 --------- .../rest/collections/_request_builders_py3.py | 421 -------- .../rest/resource_set_rules/__init__.py | 25 - .../resource_set_rules/_request_builders.py | 715 -------------- .../_request_builders_py3.py | 711 -------------- .../azure-purview-account/swagger/README.md | 2 +- .../test_smoke.test_basic_smoke_test.yaml | 2 +- ...est_smoke_async.test_basic_smoke_test.yaml | 2 +- .../azure-purview-account/tests/test_smoke.py | 9 +- .../tests/test_smoke_async.py | 8 +- .../azure-purview-account/tests/testcase.py | 1 - 25 files changed, 3937 insertions(+), 3100 deletions(-) rename sdk/purview/azure-purview-account/azure/purview/account/{rest => aio/operations}/__init__.py (58%) create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_accounts_operations.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_collections_operations.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_resource_set_rules_operations.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/operations/__init__.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/operations/_accounts_operations.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/operations/_collections_operations.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/operations/_resource_set_rules_operations.py delete mode 100644 sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/__init__.py delete mode 100644 sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/_request_builders.py delete mode 100644 sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/_request_builders_py3.py delete mode 100644 sdk/purview/azure-purview-account/azure/purview/account/rest/collections/__init__.py delete mode 100644 sdk/purview/azure-purview-account/azure/purview/account/rest/collections/_request_builders.py delete mode 100644 sdk/purview/azure-purview-account/azure/purview/account/rest/collections/_request_builders_py3.py delete mode 100644 sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/__init__.py delete mode 100644 sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/_request_builders.py delete mode 100644 sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/_request_builders_py3.py diff --git a/sdk/purview/azure-purview-account/azure/purview/account/_purview_account_client.py b/sdk/purview/azure-purview-account/azure/purview/account/_purview_account_client.py index bab0b292867b..d81a8bed7f22 100644 --- a/sdk/purview/azure-purview-account/azure/purview/account/_purview_account_client.py +++ b/sdk/purview/azure-purview-account/azure/purview/account/_purview_account_client.py @@ -13,6 +13,7 @@ from msrest import Deserializer, Serializer from ._configuration import PurviewAccountClientConfiguration +from .operations import AccountsOperations, CollectionsOperations, ResourceSetRulesOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -24,6 +25,12 @@ class PurviewAccountClient(object): """Creates a Microsoft.Purview data plane account client. + :ivar accounts: AccountsOperations operations + :vartype accounts: azure.purview.account.operations.AccountsOperations + :ivar collections: CollectionsOperations operations + :vartype collections: azure.purview.account.operations.CollectionsOperations + :ivar resource_set_rules: ResourceSetRulesOperations operations + :vartype resource_set_rules: azure.purview.account.operations.ResourceSetRulesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param endpoint: The account endpoint of your Purview account. Example: @@ -45,6 +52,9 @@ def __init__( self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False + self.accounts = AccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.collections = CollectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.resource_set_rules = ResourceSetRulesOperations(self._client, self._config, self._serialize, self._deserialize) def send_request( @@ -58,11 +68,6 @@ def send_request( We have helper methods to create requests specific to this service in `azure.purview.account.rest`. Use these helper methods to create the request you pass to this method. - >>> from azure.purview.account.rest import accounts - >>> request = accounts.build_get_account_properties_request(**kwargs) - - >>> response = client.send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart diff --git a/sdk/purview/azure-purview-account/azure/purview/account/aio/_purview_account_client.py b/sdk/purview/azure-purview-account/azure/purview/account/aio/_purview_account_client.py index 66904282a240..5ce7021b382a 100644 --- a/sdk/purview/azure-purview-account/azure/purview/account/aio/_purview_account_client.py +++ b/sdk/purview/azure-purview-account/azure/purview/account/aio/_purview_account_client.py @@ -14,6 +14,7 @@ from msrest import Deserializer, Serializer from ._configuration import PurviewAccountClientConfiguration +from .operations import AccountsOperations, CollectionsOperations, ResourceSetRulesOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -24,6 +25,12 @@ class PurviewAccountClient: """Creates a Microsoft.Purview data plane account client. + :ivar accounts: AccountsOperations operations + :vartype accounts: azure.purview.account.aio.operations.AccountsOperations + :ivar collections: CollectionsOperations operations + :vartype collections: azure.purview.account.aio.operations.CollectionsOperations + :ivar resource_set_rules: ResourceSetRulesOperations operations + :vartype resource_set_rules: azure.purview.account.aio.operations.ResourceSetRulesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param endpoint: The account endpoint of your Purview account. Example: @@ -44,6 +51,9 @@ def __init__( self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False + self.accounts = AccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.collections = CollectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.resource_set_rules = ResourceSetRulesOperations(self._client, self._config, self._serialize, self._deserialize) def send_request( @@ -56,11 +66,6 @@ def send_request( We have helper methods to create requests specific to this service in `azure.purview.account.rest`. Use these helper methods to create the request you pass to this method. - >>> from azure.purview.account.rest import accounts - >>> request = accounts.build_get_account_properties_request(**kwargs) - - >>> response = await client.send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart diff --git a/sdk/purview/azure-purview-account/azure/purview/account/rest/__init__.py b/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/__init__.py similarity index 58% rename from sdk/purview/azure-purview-account/azure/purview/account/rest/__init__.py rename to sdk/purview/azure-purview-account/azure/purview/account/aio/operations/__init__.py index 8e6cf7ef9438..9b3934fb09cb 100644 --- a/sdk/purview/azure-purview-account/azure/purview/account/rest/__init__.py +++ b/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/__init__.py @@ -1,6 +1,17 @@ +# 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) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- \ No newline at end of file +# -------------------------------------------------------------------------- + +from ._accounts_operations import AccountsOperations +from ._collections_operations import CollectionsOperations +from ._resource_set_rules_operations import ResourceSetRulesOperations + +__all__ = [ + 'AccountsOperations', + 'CollectionsOperations', + 'ResourceSetRulesOperations', +] diff --git a/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_accounts_operations.py b/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_accounts_operations.py new file mode 100644 index 000000000000..259b91c66b10 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_accounts_operations.py @@ -0,0 +1,409 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ...operations._accounts_operations import build_get_access_keys_request, build_get_account_properties_request, build_regenerate_access_key_request, build_update_account_properties_request + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AccountsOperations: + """AccountsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get_account_properties( + self, + **kwargs: Any + ) -> Any: + """Get an account. + + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "id": "str (optional)", + "identity": { + "principalId": "str (optional)", + "tenantId": "str (optional)", + "type": "str (optional)" + }, + "location": "str (optional)", + "name": "str (optional)", + "properties": { + "cloudConnectors": { + "awsExternalId": "str (optional)" + }, + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByObjectId": "str (optional)", + "endpoints": { + "catalog": "str (optional)", + "guardian": "str (optional)", + "scan": "str (optional)" + }, + "friendlyName": "str (optional)", + "managedResourceGroupName": "str (optional)", + "managedResources": { + "eventHubNamespace": "str (optional)", + "resourceGroup": "str (optional)", + "storageAccount": "str (optional)" + }, + "privateEndpointConnections": [ + { + "id": "str (optional)", + "name": "str (optional)", + "properties": { + "privateEndpoint": { + "id": "str (optional)" + }, + "privateLinkServiceConnectionState": { + "actionsRequired": "str (optional)", + "description": "str (optional)", + "status": "str (optional)" + }, + "provisioningState": "str (optional)" + }, + "type": "str (optional)" + } + ], + "provisioningState": "str (optional)", + "publicNetworkAccess": "str (optional). Default value is \"Enabled\"" + }, + "sku": { + "capacity": "int (optional)", + "name": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + }, + "tags": { + "str": "str (optional)" + }, + "type": "str (optional)" + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_account_properties_request( + template_url=self.get_account_properties.metadata['url'], + ) + 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) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_account_properties.metadata = {'url': '/'} # type: ignore + + + @distributed_trace_async + async def update_account_properties( + self, + account_update_parameters: Any, + **kwargs: Any + ) -> Any: + """Updates an account. + + :param account_update_parameters: + :type account_update_parameters: Any + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + account_update_parameters = { + "friendlyName": "str (optional)" + } + + # response body for status code(s): 200 + response.json() == { + "id": "str (optional)", + "identity": { + "principalId": "str (optional)", + "tenantId": "str (optional)", + "type": "str (optional)" + }, + "location": "str (optional)", + "name": "str (optional)", + "properties": { + "cloudConnectors": { + "awsExternalId": "str (optional)" + }, + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByObjectId": "str (optional)", + "endpoints": { + "catalog": "str (optional)", + "guardian": "str (optional)", + "scan": "str (optional)" + }, + "friendlyName": "str (optional)", + "managedResourceGroupName": "str (optional)", + "managedResources": { + "eventHubNamespace": "str (optional)", + "resourceGroup": "str (optional)", + "storageAccount": "str (optional)" + }, + "privateEndpointConnections": [ + { + "id": "str (optional)", + "name": "str (optional)", + "properties": { + "privateEndpoint": { + "id": "str (optional)" + }, + "privateLinkServiceConnectionState": { + "actionsRequired": "str (optional)", + "description": "str (optional)", + "status": "str (optional)" + }, + "provisioningState": "str (optional)" + }, + "type": "str (optional)" + } + ], + "provisioningState": "str (optional)", + "publicNetworkAccess": "str (optional). Default value is \"Enabled\"" + }, + "sku": { + "capacity": "int (optional)", + "name": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + }, + "tags": { + "str": "str (optional)" + }, + "type": "str (optional)" + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + json = account_update_parameters + + request = build_update_account_properties_request( + content_type=content_type, + json=json, + template_url=self.update_account_properties.metadata['url'], + ) + 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) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_account_properties.metadata = {'url': '/'} # type: ignore + + + @distributed_trace_async + async def get_access_keys( + self, + **kwargs: Any + ) -> Any: + """List the authorization keys associated with this account. + + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "atlasKafkaPrimaryEndpoint": "str (optional)", + "atlasKafkaSecondaryEndpoint": "str (optional)" + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_access_keys_request( + template_url=self.get_access_keys.metadata['url'], + ) + 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) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_access_keys.metadata = {'url': '/listkeys'} # type: ignore + + + @distributed_trace_async + async def regenerate_access_key( + self, + key_options: Any, + **kwargs: Any + ) -> Any: + """Regenerate the authorization keys associated with this data catalog. + + :param key_options: + :type key_options: Any + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + key_options = { + "keyType": "str (optional)" + } + + # response body for status code(s): 200 + response.json() == { + "atlasKafkaPrimaryEndpoint": "str (optional)", + "atlasKafkaSecondaryEndpoint": "str (optional)" + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + json = key_options + + request = build_regenerate_access_key_request( + content_type=content_type, + json=json, + template_url=self.regenerate_access_key.metadata['url'], + ) + 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) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_access_key.metadata = {'url': '/regeneratekeys'} # type: ignore + diff --git a/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_collections_operations.py b/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_collections_operations.py new file mode 100644 index 000000000000..d2bd035f7fe4 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_collections_operations.py @@ -0,0 +1,519 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from json import loads as _loads +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async + +from ...operations._collections_operations import build_create_or_update_collection_request, build_delete_collection_request, build_get_collection_path_request, build_get_collection_request, build_list_child_collection_names_request, build_list_collections_request + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CollectionsOperations: + """CollectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get_collection( + self, + collection_name: str, + **kwargs: Any + ) -> Any: + """Get a collection. + + :param collection_name: + :type collection_name: str + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_collection_request( + collection_name=collection_name, + template_url=self.get_collection.metadata['url'], + ) + 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) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_collection.metadata = {'url': '/collections/{collectionName}'} # type: ignore + + + @distributed_trace_async + async def create_or_update_collection( + self, + collection_name: str, + collection: Any, + **kwargs: Any + ) -> Any: + """Creates or updates a collection entity. + + :param collection_name: + :type collection_name: str + :param collection: + :type collection: Any + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + collection = { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + + # response body for status code(s): 200 + response.json() == { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + json = collection + + request = build_create_or_update_collection_request( + collection_name=collection_name, + content_type=content_type, + json=json, + template_url=self.create_or_update_collection.metadata['url'], + ) + 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) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_collection.metadata = {'url': '/collections/{collectionName}'} # type: ignore + + + @distributed_trace_async + async def delete_collection( + self, + collection_name: str, + **kwargs: Any + ) -> None: + """Deletes a Collection entity. + + :param collection_name: + :type collection_name: str + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_collection_request( + collection_name=collection_name, + template_url=self.delete_collection.metadata['url'], + ) + 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) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) + + delete_collection.metadata = {'url': '/collections/{collectionName}'} # type: ignore + + + @distributed_trace + def list_collections( + self, + *, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable[Any]: + """List the collections in the account. + + :keyword skip_token: + :paramtype skip_token: str + :return: An iterator like instance of JSON object + :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "count": "long (optional)", + "nextLink": "str (optional)", + "value": [ + { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + ] + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_collections_request( + skip_token=skip_token, + template_url=self.list_collections.metadata['url'], + )._to_pipeline_transport_request() + 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) + + else: + + request = build_list_collections_request( + skip_token=skip_token, + template_url=next_link, + )._to_pipeline_transport_request() + 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) + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = _loads(pipeline_response.http_response.body()) + list_of_elem = deserialized["value"] + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.get("nextLink", None), AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_collections.metadata = {'url': '/collections'} # type: ignore + + @distributed_trace + def list_child_collection_names( + self, + collection_name: str, + *, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable[Any]: + """Lists the child collections names in the collection. + + :param collection_name: + :type collection_name: str + :keyword skip_token: + :paramtype skip_token: str + :return: An iterator like instance of JSON object + :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "count": "long (optional)", + "nextLink": "str (optional)", + "value": [ + { + "friendlyName": "str (optional)", + "name": "str (optional)" + } + ] + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_child_collection_names_request( + collection_name=collection_name, + skip_token=skip_token, + template_url=self.list_child_collection_names.metadata['url'], + )._to_pipeline_transport_request() + 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) + + else: + + request = build_list_child_collection_names_request( + collection_name=collection_name, + skip_token=skip_token, + template_url=next_link, + )._to_pipeline_transport_request() + 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) + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = _loads(pipeline_response.http_response.body()) + list_of_elem = deserialized["value"] + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.get("nextLink", None), AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_child_collection_names.metadata = {'url': '/collections/{collectionName}/getChildCollectionNames'} # type: ignore + + @distributed_trace_async + async def get_collection_path( + self, + collection_name: str, + **kwargs: Any + ) -> Any: + """Gets the parent name and parent friendly name chains that represent the collection path. + + :param collection_name: + :type collection_name: str + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "parentFriendlyNameChain": [ + "str (optional)" + ], + "parentNameChain": [ + "str (optional)" + ] + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_collection_path_request( + collection_name=collection_name, + template_url=self.get_collection_path.metadata['url'], + ) + 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) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_collection_path.metadata = {'url': '/collections/{collectionName}/getCollectionPath'} # type: ignore + diff --git a/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_resource_set_rules_operations.py b/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_resource_set_rules_operations.py new file mode 100644 index 000000000000..5a2156c7e9e6 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_resource_set_rules_operations.py @@ -0,0 +1,786 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from json import loads as _loads +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async + +from ...operations._resource_set_rules_operations import build_create_or_update_resource_set_rule_request, build_delete_resource_set_rule_request, build_get_resource_set_rule_request, build_list_resource_set_rules_request + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ResourceSetRulesOperations: + """ResourceSetRulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get_resource_set_rule( + self, + **kwargs: Any + ) -> Any: + """Get a resource set config service model. + + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_resource_set_rule_request( + template_url=self.get_resource_set_rule.metadata['url'], + ) + 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) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_resource_set_rule.metadata = {'url': '/resourceSetRuleConfigs/defaultResourceSetRuleConfig'} # type: ignore + + + @distributed_trace_async + async def create_or_update_resource_set_rule( + self, + resource_set_rule_config: Any, + **kwargs: Any + ) -> Any: + """Creates or updates an resource set config. + + :param resource_set_rule_config: + :type resource_set_rule_config: Any + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + resource_set_rule_config = { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + + # response body for status code(s): 200 + response.json() == { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + json = resource_set_rule_config + + request = build_create_or_update_resource_set_rule_request( + content_type=content_type, + json=json, + template_url=self.create_or_update_resource_set_rule.metadata['url'], + ) + 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) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_resource_set_rule.metadata = {'url': '/resourceSetRuleConfigs/defaultResourceSetRuleConfig'} # type: ignore + + + @distributed_trace_async + async def delete_resource_set_rule( + self, + **kwargs: Any + ) -> None: + """Deletes a ResourceSetRuleConfig resource. + + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_resource_set_rule_request( + template_url=self.delete_resource_set_rule.metadata['url'], + ) + 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) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) + + delete_resource_set_rule.metadata = {'url': '/resourceSetRuleConfigs/defaultResourceSetRuleConfig'} # type: ignore + + + @distributed_trace + def list_resource_set_rules( + self, + *, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable[Any]: + """Get a resource set config service model. + + :keyword skip_token: + :paramtype skip_token: str + :return: An iterator like instance of JSON object + :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "count": "long (optional)", + "nextLink": "str (optional)", + "value": [ + { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + ] + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_resource_set_rules_request( + skip_token=skip_token, + template_url=self.list_resource_set_rules.metadata['url'], + )._to_pipeline_transport_request() + 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) + + else: + + request = build_list_resource_set_rules_request( + skip_token=skip_token, + template_url=next_link, + )._to_pipeline_transport_request() + 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) + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = _loads(pipeline_response.http_response.body()) + list_of_elem = deserialized["value"] + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.get("nextLink", None), AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_resource_set_rules.metadata = {'url': '/resourceSetRuleConfigs'} # type: ignore diff --git a/sdk/purview/azure-purview-account/azure/purview/account/operations/__init__.py b/sdk/purview/azure-purview-account/azure/purview/account/operations/__init__.py new file mode 100644 index 000000000000..9b3934fb09cb --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/operations/__init__.py @@ -0,0 +1,17 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._accounts_operations import AccountsOperations +from ._collections_operations import CollectionsOperations +from ._resource_set_rules_operations import ResourceSetRulesOperations + +__all__ = [ + 'AccountsOperations', + 'CollectionsOperations', + 'ResourceSetRulesOperations', +] diff --git a/sdk/purview/azure-purview-account/azure/purview/account/operations/_accounts_operations.py b/sdk/purview/azure-purview-account/azure/purview/account/operations/_accounts_operations.py new file mode 100644 index 000000000000..4694fce07df3 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/operations/_accounts_operations.py @@ -0,0 +1,531 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from msrest import Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +# fmt: off + +def build_get_account_properties_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_account_properties_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_access_keys_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/listkeys') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_access_key_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/regeneratekeys') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class AccountsOperations(object): + """AccountsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get_account_properties( + self, + **kwargs # type: Any + ): + # type: (...) -> Any + """Get an account. + + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "id": "str (optional)", + "identity": { + "principalId": "str (optional)", + "tenantId": "str (optional)", + "type": "str (optional)" + }, + "location": "str (optional)", + "name": "str (optional)", + "properties": { + "cloudConnectors": { + "awsExternalId": "str (optional)" + }, + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByObjectId": "str (optional)", + "endpoints": { + "catalog": "str (optional)", + "guardian": "str (optional)", + "scan": "str (optional)" + }, + "friendlyName": "str (optional)", + "managedResourceGroupName": "str (optional)", + "managedResources": { + "eventHubNamespace": "str (optional)", + "resourceGroup": "str (optional)", + "storageAccount": "str (optional)" + }, + "privateEndpointConnections": [ + { + "id": "str (optional)", + "name": "str (optional)", + "properties": { + "privateEndpoint": { + "id": "str (optional)" + }, + "privateLinkServiceConnectionState": { + "actionsRequired": "str (optional)", + "description": "str (optional)", + "status": "str (optional)" + }, + "provisioningState": "str (optional)" + }, + "type": "str (optional)" + } + ], + "provisioningState": "str (optional)", + "publicNetworkAccess": "str (optional). Default value is \"Enabled\"" + }, + "sku": { + "capacity": "int (optional)", + "name": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + }, + "tags": { + "str": "str (optional)" + }, + "type": "str (optional)" + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_account_properties_request( + template_url=self.get_account_properties.metadata['url'], + ) + 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) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_account_properties.metadata = {'url': '/'} # type: ignore + + + @distributed_trace + def update_account_properties( + self, + account_update_parameters, # type: Any + **kwargs # type: Any + ): + # type: (...) -> Any + """Updates an account. + + :param account_update_parameters: + :type account_update_parameters: Any + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + account_update_parameters = { + "friendlyName": "str (optional)" + } + + # response body for status code(s): 200 + response.json() == { + "id": "str (optional)", + "identity": { + "principalId": "str (optional)", + "tenantId": "str (optional)", + "type": "str (optional)" + }, + "location": "str (optional)", + "name": "str (optional)", + "properties": { + "cloudConnectors": { + "awsExternalId": "str (optional)" + }, + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByObjectId": "str (optional)", + "endpoints": { + "catalog": "str (optional)", + "guardian": "str (optional)", + "scan": "str (optional)" + }, + "friendlyName": "str (optional)", + "managedResourceGroupName": "str (optional)", + "managedResources": { + "eventHubNamespace": "str (optional)", + "resourceGroup": "str (optional)", + "storageAccount": "str (optional)" + }, + "privateEndpointConnections": [ + { + "id": "str (optional)", + "name": "str (optional)", + "properties": { + "privateEndpoint": { + "id": "str (optional)" + }, + "privateLinkServiceConnectionState": { + "actionsRequired": "str (optional)", + "description": "str (optional)", + "status": "str (optional)" + }, + "provisioningState": "str (optional)" + }, + "type": "str (optional)" + } + ], + "provisioningState": "str (optional)", + "publicNetworkAccess": "str (optional). Default value is \"Enabled\"" + }, + "sku": { + "capacity": "int (optional)", + "name": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + }, + "tags": { + "str": "str (optional)" + }, + "type": "str (optional)" + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + json = account_update_parameters + + request = build_update_account_properties_request( + content_type=content_type, + json=json, + template_url=self.update_account_properties.metadata['url'], + ) + 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) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_account_properties.metadata = {'url': '/'} # type: ignore + + + @distributed_trace + def get_access_keys( + self, + **kwargs # type: Any + ): + # type: (...) -> Any + """List the authorization keys associated with this account. + + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "atlasKafkaPrimaryEndpoint": "str (optional)", + "atlasKafkaSecondaryEndpoint": "str (optional)" + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_access_keys_request( + template_url=self.get_access_keys.metadata['url'], + ) + 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) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_access_keys.metadata = {'url': '/listkeys'} # type: ignore + + + @distributed_trace + def regenerate_access_key( + self, + key_options, # type: Any + **kwargs # type: Any + ): + # type: (...) -> Any + """Regenerate the authorization keys associated with this data catalog. + + :param key_options: + :type key_options: Any + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + key_options = { + "keyType": "str (optional)" + } + + # response body for status code(s): 200 + response.json() == { + "atlasKafkaPrimaryEndpoint": "str (optional)", + "atlasKafkaSecondaryEndpoint": "str (optional)" + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + json = key_options + + request = build_regenerate_access_key_request( + content_type=content_type, + json=json, + template_url=self.regenerate_access_key.metadata['url'], + ) + 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) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_access_key.metadata = {'url': '/regeneratekeys'} # type: ignore + diff --git a/sdk/purview/azure-purview-account/azure/purview/account/operations/_collections_operations.py b/sdk/purview/azure-purview-account/azure/purview/account/operations/_collections_operations.py new file mode 100644 index 000000000000..73d946a278a0 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/operations/_collections_operations.py @@ -0,0 +1,729 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from json import loads as _loads +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport._base import _format_url_section +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from msrest import Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +# fmt: off + +def build_get_collection_request( + collection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections/{collectionName}') + path_format_arguments = { + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_collection_request( + collection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections/{collectionName}') + path_format_arguments = { + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_collection_request( + collection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections/{collectionName}') + path_format_arguments = { + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_collections_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + skip_token = kwargs.pop('skip_token', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_child_collection_names_request( + collection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + skip_token = kwargs.pop('skip_token', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections/{collectionName}/getChildCollectionNames') + path_format_arguments = { + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_collection_path_request( + collection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections/{collectionName}/getCollectionPath') + path_format_arguments = { + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class CollectionsOperations(object): + """CollectionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get_collection( + self, + collection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Any + """Get a collection. + + :param collection_name: + :type collection_name: str + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_collection_request( + collection_name=collection_name, + template_url=self.get_collection.metadata['url'], + ) + 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) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_collection.metadata = {'url': '/collections/{collectionName}'} # type: ignore + + + @distributed_trace + def create_or_update_collection( + self, + collection_name, # type: str + collection, # type: Any + **kwargs # type: Any + ): + # type: (...) -> Any + """Creates or updates a collection entity. + + :param collection_name: + :type collection_name: str + :param collection: + :type collection: Any + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + collection = { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + + # response body for status code(s): 200 + response.json() == { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + json = collection + + request = build_create_or_update_collection_request( + collection_name=collection_name, + content_type=content_type, + json=json, + template_url=self.create_or_update_collection.metadata['url'], + ) + 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) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_collection.metadata = {'url': '/collections/{collectionName}'} # type: ignore + + + @distributed_trace + def delete_collection( + self, + collection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a Collection entity. + + :param collection_name: + :type collection_name: str + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_collection_request( + collection_name=collection_name, + template_url=self.delete_collection.metadata['url'], + ) + 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) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) + + delete_collection.metadata = {'url': '/collections/{collectionName}'} # type: ignore + + + @distributed_trace + def list_collections( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable[Any] + """List the collections in the account. + + :keyword skip_token: + :paramtype skip_token: str + :return: An iterator like instance of JSON object + :rtype: ~azure.core.paging.ItemPaged[Any] + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "count": "long (optional)", + "nextLink": "str (optional)", + "value": [ + { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + ] + } + """ + skip_token = kwargs.pop('skip_token', None) # type: Optional[str] + + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_collections_request( + skip_token=skip_token, + template_url=self.list_collections.metadata['url'], + )._to_pipeline_transport_request() + 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) + + else: + + request = build_list_collections_request( + skip_token=skip_token, + template_url=next_link, + )._to_pipeline_transport_request() + 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) + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = _loads(pipeline_response.http_response.body()) + list_of_elem = deserialized["value"] + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.get("nextLink", None), iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_collections.metadata = {'url': '/collections'} # type: ignore + + @distributed_trace + def list_child_collection_names( + self, + collection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable[Any] + """Lists the child collections names in the collection. + + :param collection_name: + :type collection_name: str + :keyword skip_token: + :paramtype skip_token: str + :return: An iterator like instance of JSON object + :rtype: ~azure.core.paging.ItemPaged[Any] + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "count": "long (optional)", + "nextLink": "str (optional)", + "value": [ + { + "friendlyName": "str (optional)", + "name": "str (optional)" + } + ] + } + """ + skip_token = kwargs.pop('skip_token', None) # type: Optional[str] + + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_child_collection_names_request( + collection_name=collection_name, + skip_token=skip_token, + template_url=self.list_child_collection_names.metadata['url'], + )._to_pipeline_transport_request() + 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) + + else: + + request = build_list_child_collection_names_request( + collection_name=collection_name, + skip_token=skip_token, + template_url=next_link, + )._to_pipeline_transport_request() + 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) + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = _loads(pipeline_response.http_response.body()) + list_of_elem = deserialized["value"] + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.get("nextLink", None), iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_child_collection_names.metadata = {'url': '/collections/{collectionName}/getChildCollectionNames'} # type: ignore + + @distributed_trace + def get_collection_path( + self, + collection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Any + """Gets the parent name and parent friendly name chains that represent the collection path. + + :param collection_name: + :type collection_name: str + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "parentFriendlyNameChain": [ + "str (optional)" + ], + "parentNameChain": [ + "str (optional)" + ] + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_collection_path_request( + collection_name=collection_name, + template_url=self.get_collection_path.metadata['url'], + ) + 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) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_collection_path.metadata = {'url': '/collections/{collectionName}/getCollectionPath'} # type: ignore + diff --git a/sdk/purview/azure-purview-account/azure/purview/account/operations/_resource_set_rules_operations.py b/sdk/purview/azure-purview-account/azure/purview/account/operations/_resource_set_rules_operations.py new file mode 100644 index 000000000000..4e65e11cab96 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/operations/_resource_set_rules_operations.py @@ -0,0 +1,907 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from json import loads as _loads +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from msrest import Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +# fmt: off + +def build_get_resource_set_rule_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/resourceSetRuleConfigs/defaultResourceSetRuleConfig') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_resource_set_rule_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/resourceSetRuleConfigs/defaultResourceSetRuleConfig') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_resource_set_rule_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/resourceSetRuleConfigs/defaultResourceSetRuleConfig') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_resource_set_rules_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + skip_token = kwargs.pop('skip_token', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/resourceSetRuleConfigs') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class ResourceSetRulesOperations(object): + """ResourceSetRulesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get_resource_set_rule( + self, + **kwargs # type: Any + ): + # type: (...) -> Any + """Get a resource set config service model. + + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_resource_set_rule_request( + template_url=self.get_resource_set_rule.metadata['url'], + ) + 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) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_resource_set_rule.metadata = {'url': '/resourceSetRuleConfigs/defaultResourceSetRuleConfig'} # type: ignore + + + @distributed_trace + def create_or_update_resource_set_rule( + self, + resource_set_rule_config, # type: Any + **kwargs # type: Any + ): + # type: (...) -> Any + """Creates or updates an resource set config. + + :param resource_set_rule_config: + :type resource_set_rule_config: Any + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + resource_set_rule_config = { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + + # response body for status code(s): 200 + response.json() == { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + json = resource_set_rule_config + + request = build_create_or_update_resource_set_rule_request( + content_type=content_type, + json=json, + template_url=self.create_or_update_resource_set_rule.metadata['url'], + ) + 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) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_resource_set_rule.metadata = {'url': '/resourceSetRuleConfigs/defaultResourceSetRuleConfig'} # type: ignore + + + @distributed_trace + def delete_resource_set_rule( + self, + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a ResourceSetRuleConfig resource. + + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_resource_set_rule_request( + template_url=self.delete_resource_set_rule.metadata['url'], + ) + 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) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) + + delete_resource_set_rule.metadata = {'url': '/resourceSetRuleConfigs/defaultResourceSetRuleConfig'} # type: ignore + + + @distributed_trace + def list_resource_set_rules( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable[Any] + """Get a resource set config service model. + + :keyword skip_token: + :paramtype skip_token: str + :return: An iterator like instance of JSON object + :rtype: ~azure.core.paging.ItemPaged[Any] + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "count": "long (optional)", + "nextLink": "str (optional)", + "value": [ + { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + ] + } + """ + skip_token = kwargs.pop('skip_token', None) # type: Optional[str] + + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_resource_set_rules_request( + skip_token=skip_token, + template_url=self.list_resource_set_rules.metadata['url'], + )._to_pipeline_transport_request() + 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) + + else: + + request = build_list_resource_set_rules_request( + skip_token=skip_token, + template_url=next_link, + )._to_pipeline_transport_request() + 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) + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = _loads(pipeline_response.http_response.body()) + list_of_elem = deserialized["value"] + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.get("nextLink", None), iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_resource_set_rules.metadata = {'url': '/resourceSetRuleConfigs'} # type: ignore diff --git a/sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/__init__.py b/sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/__init__.py deleted file mode 100644 index cf4233c5c1cb..000000000000 --- a/sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -try: - from ._request_builders_py3 import build_get_account_properties_request - from ._request_builders_py3 import build_update_account_properties_request - from ._request_builders_py3 import build_get_access_keys_request - from ._request_builders_py3 import build_regenerate_access_key_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_account_properties_request # type: ignore - from ._request_builders import build_update_account_properties_request # type: ignore - from ._request_builders import build_get_access_keys_request # type: ignore - from ._request_builders import build_regenerate_access_key_request # type: ignore - -__all__ = [ - 'build_get_account_properties_request', - 'build_update_account_properties_request', - 'build_get_access_keys_request', - 'build_regenerate_access_key_request', -] diff --git a/sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/_request_builders.py b/sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/_request_builders.py deleted file mode 100644 index e313fdfa6c14..000000000000 --- a/sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/_request_builders.py +++ /dev/null @@ -1,358 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING - -from azure.core.pipeline.transport._base import _format_url_section -from azure.core.rest import HttpRequest -from msrest import Serializer - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - -_SERIALIZER = Serializer() - -# fmt: off - -def build_get_account_properties_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - """Get an account. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response.json() == { - "id": "str (optional)", - "identity": { - "principalId": "str (optional)", - "tenantId": "str (optional)", - "type": "str (optional)" - }, - "location": "str (optional)", - "name": "str (optional)", - "properties": { - "cloudConnectors": { - "awsExternalId": "str (optional)" - }, - "createdAt": "datetime (optional)", - "createdBy": "str (optional)", - "createdByObjectId": "str (optional)", - "endpoints": { - "catalog": "str (optional)", - "guardian": "str (optional)", - "scan": "str (optional)" - }, - "friendlyName": "str (optional)", - "managedResourceGroupName": "str (optional)", - "managedResources": { - "eventHubNamespace": "str (optional)", - "resourceGroup": "str (optional)", - "storageAccount": "str (optional)" - }, - "privateEndpointConnections": [ - { - "id": "str (optional)", - "name": "str (optional)", - "properties": { - "privateEndpoint": { - "id": "str (optional)" - }, - "privateLinkServiceConnectionState": { - "actionsRequired": "str (optional)", - "description": "str (optional)", - "status": "str (optional)" - }, - "provisioningState": "str (optional)" - }, - "type": "str (optional)" - } - ], - "provisioningState": "str (optional)", - "publicNetworkAccess": "str (optional). Default value is \"Enabled\"" - }, - "sku": { - "capacity": "int (optional)", - "name": "str (optional)" - }, - "systemData": { - "createdAt": "datetime (optional)", - "createdBy": "str (optional)", - "createdByType": "str (optional)", - "lastModifiedAt": "datetime (optional)", - "lastModifiedBy": "str (optional)", - "lastModifiedByType": "str (optional)" - }, - "tags": { - "str": "str (optional)" - }, - "type": "str (optional)" - } - """ - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_update_account_properties_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - """Updates an account. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in - our example to find the input shape. - :paramtype json: any - :keyword content: Pass in binary content you want in the body of the request (typically bytes, - a byte iterator, or stream input). - :paramtype content: any - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "friendlyName": "str (optional)" - } - - # response body for status code(s): 200 - response.json() == { - "id": "str (optional)", - "identity": { - "principalId": "str (optional)", - "tenantId": "str (optional)", - "type": "str (optional)" - }, - "location": "str (optional)", - "name": "str (optional)", - "properties": { - "cloudConnectors": { - "awsExternalId": "str (optional)" - }, - "createdAt": "datetime (optional)", - "createdBy": "str (optional)", - "createdByObjectId": "str (optional)", - "endpoints": { - "catalog": "str (optional)", - "guardian": "str (optional)", - "scan": "str (optional)" - }, - "friendlyName": "str (optional)", - "managedResourceGroupName": "str (optional)", - "managedResources": { - "eventHubNamespace": "str (optional)", - "resourceGroup": "str (optional)", - "storageAccount": "str (optional)" - }, - "privateEndpointConnections": [ - { - "id": "str (optional)", - "name": "str (optional)", - "properties": { - "privateEndpoint": { - "id": "str (optional)" - }, - "privateLinkServiceConnectionState": { - "actionsRequired": "str (optional)", - "description": "str (optional)", - "status": "str (optional)" - }, - "provisioningState": "str (optional)" - }, - "type": "str (optional)" - } - ], - "provisioningState": "str (optional)", - "publicNetworkAccess": "str (optional). Default value is \"Enabled\"" - }, - "sku": { - "capacity": "int (optional)", - "name": "str (optional)" - }, - "systemData": { - "createdAt": "datetime (optional)", - "createdBy": "str (optional)", - "createdByType": "str (optional)", - "lastModifiedAt": "datetime (optional)", - "lastModifiedBy": "str (optional)", - "lastModifiedByType": "str (optional)" - }, - "tags": { - "str": "str (optional)" - }, - "type": "str (optional)" - } - """ - - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_access_keys_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - """List the authorization keys associated with this account. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response.json() == { - "atlasKafkaPrimaryEndpoint": "str (optional)", - "atlasKafkaSecondaryEndpoint": "str (optional)" - } - """ - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/listkeys') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_regenerate_access_key_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - """Regenerate the authorization keys associated with this data catalog. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in - our example to find the input shape. - :paramtype json: any - :keyword content: Pass in binary content you want in the body of the request (typically bytes, - a byte iterator, or stream input). - :paramtype content: any - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "keyType": "str (optional)" - } - - # response body for status code(s): 200 - response.json() == { - "atlasKafkaPrimaryEndpoint": "str (optional)", - "atlasKafkaSecondaryEndpoint": "str (optional)" - } - """ - - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/regeneratekeys') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - diff --git a/sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/_request_builders_py3.py b/sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/_request_builders_py3.py deleted file mode 100644 index c2e85a7d1445..000000000000 --- a/sdk/purview/azure-purview-account/azure/purview/account/rest/accounts/_request_builders_py3.py +++ /dev/null @@ -1,359 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.pipeline.transport._base import _format_url_section -from azure.core.rest import HttpRequest -from msrest import Serializer - -_SERIALIZER = Serializer() - - -def build_get_account_properties_request( - **kwargs: Any -) -> HttpRequest: - """Get an account. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response.json() == { - "id": "str (optional)", - "identity": { - "principalId": "str (optional)", - "tenantId": "str (optional)", - "type": "str (optional)" - }, - "location": "str (optional)", - "name": "str (optional)", - "properties": { - "cloudConnectors": { - "awsExternalId": "str (optional)" - }, - "createdAt": "datetime (optional)", - "createdBy": "str (optional)", - "createdByObjectId": "str (optional)", - "endpoints": { - "catalog": "str (optional)", - "guardian": "str (optional)", - "scan": "str (optional)" - }, - "friendlyName": "str (optional)", - "managedResourceGroupName": "str (optional)", - "managedResources": { - "eventHubNamespace": "str (optional)", - "resourceGroup": "str (optional)", - "storageAccount": "str (optional)" - }, - "privateEndpointConnections": [ - { - "id": "str (optional)", - "name": "str (optional)", - "properties": { - "privateEndpoint": { - "id": "str (optional)" - }, - "privateLinkServiceConnectionState": { - "actionsRequired": "str (optional)", - "description": "str (optional)", - "status": "str (optional)" - }, - "provisioningState": "str (optional)" - }, - "type": "str (optional)" - } - ], - "provisioningState": "str (optional)", - "publicNetworkAccess": "str (optional). Default value is \"Enabled\"" - }, - "sku": { - "capacity": "int (optional)", - "name": "str (optional)" - }, - "systemData": { - "createdAt": "datetime (optional)", - "createdBy": "str (optional)", - "createdByType": "str (optional)", - "lastModifiedAt": "datetime (optional)", - "lastModifiedBy": "str (optional)", - "lastModifiedByType": "str (optional)" - }, - "tags": { - "str": "str (optional)" - }, - "type": "str (optional)" - } - """ - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_update_account_properties_request( - *, - json: Any = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - """Updates an account. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in - our example to find the input shape. - :paramtype json: any - :keyword content: Pass in binary content you want in the body of the request (typically bytes, - a byte iterator, or stream input). - :paramtype content: any - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "friendlyName": "str (optional)" - } - - # response body for status code(s): 200 - response.json() == { - "id": "str (optional)", - "identity": { - "principalId": "str (optional)", - "tenantId": "str (optional)", - "type": "str (optional)" - }, - "location": "str (optional)", - "name": "str (optional)", - "properties": { - "cloudConnectors": { - "awsExternalId": "str (optional)" - }, - "createdAt": "datetime (optional)", - "createdBy": "str (optional)", - "createdByObjectId": "str (optional)", - "endpoints": { - "catalog": "str (optional)", - "guardian": "str (optional)", - "scan": "str (optional)" - }, - "friendlyName": "str (optional)", - "managedResourceGroupName": "str (optional)", - "managedResources": { - "eventHubNamespace": "str (optional)", - "resourceGroup": "str (optional)", - "storageAccount": "str (optional)" - }, - "privateEndpointConnections": [ - { - "id": "str (optional)", - "name": "str (optional)", - "properties": { - "privateEndpoint": { - "id": "str (optional)" - }, - "privateLinkServiceConnectionState": { - "actionsRequired": "str (optional)", - "description": "str (optional)", - "status": "str (optional)" - }, - "provisioningState": "str (optional)" - }, - "type": "str (optional)" - } - ], - "provisioningState": "str (optional)", - "publicNetworkAccess": "str (optional). Default value is \"Enabled\"" - }, - "sku": { - "capacity": "int (optional)", - "name": "str (optional)" - }, - "systemData": { - "createdAt": "datetime (optional)", - "createdBy": "str (optional)", - "createdByType": "str (optional)", - "lastModifiedAt": "datetime (optional)", - "lastModifiedBy": "str (optional)", - "lastModifiedByType": "str (optional)" - }, - "tags": { - "str": "str (optional)" - }, - "type": "str (optional)" - } - """ - - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_get_access_keys_request( - **kwargs: Any -) -> HttpRequest: - """List the authorization keys associated with this account. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response.json() == { - "atlasKafkaPrimaryEndpoint": "str (optional)", - "atlasKafkaSecondaryEndpoint": "str (optional)" - } - """ - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/listkeys') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_regenerate_access_key_request( - *, - json: Any = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - """Regenerate the authorization keys associated with this data catalog. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in - our example to find the input shape. - :paramtype json: any - :keyword content: Pass in binary content you want in the body of the request (typically bytes, - a byte iterator, or stream input). - :paramtype content: any - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "keyType": "str (optional)" - } - - # response body for status code(s): 200 - response.json() == { - "atlasKafkaPrimaryEndpoint": "str (optional)", - "atlasKafkaSecondaryEndpoint": "str (optional)" - } - """ - - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/regeneratekeys') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - diff --git a/sdk/purview/azure-purview-account/azure/purview/account/rest/collections/__init__.py b/sdk/purview/azure-purview-account/azure/purview/account/rest/collections/__init__.py deleted file mode 100644 index 3e1ee19e1e30..000000000000 --- a/sdk/purview/azure-purview-account/azure/purview/account/rest/collections/__init__.py +++ /dev/null @@ -1,31 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -try: - from ._request_builders_py3 import build_get_collection_request - from ._request_builders_py3 import build_create_or_update_collection_request - from ._request_builders_py3 import build_delete_collection_request - from ._request_builders_py3 import build_list_collections_request - from ._request_builders_py3 import build_list_child_collection_names_request - from ._request_builders_py3 import build_get_collection_path_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_collection_request # type: ignore - from ._request_builders import build_create_or_update_collection_request # type: ignore - from ._request_builders import build_delete_collection_request # type: ignore - from ._request_builders import build_list_collections_request # type: ignore - from ._request_builders import build_list_child_collection_names_request # type: ignore - from ._request_builders import build_get_collection_path_request # type: ignore - -__all__ = [ - 'build_get_collection_request', - 'build_create_or_update_collection_request', - 'build_delete_collection_request', - 'build_list_collections_request', - 'build_list_child_collection_names_request', - 'build_get_collection_path_request', -] diff --git a/sdk/purview/azure-purview-account/azure/purview/account/rest/collections/_request_builders.py b/sdk/purview/azure-purview-account/azure/purview/account/rest/collections/_request_builders.py deleted file mode 100644 index 3546bc416134..000000000000 --- a/sdk/purview/azure-purview-account/azure/purview/account/rest/collections/_request_builders.py +++ /dev/null @@ -1,427 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING - -from azure.core.pipeline.transport._base import _format_url_section -from azure.core.rest import HttpRequest -from msrest import Serializer - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - -_SERIALIZER = Serializer() - -# fmt: off - -def build_get_collection_request( - collection_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - """Get a collection. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :param collection_name: - :type collection_name: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response.json() == { - "collectionProvisioningState": "str (optional)", - "description": "str (optional)", - "friendlyName": "str (optional)", - "name": "str (optional)", - "parentCollection": { - "referenceName": "str (optional)", - "type": "str (optional)" - }, - "systemData": { - "createdAt": "datetime (optional)", - "createdBy": "str (optional)", - "createdByType": "str (optional)", - "lastModifiedAt": "datetime (optional)", - "lastModifiedBy": "str (optional)", - "lastModifiedByType": "str (optional)" - } - } - """ - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/collections/{collectionName}') - path_format_arguments = { - "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_collection_request( - collection_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - """Creates or updates a collection entity. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :param collection_name: - :type collection_name: str - :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in - our example to find the input shape. - :paramtype json: any - :keyword content: Pass in binary content you want in the body of the request (typically bytes, - a byte iterator, or stream input). - :paramtype content: any - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "collectionProvisioningState": "str (optional)", - "description": "str (optional)", - "friendlyName": "str (optional)", - "name": "str (optional)", - "parentCollection": { - "referenceName": "str (optional)", - "type": "str (optional)" - }, - "systemData": { - "createdAt": "datetime (optional)", - "createdBy": "str (optional)", - "createdByType": "str (optional)", - "lastModifiedAt": "datetime (optional)", - "lastModifiedBy": "str (optional)", - "lastModifiedByType": "str (optional)" - } - } - - # response body for status code(s): 200 - response.json() == { - "collectionProvisioningState": "str (optional)", - "description": "str (optional)", - "friendlyName": "str (optional)", - "name": "str (optional)", - "parentCollection": { - "referenceName": "str (optional)", - "type": "str (optional)" - }, - "systemData": { - "createdAt": "datetime (optional)", - "createdBy": "str (optional)", - "createdByType": "str (optional)", - "lastModifiedAt": "datetime (optional)", - "lastModifiedBy": "str (optional)", - "lastModifiedByType": "str (optional)" - } - } - """ - - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/collections/{collectionName}') - path_format_arguments = { - "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_delete_collection_request( - collection_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - """Deletes a Collection entity. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :param collection_name: - :type collection_name: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/collections/{collectionName}') - path_format_arguments = { - "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_collections_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - """List the collections in the account. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :keyword skip_token: - :paramtype skip_token: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response.json() == { - "count": "long (optional)", - "nextLink": "str (optional)", - "value": [ - { - "collectionProvisioningState": "str (optional)", - "description": "str (optional)", - "friendlyName": "str (optional)", - "name": "str (optional)", - "parentCollection": { - "referenceName": "str (optional)", - "type": "str (optional)" - }, - "systemData": { - "createdAt": "datetime (optional)", - "createdBy": "str (optional)", - "createdByType": "str (optional)", - "lastModifiedAt": "datetime (optional)", - "lastModifiedBy": "str (optional)", - "lastModifiedByType": "str (optional)" - } - } - ] - } - """ - - skip_token = kwargs.pop('skip_token', None) # type: Optional[str] - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/collections') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_child_collection_names_request( - collection_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - """Lists the child collections names in the collection. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :param collection_name: - :type collection_name: str - :keyword skip_token: - :paramtype skip_token: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response.json() == { - "count": "long (optional)", - "nextLink": "str (optional)", - "value": [ - { - "friendlyName": "str (optional)", - "name": "str (optional)" - } - ] - } - """ - - skip_token = kwargs.pop('skip_token', None) # type: Optional[str] - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/collections/{collectionName}/getChildCollectionNames') - path_format_arguments = { - "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_collection_path_request( - collection_name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest - """Gets the parent name and parent friendly name chains that represent the collection path. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :param collection_name: - :type collection_name: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response.json() == { - "parentFriendlyNameChain": [ - "str (optional)" - ], - "parentNameChain": [ - "str (optional)" - ] - } - """ - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/collections/{collectionName}/getCollectionPath') - path_format_arguments = { - "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - diff --git a/sdk/purview/azure-purview-account/azure/purview/account/rest/collections/_request_builders_py3.py b/sdk/purview/azure-purview-account/azure/purview/account/rest/collections/_request_builders_py3.py deleted file mode 100644 index e34bbaeb689a..000000000000 --- a/sdk/purview/azure-purview-account/azure/purview/account/rest/collections/_request_builders_py3.py +++ /dev/null @@ -1,421 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.pipeline.transport._base import _format_url_section -from azure.core.rest import HttpRequest -from msrest import Serializer - -_SERIALIZER = Serializer() - - -def build_get_collection_request( - collection_name: str, - **kwargs: Any -) -> HttpRequest: - """Get a collection. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :param collection_name: - :type collection_name: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response.json() == { - "collectionProvisioningState": "str (optional)", - "description": "str (optional)", - "friendlyName": "str (optional)", - "name": "str (optional)", - "parentCollection": { - "referenceName": "str (optional)", - "type": "str (optional)" - }, - "systemData": { - "createdAt": "datetime (optional)", - "createdBy": "str (optional)", - "createdByType": "str (optional)", - "lastModifiedAt": "datetime (optional)", - "lastModifiedBy": "str (optional)", - "lastModifiedByType": "str (optional)" - } - } - """ - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/collections/{collectionName}') - path_format_arguments = { - "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_collection_request( - collection_name: str, - *, - json: Any = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - """Creates or updates a collection entity. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :param collection_name: - :type collection_name: str - :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in - our example to find the input shape. - :paramtype json: any - :keyword content: Pass in binary content you want in the body of the request (typically bytes, - a byte iterator, or stream input). - :paramtype content: any - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "collectionProvisioningState": "str (optional)", - "description": "str (optional)", - "friendlyName": "str (optional)", - "name": "str (optional)", - "parentCollection": { - "referenceName": "str (optional)", - "type": "str (optional)" - }, - "systemData": { - "createdAt": "datetime (optional)", - "createdBy": "str (optional)", - "createdByType": "str (optional)", - "lastModifiedAt": "datetime (optional)", - "lastModifiedBy": "str (optional)", - "lastModifiedByType": "str (optional)" - } - } - - # response body for status code(s): 200 - response.json() == { - "collectionProvisioningState": "str (optional)", - "description": "str (optional)", - "friendlyName": "str (optional)", - "name": "str (optional)", - "parentCollection": { - "referenceName": "str (optional)", - "type": "str (optional)" - }, - "systemData": { - "createdAt": "datetime (optional)", - "createdBy": "str (optional)", - "createdByType": "str (optional)", - "lastModifiedAt": "datetime (optional)", - "lastModifiedBy": "str (optional)", - "lastModifiedByType": "str (optional)" - } - } - """ - - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/collections/{collectionName}') - path_format_arguments = { - "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_collection_request( - collection_name: str, - **kwargs: Any -) -> HttpRequest: - """Deletes a Collection entity. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :param collection_name: - :type collection_name: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/collections/{collectionName}') - path_format_arguments = { - "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_collections_request( - *, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """List the collections in the account. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :keyword skip_token: - :paramtype skip_token: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response.json() == { - "count": "long (optional)", - "nextLink": "str (optional)", - "value": [ - { - "collectionProvisioningState": "str (optional)", - "description": "str (optional)", - "friendlyName": "str (optional)", - "name": "str (optional)", - "parentCollection": { - "referenceName": "str (optional)", - "type": "str (optional)" - }, - "systemData": { - "createdAt": "datetime (optional)", - "createdBy": "str (optional)", - "createdByType": "str (optional)", - "lastModifiedAt": "datetime (optional)", - "lastModifiedBy": "str (optional)", - "lastModifiedByType": "str (optional)" - } - } - ] - } - """ - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/collections') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_child_collection_names_request( - collection_name: str, - *, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Lists the child collections names in the collection. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :param collection_name: - :type collection_name: str - :keyword skip_token: - :paramtype skip_token: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response.json() == { - "count": "long (optional)", - "nextLink": "str (optional)", - "value": [ - { - "friendlyName": "str (optional)", - "name": "str (optional)" - } - ] - } - """ - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/collections/{collectionName}/getChildCollectionNames') - path_format_arguments = { - "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_collection_path_request( - collection_name: str, - **kwargs: Any -) -> HttpRequest: - """Gets the parent name and parent friendly name chains that represent the collection path. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :param collection_name: - :type collection_name: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response.json() == { - "parentFriendlyNameChain": [ - "str (optional)" - ], - "parentNameChain": [ - "str (optional)" - ] - } - """ - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/collections/{collectionName}/getCollectionPath') - path_format_arguments = { - "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - diff --git a/sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/__init__.py b/sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/__init__.py deleted file mode 100644 index 72fe3c4cb97c..000000000000 --- a/sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -try: - from ._request_builders_py3 import build_get_resource_set_rule_request - from ._request_builders_py3 import build_create_or_update_resource_set_rule_request - from ._request_builders_py3 import build_delete_resource_set_rule_request - from ._request_builders_py3 import build_list_resource_set_rules_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_resource_set_rule_request # type: ignore - from ._request_builders import build_create_or_update_resource_set_rule_request # type: ignore - from ._request_builders import build_delete_resource_set_rule_request # type: ignore - from ._request_builders import build_list_resource_set_rules_request # type: ignore - -__all__ = [ - 'build_get_resource_set_rule_request', - 'build_create_or_update_resource_set_rule_request', - 'build_delete_resource_set_rule_request', - 'build_list_resource_set_rules_request', -] diff --git a/sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/_request_builders.py b/sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/_request_builders.py deleted file mode 100644 index 737be339b4f5..000000000000 --- a/sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/_request_builders.py +++ /dev/null @@ -1,715 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING - -from azure.core.pipeline.transport._base import _format_url_section -from azure.core.rest import HttpRequest -from msrest import Serializer - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - -_SERIALIZER = Serializer() - -# fmt: off - -def build_get_resource_set_rule_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - """Get a resource set config service model. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response.json() == { - "advancedResourceSet": { - "modifiedAt": "datetime (optional)", - "resourceSetProcessing": "str (optional)" - }, - "name": "str (optional)", - "pathPatternConfig": { - "acceptedPatterns": [ - { - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "filterType": "str (optional). Default value is \"Pattern\"", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "path": "str" - } - ], - "complexReplacers": [ - { - "createdBy": "str (optional)", - "description": "str (optional)", - "disableRecursiveReplacerApplication": "bool (optional)", - "disabled": "bool (optional)", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional)", - "name": "str (optional)", - "typeName": "str (optional)" - } - ], - "createdBy": "str", - "enableDefaultPatterns": "bool", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "normalizationRules": [ - { - "description": "str (optional)", - "disabled": "bool (optional)", - "dynamicReplacement": "bool (optional)", - "entityTypes": [ - "str (optional)" - ], - "lastUpdatedTimestamp": "long (optional)", - "name": "str (optional)", - "regex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "replaceWith": "str (optional)", - "version": "float (optional)" - } - ], - "regexReplacers": [ - { - "condition": "str (optional)", - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "description": "str (optional)", - "disableRecursiveReplacerApplication": "bool (optional)", - "disabled": "bool", - "doNotReplaceRegex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "regex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "replaceWith": "str (optional)" - } - ], - "rejectedPatterns": [ - { - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "filterType": "str (optional). Default value is \"Pattern\"", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "path": "str" - } - ], - "scopedRules": [ - { - "bindingUrl": "str", - "rules": [ - { - "displayName": "str (optional)", - "isResourceSet": "bool (optional). Default value is True", - "lastUpdatedTimestamp": "long (optional)", - "name": "str (optional)", - "qualifiedName": "str" - } - ], - "storeType": "str" - } - ], - "version": "int (optional). Default value is 0" - } - } - """ - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/resourceSetRuleConfigs/defaultResourceSetRuleConfig') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_resource_set_rule_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - """Creates or updates an resource set config. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in - our example to find the input shape. - :paramtype json: any - :keyword content: Pass in binary content you want in the body of the request (typically bytes, - a byte iterator, or stream input). - :paramtype content: any - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "advancedResourceSet": { - "modifiedAt": "datetime (optional)", - "resourceSetProcessing": "str (optional)" - }, - "name": "str (optional)", - "pathPatternConfig": { - "acceptedPatterns": [ - { - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "filterType": "str (optional). Default value is \"Pattern\"", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "path": "str" - } - ], - "complexReplacers": [ - { - "createdBy": "str (optional)", - "description": "str (optional)", - "disableRecursiveReplacerApplication": "bool (optional)", - "disabled": "bool (optional)", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional)", - "name": "str (optional)", - "typeName": "str (optional)" - } - ], - "createdBy": "str", - "enableDefaultPatterns": "bool", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "normalizationRules": [ - { - "description": "str (optional)", - "disabled": "bool (optional)", - "dynamicReplacement": "bool (optional)", - "entityTypes": [ - "str (optional)" - ], - "lastUpdatedTimestamp": "long (optional)", - "name": "str (optional)", - "regex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "replaceWith": "str (optional)", - "version": "float (optional)" - } - ], - "regexReplacers": [ - { - "condition": "str (optional)", - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "description": "str (optional)", - "disableRecursiveReplacerApplication": "bool (optional)", - "disabled": "bool", - "doNotReplaceRegex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "regex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "replaceWith": "str (optional)" - } - ], - "rejectedPatterns": [ - { - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "filterType": "str (optional). Default value is \"Pattern\"", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "path": "str" - } - ], - "scopedRules": [ - { - "bindingUrl": "str", - "rules": [ - { - "displayName": "str (optional)", - "isResourceSet": "bool (optional). Default value is True", - "lastUpdatedTimestamp": "long (optional)", - "name": "str (optional)", - "qualifiedName": "str" - } - ], - "storeType": "str" - } - ], - "version": "int (optional). Default value is 0" - } - } - - # response body for status code(s): 200 - response.json() == { - "advancedResourceSet": { - "modifiedAt": "datetime (optional)", - "resourceSetProcessing": "str (optional)" - }, - "name": "str (optional)", - "pathPatternConfig": { - "acceptedPatterns": [ - { - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "filterType": "str (optional). Default value is \"Pattern\"", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "path": "str" - } - ], - "complexReplacers": [ - { - "createdBy": "str (optional)", - "description": "str (optional)", - "disableRecursiveReplacerApplication": "bool (optional)", - "disabled": "bool (optional)", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional)", - "name": "str (optional)", - "typeName": "str (optional)" - } - ], - "createdBy": "str", - "enableDefaultPatterns": "bool", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "normalizationRules": [ - { - "description": "str (optional)", - "disabled": "bool (optional)", - "dynamicReplacement": "bool (optional)", - "entityTypes": [ - "str (optional)" - ], - "lastUpdatedTimestamp": "long (optional)", - "name": "str (optional)", - "regex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "replaceWith": "str (optional)", - "version": "float (optional)" - } - ], - "regexReplacers": [ - { - "condition": "str (optional)", - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "description": "str (optional)", - "disableRecursiveReplacerApplication": "bool (optional)", - "disabled": "bool", - "doNotReplaceRegex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "regex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "replaceWith": "str (optional)" - } - ], - "rejectedPatterns": [ - { - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "filterType": "str (optional). Default value is \"Pattern\"", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "path": "str" - } - ], - "scopedRules": [ - { - "bindingUrl": "str", - "rules": [ - { - "displayName": "str (optional)", - "isResourceSet": "bool (optional). Default value is True", - "lastUpdatedTimestamp": "long (optional)", - "name": "str (optional)", - "qualifiedName": "str" - } - ], - "storeType": "str" - } - ], - "version": "int (optional). Default value is 0" - } - } - """ - - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/resourceSetRuleConfigs/defaultResourceSetRuleConfig') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_delete_resource_set_rule_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - """Deletes a ResourceSetRuleConfig resource. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/resourceSetRuleConfigs/defaultResourceSetRuleConfig') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_resource_set_rules_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - """Get a resource set config service model. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :keyword skip_token: - :paramtype skip_token: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response.json() == { - "count": "long (optional)", - "nextLink": "str (optional)", - "value": [ - { - "advancedResourceSet": { - "modifiedAt": "datetime (optional)", - "resourceSetProcessing": "str (optional)" - }, - "name": "str (optional)", - "pathPatternConfig": { - "acceptedPatterns": [ - { - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "filterType": "str (optional). Default value is \"Pattern\"", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "path": "str" - } - ], - "complexReplacers": [ - { - "createdBy": "str (optional)", - "description": "str (optional)", - "disableRecursiveReplacerApplication": "bool (optional)", - "disabled": "bool (optional)", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional)", - "name": "str (optional)", - "typeName": "str (optional)" - } - ], - "createdBy": "str", - "enableDefaultPatterns": "bool", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "normalizationRules": [ - { - "description": "str (optional)", - "disabled": "bool (optional)", - "dynamicReplacement": "bool (optional)", - "entityTypes": [ - "str (optional)" - ], - "lastUpdatedTimestamp": "long (optional)", - "name": "str (optional)", - "regex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "replaceWith": "str (optional)", - "version": "float (optional)" - } - ], - "regexReplacers": [ - { - "condition": "str (optional)", - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "description": "str (optional)", - "disableRecursiveReplacerApplication": "bool (optional)", - "disabled": "bool", - "doNotReplaceRegex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "regex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "replaceWith": "str (optional)" - } - ], - "rejectedPatterns": [ - { - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "filterType": "str (optional). Default value is \"Pattern\"", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "path": "str" - } - ], - "scopedRules": [ - { - "bindingUrl": "str", - "rules": [ - { - "displayName": "str (optional)", - "isResourceSet": "bool (optional). Default value is True", - "lastUpdatedTimestamp": "long (optional)", - "name": "str (optional)", - "qualifiedName": "str" - } - ], - "storeType": "str" - } - ], - "version": "int (optional). Default value is 0" - } - } - ] - } - """ - - skip_token = kwargs.pop('skip_token', None) # type: Optional[str] - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/resourceSetRuleConfigs') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - diff --git a/sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/_request_builders_py3.py b/sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/_request_builders_py3.py deleted file mode 100644 index 364ec5a8625d..000000000000 --- a/sdk/purview/azure-purview-account/azure/purview/account/rest/resource_set_rules/_request_builders_py3.py +++ /dev/null @@ -1,711 +0,0 @@ -# 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) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.pipeline.transport._base import _format_url_section -from azure.core.rest import HttpRequest -from msrest import Serializer - -_SERIALIZER = Serializer() - - -def build_get_resource_set_rule_request( - **kwargs: Any -) -> HttpRequest: - """Get a resource set config service model. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response.json() == { - "advancedResourceSet": { - "modifiedAt": "datetime (optional)", - "resourceSetProcessing": "str (optional)" - }, - "name": "str (optional)", - "pathPatternConfig": { - "acceptedPatterns": [ - { - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "filterType": "str (optional). Default value is \"Pattern\"", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "path": "str" - } - ], - "complexReplacers": [ - { - "createdBy": "str (optional)", - "description": "str (optional)", - "disableRecursiveReplacerApplication": "bool (optional)", - "disabled": "bool (optional)", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional)", - "name": "str (optional)", - "typeName": "str (optional)" - } - ], - "createdBy": "str", - "enableDefaultPatterns": "bool", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "normalizationRules": [ - { - "description": "str (optional)", - "disabled": "bool (optional)", - "dynamicReplacement": "bool (optional)", - "entityTypes": [ - "str (optional)" - ], - "lastUpdatedTimestamp": "long (optional)", - "name": "str (optional)", - "regex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "replaceWith": "str (optional)", - "version": "float (optional)" - } - ], - "regexReplacers": [ - { - "condition": "str (optional)", - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "description": "str (optional)", - "disableRecursiveReplacerApplication": "bool (optional)", - "disabled": "bool", - "doNotReplaceRegex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "regex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "replaceWith": "str (optional)" - } - ], - "rejectedPatterns": [ - { - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "filterType": "str (optional). Default value is \"Pattern\"", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "path": "str" - } - ], - "scopedRules": [ - { - "bindingUrl": "str", - "rules": [ - { - "displayName": "str (optional)", - "isResourceSet": "bool (optional). Default value is True", - "lastUpdatedTimestamp": "long (optional)", - "name": "str (optional)", - "qualifiedName": "str" - } - ], - "storeType": "str" - } - ], - "version": "int (optional). Default value is 0" - } - } - """ - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/resourceSetRuleConfigs/defaultResourceSetRuleConfig') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_resource_set_rule_request( - *, - json: Any = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - """Creates or updates an resource set config. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in - our example to find the input shape. - :paramtype json: any - :keyword content: Pass in binary content you want in the body of the request (typically bytes, - a byte iterator, or stream input). - :paramtype content: any - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "advancedResourceSet": { - "modifiedAt": "datetime (optional)", - "resourceSetProcessing": "str (optional)" - }, - "name": "str (optional)", - "pathPatternConfig": { - "acceptedPatterns": [ - { - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "filterType": "str (optional). Default value is \"Pattern\"", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "path": "str" - } - ], - "complexReplacers": [ - { - "createdBy": "str (optional)", - "description": "str (optional)", - "disableRecursiveReplacerApplication": "bool (optional)", - "disabled": "bool (optional)", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional)", - "name": "str (optional)", - "typeName": "str (optional)" - } - ], - "createdBy": "str", - "enableDefaultPatterns": "bool", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "normalizationRules": [ - { - "description": "str (optional)", - "disabled": "bool (optional)", - "dynamicReplacement": "bool (optional)", - "entityTypes": [ - "str (optional)" - ], - "lastUpdatedTimestamp": "long (optional)", - "name": "str (optional)", - "regex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "replaceWith": "str (optional)", - "version": "float (optional)" - } - ], - "regexReplacers": [ - { - "condition": "str (optional)", - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "description": "str (optional)", - "disableRecursiveReplacerApplication": "bool (optional)", - "disabled": "bool", - "doNotReplaceRegex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "regex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "replaceWith": "str (optional)" - } - ], - "rejectedPatterns": [ - { - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "filterType": "str (optional). Default value is \"Pattern\"", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "path": "str" - } - ], - "scopedRules": [ - { - "bindingUrl": "str", - "rules": [ - { - "displayName": "str (optional)", - "isResourceSet": "bool (optional). Default value is True", - "lastUpdatedTimestamp": "long (optional)", - "name": "str (optional)", - "qualifiedName": "str" - } - ], - "storeType": "str" - } - ], - "version": "int (optional). Default value is 0" - } - } - - # response body for status code(s): 200 - response.json() == { - "advancedResourceSet": { - "modifiedAt": "datetime (optional)", - "resourceSetProcessing": "str (optional)" - }, - "name": "str (optional)", - "pathPatternConfig": { - "acceptedPatterns": [ - { - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "filterType": "str (optional). Default value is \"Pattern\"", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "path": "str" - } - ], - "complexReplacers": [ - { - "createdBy": "str (optional)", - "description": "str (optional)", - "disableRecursiveReplacerApplication": "bool (optional)", - "disabled": "bool (optional)", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional)", - "name": "str (optional)", - "typeName": "str (optional)" - } - ], - "createdBy": "str", - "enableDefaultPatterns": "bool", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "normalizationRules": [ - { - "description": "str (optional)", - "disabled": "bool (optional)", - "dynamicReplacement": "bool (optional)", - "entityTypes": [ - "str (optional)" - ], - "lastUpdatedTimestamp": "long (optional)", - "name": "str (optional)", - "regex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "replaceWith": "str (optional)", - "version": "float (optional)" - } - ], - "regexReplacers": [ - { - "condition": "str (optional)", - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "description": "str (optional)", - "disableRecursiveReplacerApplication": "bool (optional)", - "disabled": "bool", - "doNotReplaceRegex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "regex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "replaceWith": "str (optional)" - } - ], - "rejectedPatterns": [ - { - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "filterType": "str (optional). Default value is \"Pattern\"", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "path": "str" - } - ], - "scopedRules": [ - { - "bindingUrl": "str", - "rules": [ - { - "displayName": "str (optional)", - "isResourceSet": "bool (optional). Default value is True", - "lastUpdatedTimestamp": "long (optional)", - "name": "str (optional)", - "qualifiedName": "str" - } - ], - "storeType": "str" - } - ], - "version": "int (optional). Default value is 0" - } - } - """ - - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/resourceSetRuleConfigs/defaultResourceSetRuleConfig') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_resource_set_rule_request( - **kwargs: Any -) -> HttpRequest: - """Deletes a ResourceSetRuleConfig resource. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/resourceSetRuleConfigs/defaultResourceSetRuleConfig') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_list_resource_set_rules_request( - *, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Get a resource set config service model. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :keyword skip_token: - :paramtype skip_token: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response.json() == { - "count": "long (optional)", - "nextLink": "str (optional)", - "value": [ - { - "advancedResourceSet": { - "modifiedAt": "datetime (optional)", - "resourceSetProcessing": "str (optional)" - }, - "name": "str (optional)", - "pathPatternConfig": { - "acceptedPatterns": [ - { - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "filterType": "str (optional). Default value is \"Pattern\"", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "path": "str" - } - ], - "complexReplacers": [ - { - "createdBy": "str (optional)", - "description": "str (optional)", - "disableRecursiveReplacerApplication": "bool (optional)", - "disabled": "bool (optional)", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional)", - "name": "str (optional)", - "typeName": "str (optional)" - } - ], - "createdBy": "str", - "enableDefaultPatterns": "bool", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "normalizationRules": [ - { - "description": "str (optional)", - "disabled": "bool (optional)", - "dynamicReplacement": "bool (optional)", - "entityTypes": [ - "str (optional)" - ], - "lastUpdatedTimestamp": "long (optional)", - "name": "str (optional)", - "regex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "replaceWith": "str (optional)", - "version": "float (optional)" - } - ], - "regexReplacers": [ - { - "condition": "str (optional)", - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "description": "str (optional)", - "disableRecursiveReplacerApplication": "bool (optional)", - "disabled": "bool", - "doNotReplaceRegex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "regex": { - "maxDigits": "int (optional)", - "maxLetters": "int (optional)", - "minDashes": "int (optional)", - "minDigits": "int (optional)", - "minDigitsOrLetters": "int (optional)", - "minDots": "int (optional)", - "minHex": "int (optional)", - "minLetters": "int (optional)", - "minUnderscores": "int (optional)", - "options": "int (optional)", - "regexStr": "str (optional)" - }, - "replaceWith": "str (optional)" - } - ], - "rejectedPatterns": [ - { - "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", - "filterType": "str (optional). Default value is \"Pattern\"", - "lastUpdatedTimestamp": "long (optional)", - "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", - "name": "str", - "path": "str" - } - ], - "scopedRules": [ - { - "bindingUrl": "str", - "rules": [ - { - "displayName": "str (optional)", - "isResourceSet": "bool (optional). Default value is True", - "lastUpdatedTimestamp": "long (optional)", - "name": "str (optional)", - "qualifiedName": "str" - } - ], - "storeType": "str" - } - ], - "version": "int (optional). Default value is 0" - } - } - ] - } - """ - - api_version = "2019-11-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/resourceSetRuleConfigs') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - diff --git a/sdk/purview/azure-purview-account/swagger/README.md b/sdk/purview/azure-purview-account/swagger/README.md index 3cefe5bdc56d..a863f80392a6 100644 --- a/sdk/purview/azure-purview-account/swagger/README.md +++ b/sdk/purview/azure-purview-account/swagger/README.md @@ -29,7 +29,7 @@ clear-output-folder: true no-namespace-folders: true python: true title: PurviewAccountClient -low-level-client: true +version-tolerant: true package-version: 1.0.0b1 add-credential: true credential-scopes: https://purview.azure.net/.default diff --git a/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_basic_smoke_test.yaml b/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_basic_smoke_test.yaml index 54ae6aa679c7..b44c2de62d32 100644 --- a/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_basic_smoke_test.yaml +++ b/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_basic_smoke_test.yaml @@ -21,7 +21,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 12 Aug 2021 02:40:41 GMT + - Wed, 18 Aug 2021 05:23:33 GMT server: - Kestrel strict-transport-security: diff --git a/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_basic_smoke_test.yaml b/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_basic_smoke_test.yaml index ab59555f0695..440e7c73c7b9 100644 --- a/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_basic_smoke_test.yaml +++ b/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_basic_smoke_test.yaml @@ -13,7 +13,7 @@ interactions: string: '{"atlasKafkaPrimaryEndpoint":"000","atlasKafkaSecondaryEndpoint":"000"}' headers: content-type: application/json; charset=utf-8 - date: Thu, 12 Aug 2021 02:40:37 GMT + date: Wed, 18 Aug 2021 05:25:18 GMT server: Kestrel strict-transport-security: max-age=31536000; includeSubDomains transfer-encoding: chunked diff --git a/sdk/purview/azure-purview-account/tests/test_smoke.py b/sdk/purview/azure-purview-account/tests/test_smoke.py index 704a3ef5f59e..8635543efc5d 100644 --- a/sdk/purview/azure-purview-account/tests/test_smoke.py +++ b/sdk/purview/azure-purview-account/tests/test_smoke.py @@ -5,7 +5,6 @@ # license information. # ------------------------------------------------------------------------- from testcase import PurviewAccountTest, PurviewAccountPowerShellPreparer -from azure.purview.account.rest import accounts class PurviewAccountSmokeTest(PurviewAccountTest): @@ -13,9 +12,5 @@ class PurviewAccountSmokeTest(PurviewAccountTest): @PurviewAccountPowerShellPreparer() def test_basic_smoke_test(self, purviewaccount_endpoint): client = self.create_client(endpoint=purviewaccount_endpoint) - request = accounts.build_get_access_keys_request() - response = client.send_request(request) - response.raise_for_status() - assert response.status_code == 200 - json_response = response.json() - assert set(json_response.keys()) == set(['atlasKafkaPrimaryEndpoint', 'atlasKafkaSecondaryEndpoint']) + response = client.accounts.get_access_keys() + assert set(response.keys()) == set(['atlasKafkaPrimaryEndpoint', 'atlasKafkaSecondaryEndpoint']) diff --git a/sdk/purview/azure-purview-account/tests/test_smoke_async.py b/sdk/purview/azure-purview-account/tests/test_smoke_async.py index 915d03aec5fa..02ce95e3fea6 100644 --- a/sdk/purview/azure-purview-account/tests/test_smoke_async.py +++ b/sdk/purview/azure-purview-account/tests/test_smoke_async.py @@ -6,16 +6,12 @@ # ------------------------------------------------------------------------- from testcase import PurviewAccountPowerShellPreparer from testcase_async import PurviewAccountTestAsync -from azure.purview.account.rest import accounts class PurviewAccountSmokeTestAsync(PurviewAccountTestAsync): @PurviewAccountPowerShellPreparer() async def test_basic_smoke_test(self, purviewaccount_endpoint): - request = accounts.build_get_access_keys_request() - client = self.create_async_client(endpoint=purviewaccount_endpoint) - response = await client.send_request(request) - response.raise_for_status() - assert response.status_code == 200 + response = await client.accounts.get_access_keys() + assert set(response.keys()) == set(['atlasKafkaPrimaryEndpoint', 'atlasKafkaSecondaryEndpoint']) diff --git a/sdk/purview/azure-purview-account/tests/testcase.py b/sdk/purview/azure-purview-account/tests/testcase.py index 11652d9107db..f01c7f1888f8 100644 --- a/sdk/purview/azure-purview-account/tests/testcase.py +++ b/sdk/purview/azure-purview-account/tests/testcase.py @@ -16,7 +16,6 @@ def __init__(self, method_name, **kwargs): self.recording_processors.append(PurviewAccountRecordingProcessor()) def create_client(self, endpoint): - self.recording_processors.append(PurviewAccountRecordingProcessor()) credential = self.get_credential(PurviewAccountClient) return self.create_client_from_credential( PurviewAccountClient, From 9761f926a8dbc661999a83c8140907adeca62777 Mon Sep 17 00:00:00 2001 From: msyyc <70930885+msyyc@users.noreply.github.com> Date: Thu, 19 Aug 2021 13:53:19 +0800 Subject: [PATCH 4/8] endpoint order --- .../azure/purview/account/_configuration.py | 12 ++++++------ .../azure/purview/account/_purview_account_client.py | 10 +++++----- .../azure/purview/account/aio/_configuration.py | 12 ++++++------ .../purview/account/aio/_purview_account_client.py | 10 +++++----- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/sdk/purview/azure-purview-account/azure/purview/account/_configuration.py b/sdk/purview/azure-purview-account/azure/purview/account/_configuration.py index afa56e46859b..74582061d3e2 100644 --- a/sdk/purview/azure-purview-account/azure/purview/account/_configuration.py +++ b/sdk/purview/azure-purview-account/azure/purview/account/_configuration.py @@ -26,27 +26,27 @@ class PurviewAccountClientConfiguration(Configuration): Note that all parameters used to create this instance are saved as instance attributes. + :param endpoint: The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/account/. + :type endpoint: str :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param endpoint: The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com. - :type endpoint: str """ def __init__( self, - credential, # type: "TokenCredential" endpoint, # type: str + credential, # type: "TokenCredential" **kwargs # type: Any ): # type: (...) -> None - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") super(PurviewAccountClientConfiguration, self).__init__(**kwargs) - self.credential = credential self.endpoint = endpoint + self.credential = credential self.api_version = "2019-11-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://purview.azure.net/.default']) kwargs.setdefault('sdk_moniker', 'purview-account/{}'.format(VERSION)) diff --git a/sdk/purview/azure-purview-account/azure/purview/account/_purview_account_client.py b/sdk/purview/azure-purview-account/azure/purview/account/_purview_account_client.py index d81a8bed7f22..60dba90a7c6c 100644 --- a/sdk/purview/azure-purview-account/azure/purview/account/_purview_account_client.py +++ b/sdk/purview/azure-purview-account/azure/purview/account/_purview_account_client.py @@ -31,22 +31,22 @@ class PurviewAccountClient(object): :vartype collections: azure.purview.account.operations.CollectionsOperations :ivar resource_set_rules: ResourceSetRulesOperations operations :vartype resource_set_rules: azure.purview.account.operations.ResourceSetRulesOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential :param endpoint: The account endpoint of your Purview account. Example: - https://{accountName}.purview.azure.com. + https://{accountName}.purview.azure.com/account/. :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential """ def __init__( self, - credential, # type: "TokenCredential" endpoint, # type: str + credential, # type: "TokenCredential" **kwargs # type: Any ): # type: (...) -> None base_url = '{endpoint}' - self._config = PurviewAccountClientConfiguration(credential, endpoint, **kwargs) + self._config = PurviewAccountClientConfiguration(endpoint, credential, **kwargs) self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) self._serialize = Serializer() diff --git a/sdk/purview/azure-purview-account/azure/purview/account/aio/_configuration.py b/sdk/purview/azure-purview-account/azure/purview/account/aio/_configuration.py index bfd9b6b02f66..655f01975acb 100644 --- a/sdk/purview/azure-purview-account/azure/purview/account/aio/_configuration.py +++ b/sdk/purview/azure-purview-account/azure/purview/account/aio/_configuration.py @@ -24,26 +24,26 @@ class PurviewAccountClientConfiguration(Configuration): Note that all parameters used to create this instance are saved as instance attributes. + :param endpoint: The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/account/. + :type endpoint: str :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param endpoint: The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com. - :type endpoint: str """ def __init__( self, - credential: "AsyncTokenCredential", endpoint: str, + credential: "AsyncTokenCredential", **kwargs: Any ) -> None: - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") super(PurviewAccountClientConfiguration, self).__init__(**kwargs) - self.credential = credential self.endpoint = endpoint + self.credential = credential self.api_version = "2019-11-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://purview.azure.net/.default']) kwargs.setdefault('sdk_moniker', 'purview-account/{}'.format(VERSION)) diff --git a/sdk/purview/azure-purview-account/azure/purview/account/aio/_purview_account_client.py b/sdk/purview/azure-purview-account/azure/purview/account/aio/_purview_account_client.py index 5ce7021b382a..7488ebabd55f 100644 --- a/sdk/purview/azure-purview-account/azure/purview/account/aio/_purview_account_client.py +++ b/sdk/purview/azure-purview-account/azure/purview/account/aio/_purview_account_client.py @@ -31,21 +31,21 @@ class PurviewAccountClient: :vartype collections: azure.purview.account.aio.operations.CollectionsOperations :ivar resource_set_rules: ResourceSetRulesOperations operations :vartype resource_set_rules: azure.purview.account.aio.operations.ResourceSetRulesOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param endpoint: The account endpoint of your Purview account. Example: - https://{accountName}.purview.azure.com. + https://{accountName}.purview.azure.com/account/. :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential """ def __init__( self, - credential: "AsyncTokenCredential", endpoint: str, + credential: "AsyncTokenCredential", **kwargs: Any ) -> None: base_url = '{endpoint}' - self._config = PurviewAccountClientConfiguration(credential, endpoint, **kwargs) + self._config = PurviewAccountClientConfiguration(endpoint, credential, **kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) self._serialize = Serializer() From 332c0d510c9b67abb5434dfd79f43e02b922315f Mon Sep 17 00:00:00 2001 From: msyyc <70930885+msyyc@users.noreply.github.com> Date: Mon, 23 Aug 2021 11:36:42 +0800 Subject: [PATCH 5/8] add test for collections --- .../account/_purview_account_client.py | 6 ++-- .../account/aio/_purview_account_client.py | 6 ++-- .../azure-purview-account/tests/_util.py | 12 +++++++ .../test_smoke.test_basic_smoke_test.yaml | 2 +- .../test_smoke.test_collections_list.yaml | 34 +++++++++++++++++++ ...est_smoke_async.test_basic_smoke_test.yaml | 2 +- ...est_smoke_async.test_collections_list.yaml | 26 ++++++++++++++ .../azure-purview-account/tests/test_smoke.py | 10 ++++++ .../tests/test_smoke_async.py | 10 ++++++ .../azure-purview-account/tests/testcase.py | 2 -- .../tests/testcase_async.py | 2 -- 11 files changed, 100 insertions(+), 12 deletions(-) create mode 100644 sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_collections_list.yaml create mode 100644 sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_collections_list.yaml diff --git a/sdk/purview/azure-purview-account/azure/purview/account/_purview_account_client.py b/sdk/purview/azure-purview-account/azure/purview/account/_purview_account_client.py index 60dba90a7c6c..62c1ff6f00c0 100644 --- a/sdk/purview/azure-purview-account/azure/purview/account/_purview_account_client.py +++ b/sdk/purview/azure-purview-account/azure/purview/account/_purview_account_client.py @@ -17,7 +17,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict + from typing import Any, Dict, Optional from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse @@ -45,9 +45,9 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None - base_url = '{endpoint}' + _endpoint = '{endpoint}' self._config = PurviewAccountClientConfiguration(endpoint, credential, **kwargs) - self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() diff --git a/sdk/purview/azure-purview-account/azure/purview/account/aio/_purview_account_client.py b/sdk/purview/azure-purview-account/azure/purview/account/aio/_purview_account_client.py index 7488ebabd55f..80968f3291bd 100644 --- a/sdk/purview/azure-purview-account/azure/purview/account/aio/_purview_account_client.py +++ b/sdk/purview/azure-purview-account/azure/purview/account/aio/_purview_account_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -44,9 +44,9 @@ def __init__( credential: "AsyncTokenCredential", **kwargs: Any ) -> None: - base_url = '{endpoint}' + _endpoint = '{endpoint}' self._config = PurviewAccountClientConfiguration(endpoint, credential, **kwargs) - self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() diff --git a/sdk/purview/azure-purview-account/tests/_util.py b/sdk/purview/azure-purview-account/tests/_util.py index d33af186c670..2f45bd9149a5 100644 --- a/sdk/purview/azure-purview-account/tests/_util.py +++ b/sdk/purview/azure-purview-account/tests/_util.py @@ -5,9 +5,21 @@ # license information. # -------------------------------------------------------------------------- from azure_devtools.scenario_tests import RecordingProcessor +import json class PurviewAccountRecordingProcessor(RecordingProcessor): def process_response(self, response): response["body"]["string"] = '{"atlasKafkaPrimaryEndpoint":"000","atlasKafkaSecondaryEndpoint":"000"}' return response + + +class PurviewAccountCollectionsRecordingProcessor(RecordingProcessor): + def process_response(self, response): + try: + body = json.loads(response["body"]["string"]) + for value in body["value"]: + value["systemData"] = "000" + response["body"]["string"] = json.dumps(body) + finally: + return response diff --git a/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_basic_smoke_test.yaml b/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_basic_smoke_test.yaml index b44c2de62d32..41b76bb794f4 100644 --- a/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_basic_smoke_test.yaml +++ b/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_basic_smoke_test.yaml @@ -21,7 +21,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 18 Aug 2021 05:23:33 GMT + - Mon, 23 Aug 2021 03:36:05 GMT server: - Kestrel strict-transport-security: diff --git a/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_collections_list.yaml b/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_collections_list.yaml new file mode 100644 index 000000000000..cb1f9a4e71be --- /dev/null +++ b/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_collections_list.yaml @@ -0,0 +1,34 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-purview-account/1.0.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://fake_account.account.purview.azure.com/collections?api-version=2019-11-01-preview + response: + body: + string: '{"value": [{"name": "purview-msyyc", "friendlyName": "purview-msyyc", + "description": "The root collection.", "systemData": "000", "collectionProvisioningState": + "Succeeded"}], "count": 1}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 Aug 2021 03:36:07 GMT + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_basic_smoke_test.yaml b/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_basic_smoke_test.yaml index 440e7c73c7b9..b3d3b93fd220 100644 --- a/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_basic_smoke_test.yaml +++ b/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_basic_smoke_test.yaml @@ -13,7 +13,7 @@ interactions: string: '{"atlasKafkaPrimaryEndpoint":"000","atlasKafkaSecondaryEndpoint":"000"}' headers: content-type: application/json; charset=utf-8 - date: Wed, 18 Aug 2021 05:25:18 GMT + date: Mon, 23 Aug 2021 03:34:46 GMT server: Kestrel strict-transport-security: max-age=31536000; includeSubDomains transfer-encoding: chunked diff --git a/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_collections_list.yaml b/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_collections_list.yaml new file mode 100644 index 000000000000..18faadee6861 --- /dev/null +++ b/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_collections_list.yaml @@ -0,0 +1,26 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-purview-account/1.0.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://fake_account.account.purview.azure.com/collections?api-version=2019-11-01-preview + response: + body: + string: '{"value": [{"name": "purview-msyyc", "friendlyName": "purview-msyyc", + "description": "The root collection.", "systemData": "000", "collectionProvisioningState": + "Succeeded"}], "count": 1}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 Aug 2021 03:34:47 GMT + server: Kestrel + strict-transport-security: max-age=31536000; includeSubDomains + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://purview-msyyc.purview.azure.com/collections?api-version=2019-11-01-preview +version: 1 diff --git a/sdk/purview/azure-purview-account/tests/test_smoke.py b/sdk/purview/azure-purview-account/tests/test_smoke.py index 8635543efc5d..b15ac91d3d0a 100644 --- a/sdk/purview/azure-purview-account/tests/test_smoke.py +++ b/sdk/purview/azure-purview-account/tests/test_smoke.py @@ -5,12 +5,22 @@ # license information. # ------------------------------------------------------------------------- from testcase import PurviewAccountTest, PurviewAccountPowerShellPreparer +from _util import PurviewAccountRecordingProcessor, PurviewAccountCollectionsRecordingProcessor class PurviewAccountSmokeTest(PurviewAccountTest): @PurviewAccountPowerShellPreparer() def test_basic_smoke_test(self, purviewaccount_endpoint): + self.recording_processors.append(PurviewAccountRecordingProcessor()) client = self.create_client(endpoint=purviewaccount_endpoint) response = client.accounts.get_access_keys() assert set(response.keys()) == set(['atlasKafkaPrimaryEndpoint', 'atlasKafkaSecondaryEndpoint']) + + @PurviewAccountPowerShellPreparer() + def test_collections_list(self, purviewaccount_endpoint): + self.recording_processors.append(PurviewAccountCollectionsRecordingProcessor()) + client = self.create_client(endpoint=purviewaccount_endpoint) + response = client.collections.list_collections() + result = [item for item in response] + assert len(result) > 0 diff --git a/sdk/purview/azure-purview-account/tests/test_smoke_async.py b/sdk/purview/azure-purview-account/tests/test_smoke_async.py index 02ce95e3fea6..2f3a548f4b77 100644 --- a/sdk/purview/azure-purview-account/tests/test_smoke_async.py +++ b/sdk/purview/azure-purview-account/tests/test_smoke_async.py @@ -6,12 +6,22 @@ # ------------------------------------------------------------------------- from testcase import PurviewAccountPowerShellPreparer from testcase_async import PurviewAccountTestAsync +from _util import PurviewAccountRecordingProcessor, PurviewAccountCollectionsRecordingProcessor class PurviewAccountSmokeTestAsync(PurviewAccountTestAsync): @PurviewAccountPowerShellPreparer() async def test_basic_smoke_test(self, purviewaccount_endpoint): + self.recording_processors.append(PurviewAccountRecordingProcessor()) client = self.create_async_client(endpoint=purviewaccount_endpoint) response = await client.accounts.get_access_keys() assert set(response.keys()) == set(['atlasKafkaPrimaryEndpoint', 'atlasKafkaSecondaryEndpoint']) + + @PurviewAccountPowerShellPreparer() + async def test_collections_list(self, purviewaccount_endpoint): + self.recording_processors.append(PurviewAccountCollectionsRecordingProcessor()) + client = self.create_async_client(endpoint=purviewaccount_endpoint) + response = client.collections.list_collections() + result = [item async for item in response] + assert len(result) > 0 diff --git a/sdk/purview/azure-purview-account/tests/testcase.py b/sdk/purview/azure-purview-account/tests/testcase.py index f01c7f1888f8..1668f540b03c 100644 --- a/sdk/purview/azure-purview-account/tests/testcase.py +++ b/sdk/purview/azure-purview-account/tests/testcase.py @@ -7,13 +7,11 @@ import functools from devtools_testutils import AzureTestCase, PowerShellPreparer from azure.purview.account import PurviewAccountClient -from _util import PurviewAccountRecordingProcessor class PurviewAccountTest(AzureTestCase): def __init__(self, method_name, **kwargs): super(PurviewAccountTest, self).__init__(method_name, **kwargs) - self.recording_processors.append(PurviewAccountRecordingProcessor()) def create_client(self, endpoint): credential = self.get_credential(PurviewAccountClient) diff --git a/sdk/purview/azure-purview-account/tests/testcase_async.py b/sdk/purview/azure-purview-account/tests/testcase_async.py index ea2907c07b82..0b45881ee9cc 100644 --- a/sdk/purview/azure-purview-account/tests/testcase_async.py +++ b/sdk/purview/azure-purview-account/tests/testcase_async.py @@ -6,13 +6,11 @@ # -------------------------------------------------------------------------- from devtools_testutils import AzureTestCase from azure.purview.account.aio import PurviewAccountClient as AsyncPurviewAccountClient -from _util import PurviewAccountRecordingProcessor class PurviewAccountTestAsync(AzureTestCase): def __init__(self, method_name, **kwargs): super(PurviewAccountTestAsync, self).__init__(method_name, **kwargs) - self.recording_processors.append(PurviewAccountRecordingProcessor()) def create_async_client(self, endpoint): credential = self.get_credential(AsyncPurviewAccountClient, is_async=True) From 22e3480c70b14119fb908198da3778fe180d9221 Mon Sep 17 00:00:00 2001 From: msyyc <70930885+msyyc@users.noreply.github.com> Date: Mon, 23 Aug 2021 13:45:29 +0800 Subject: [PATCH 6/8] Update CHANGELOG.md --- sdk/purview/azure-purview-account/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/purview/azure-purview-account/CHANGELOG.md b/sdk/purview/azure-purview-account/CHANGELOG.md index 6e4194adf085..4e25394e1429 100644 --- a/sdk/purview/azure-purview-account/CHANGELOG.md +++ b/sdk/purview/azure-purview-account/CHANGELOG.md @@ -1,5 +1,5 @@ # Release History -## 1.0.0b1 (2021-08-11) +## 1.0.0b1 (2021-08-23) - This is the initial release of the Azure Purview Account library. From ca82094df6671caefaa09966b181426f575a1d35 Mon Sep 17 00:00:00 2001 From: msyyc <70930885+msyyc@users.noreply.github.com> Date: Tue, 24 Aug 2021 11:00:47 +0800 Subject: [PATCH 7/8] review --- sdk/purview/azure-purview-account/README.md | 16 +++------------- .../test_smoke.test_basic_smoke_test.yaml | 2 +- .../test_smoke.test_collections_list.yaml | 2 +- .../test_smoke_async.test_basic_smoke_test.yaml | 2 +- .../test_smoke_async.test_collections_list.yaml | 2 +- .../azure-purview-account/tests/test_smoke.py | 3 ++- .../tests/test_smoke_async.py | 3 ++- 7 files changed, 11 insertions(+), 19 deletions(-) diff --git a/sdk/purview/azure-purview-account/README.md b/sdk/purview/azure-purview-account/README.md index c7b1421a766d..071b5796ff07 100644 --- a/sdk/purview/azure-purview-account/README.md +++ b/sdk/purview/azure-purview-account/README.md @@ -69,21 +69,11 @@ The following section shows you how to initialize and authenticate your client, ```python from azure.purview.account import PurviewAccountClient from azure.identity import DefaultAzureCredential -from azure.purview.account.rest import accounts -from azure.core.exceptions import HttpResponseError credential = DefaultAzureCredential() client = PurviewAccountClient(endpoint="https://.purview.azure.com", credential=credential) - -request = accounts.build_list_keys_request() - -response = client.send_request(request) -try: - response.raise_for_status() - assert response.status_code == 200 - -except HttpResponseError as e: - print(e) +response = client.accounts.get_access_keys() +print(response) ``` ## Troubleshooting @@ -127,7 +117,7 @@ Similarly, `logging_enable` can enable detailed logging for a single `send_reque even when it isn't enabled for the client: ```python -result = client.send_request(request, logging_enable=True) +result = client.accounts.get_access_keys(logging_enable=True) ``` ## Next steps diff --git a/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_basic_smoke_test.yaml b/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_basic_smoke_test.yaml index 41b76bb794f4..ccfa4efef067 100644 --- a/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_basic_smoke_test.yaml +++ b/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_basic_smoke_test.yaml @@ -21,7 +21,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 23 Aug 2021 03:36:05 GMT + - Tue, 24 Aug 2021 03:00:07 GMT server: - Kestrel strict-transport-security: diff --git a/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_collections_list.yaml b/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_collections_list.yaml index cb1f9a4e71be..a9c39433f1e5 100644 --- a/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_collections_list.yaml +++ b/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_collections_list.yaml @@ -21,7 +21,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 23 Aug 2021 03:36:07 GMT + - Tue, 24 Aug 2021 03:00:09 GMT server: - Kestrel strict-transport-security: diff --git a/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_basic_smoke_test.yaml b/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_basic_smoke_test.yaml index b3d3b93fd220..480b26a80f6c 100644 --- a/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_basic_smoke_test.yaml +++ b/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_basic_smoke_test.yaml @@ -13,7 +13,7 @@ interactions: string: '{"atlasKafkaPrimaryEndpoint":"000","atlasKafkaSecondaryEndpoint":"000"}' headers: content-type: application/json; charset=utf-8 - date: Mon, 23 Aug 2021 03:34:46 GMT + date: Tue, 24 Aug 2021 03:00:26 GMT server: Kestrel strict-transport-security: max-age=31536000; includeSubDomains transfer-encoding: chunked diff --git a/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_collections_list.yaml b/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_collections_list.yaml index 18faadee6861..c0a4f323f0cc 100644 --- a/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_collections_list.yaml +++ b/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_collections_list.yaml @@ -15,7 +15,7 @@ interactions: "Succeeded"}], "count": 1}' headers: content-type: application/json; charset=utf-8 - date: Mon, 23 Aug 2021 03:34:47 GMT + date: Tue, 24 Aug 2021 03:00:29 GMT server: Kestrel strict-transport-security: max-age=31536000; includeSubDomains transfer-encoding: chunked diff --git a/sdk/purview/azure-purview-account/tests/test_smoke.py b/sdk/purview/azure-purview-account/tests/test_smoke.py index b15ac91d3d0a..104feb458b65 100644 --- a/sdk/purview/azure-purview-account/tests/test_smoke.py +++ b/sdk/purview/azure-purview-account/tests/test_smoke.py @@ -23,4 +23,5 @@ def test_collections_list(self, purviewaccount_endpoint): client = self.create_client(endpoint=purviewaccount_endpoint) response = client.collections.list_collections() result = [item for item in response] - assert len(result) > 0 + for item in result: + assert set(item.keys()) == set(['name', 'friendlyName', 'description', 'systemData', 'collectionProvisioningState']) diff --git a/sdk/purview/azure-purview-account/tests/test_smoke_async.py b/sdk/purview/azure-purview-account/tests/test_smoke_async.py index 2f3a548f4b77..7d98e1042b5d 100644 --- a/sdk/purview/azure-purview-account/tests/test_smoke_async.py +++ b/sdk/purview/azure-purview-account/tests/test_smoke_async.py @@ -24,4 +24,5 @@ async def test_collections_list(self, purviewaccount_endpoint): client = self.create_async_client(endpoint=purviewaccount_endpoint) response = client.collections.list_collections() result = [item async for item in response] - assert len(result) > 0 + for item in result: + assert set(item.keys()) == set(['name', 'friendlyName', 'description', 'systemData', 'collectionProvisioningState']) From d082344cb46416e61b9ed3150ee17af254c12bdd Mon Sep 17 00:00:00 2001 From: msyyc <70930885+msyyc@users.noreply.github.com> Date: Tue, 24 Aug 2021 11:14:37 +0800 Subject: [PATCH 8/8] update reamdme --- sdk/purview/azure-purview-account/README.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sdk/purview/azure-purview-account/README.md b/sdk/purview/azure-purview-account/README.md index 071b5796ff07..9e768852a853 100644 --- a/sdk/purview/azure-purview-account/README.md +++ b/sdk/purview/azure-purview-account/README.md @@ -55,16 +55,13 @@ client = PurviewAccountClient(endpoint="https://.purview.azure. ### Client -This package offers request builders so you can build http requests and send these requests to the service using the `send_request` method. -For more information on how to use request builders and our clients, see [here][request_builders_and_client]. - ## Examples The following section shows you how to initialize and authenticate your client, then list all of your keys. -- [List All Keys](#list-all-keys "List All Keys") +- [Get Keys](#get-keys "Get All Keys") -### List All Keys +### Get Keys ```python from azure.purview.account import PurviewAccountClient @@ -80,7 +77,7 @@ print(response) ### General -The Purview Account client will raise exceptions defined in [Azure Core][azure_core] if you call `.raise_for_status()` on your responses. +The Purview Account client will raise exceptions if status code of your responses is not defined. ### Logging @@ -113,7 +110,7 @@ credential = DefaultAzureCredential() client = PurviewAccountClient(endpoint=endpoint, credential=credential, logging_enable=True) ``` -Similarly, `logging_enable` can enable detailed logging for a single `send_request` call, +Similarly, `logging_enable` can enable detailed logging for a single call, even when it isn't enabled for the client: ```python