From 6b7ca857612279454bf3b31f766c8a55bfe6a869 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 7 May 2025 03:22:17 +0000 Subject: [PATCH] CodeGen from PR 34326 in Azure/azure-rest-api-specs Merge ee2b24e2c8ac1a17839a3cf679644a3ad5cfd762 into a3baecd6571d7e4b979a7aef527d29a3509d4dc7 --- .../azure-mgmt-servicelinker/CHANGELOG.md | 74 + .../azure-mgmt-servicelinker/README.md | 6 +- .../azure-mgmt-servicelinker/_meta.json | 6 +- .../azure/mgmt/servicelinker/__init__.py | 12 +- .../mgmt/servicelinker/_configuration.py | 8 +- .../_service_linker_management_client.py | 39 +- .../mgmt/servicelinker/_utils/__init__.py | 6 + .../serialization.py} | 566 ++++--- .../azure/mgmt/servicelinker/_version.py | 2 +- .../azure/mgmt/servicelinker/aio/__init__.py | 12 +- .../mgmt/servicelinker/aio/_configuration.py | 8 +- .../aio/_service_linker_management_client.py | 41 +- .../servicelinker/aio/operations/__init__.py | 24 +- .../_configuration_names_operations.py | 24 +- .../aio/operations/_connector_operations.py | 1349 ++++++++------- .../aio/operations/_linker_operations.py | 527 +++--- .../aio/operations/_linkers_operations.py | 173 +- .../aio/operations/_operations.py | 26 +- .../mgmt/servicelinker/models/__init__.py | 185 ++- .../mgmt/servicelinker/models/_models_py3.py | 439 +++-- ..._service_linker_management_client_enums.py | 2 - .../mgmt/servicelinker/operations/__init__.py | 24 +- .../_configuration_names_operations.py | 25 +- .../operations/_connector_operations.py | 1472 ++++++++--------- .../operations/_linker_operations.py | 613 ++++--- .../operations/_linkers_operations.py | 243 ++- .../servicelinker/operations/_operations.py | 27 +- .../configuration_names_list.py | 2 + .../connector_dryrun_create.py | 3 +- .../connector_dryrun_delete.py | 3 +- .../generated_samples/connector_dryrun_get.py | 3 +- .../connector_dryrun_list.py | 3 +- .../connector_dryrun_update.py | 3 +- .../generated_samples/connector_list.py | 3 +- .../generated_samples/connectors.py | 3 +- .../generated_samples/delete_connector.py | 3 +- .../generated_samples/delete_dryrun.py | 40 - .../generated_samples/delete_linker.py | 40 - .../generate_configurations.py | 3 +- .../generated_samples/get_configurations.py | 41 - .../get_dapr_configurations.py | 2 + .../generated_samples/get_dryrun.py | 41 - .../generated_samples/linker.py | 41 - .../linker_generate_configurations.py | 41 - .../generated_samples/linker_list.py | 41 - .../generated_samples/list_dryrun.py | 41 - .../generated_samples/operations_list.py | 2 + .../generated_samples/patch_connector.py | 3 +- .../generated_samples/patch_dryrun.py | 57 - .../generated_samples/patch_linker.py | 55 - .../generated_samples/put_connector.py | 3 +- .../generated_samples/put_dryrun.py | 57 - .../generated_samples/put_linker.py | 55 - .../validate_connector_success.py | 3 +- .../validate_linker_success.py | 41 - .../generated_tests/conftest.py | 2 +- ...nagement_configuration_names_operations.py | 2 +- ...nt_configuration_names_operations_async.py | 2 +- ..._linker_management_connector_operations.py | 234 ++- ...r_management_connector_operations_async.py | 246 ++- ...ice_linker_management_linker_operations.py | 55 +- ...nker_management_linker_operations_async.py | 133 +- ...ce_linker_management_linkers_operations.py | 25 +- ...ker_management_linkers_operations_async.py | 25 +- ...st_service_linker_management_operations.py | 2 +- ...vice_linker_management_operations_async.py | 2 +- .../azure-mgmt-servicelinker/setup.py | 5 +- 67 files changed, 3602 insertions(+), 3697 deletions(-) create mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_utils/__init__.py rename sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/{_serialization.py => _utils/serialization.py} (83%) delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_dryrun.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_linker.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_configurations.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dryrun.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_generate_configurations.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_list.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/list_dryrun.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_dryrun.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_linker.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_dryrun.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_linker.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_linker_success.py diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/CHANGELOG.md b/sdk/servicelinker/azure-mgmt-servicelinker/CHANGELOG.md index f26f2a2ee1b0..8510ad34b294 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/CHANGELOG.md +++ b/sdk/servicelinker/azure-mgmt-servicelinker/CHANGELOG.md @@ -1,5 +1,79 @@ # Release History +## 1.2.0b4 (2025-05-07) + +### Features Added + + - Added model `AzureResourceManagerArmResponseDryrunResource` + - Added model `AzureResourceManagerArmResponseValidateOperationResult` + - Method `ConnectorOperations.begin_create_dryrun` has a new overload `def begin_create_dryrun(self: None, resource_group_name: str, location: str, dryrun_name: str, parameters: DryrunResource, content_type: str)` + - Method `ConnectorOperations.begin_create_dryrun` has a new overload `def begin_create_dryrun(self: None, resource_group_name: str, location: str, dryrun_name: str, parameters: IO[bytes], content_type: str)` + - Method `ConnectorOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, location: str, connector_name: str, parameters: LinkerResource, content_type: str)` + - Method `ConnectorOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, location: str, connector_name: str, parameters: IO[bytes], content_type: str)` + - Method `ConnectorOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, location: str, connector_name: str, parameters: LinkerPatch, content_type: str)` + - Method `ConnectorOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, location: str, connector_name: str, parameters: IO[bytes], content_type: str)` + - Method `ConnectorOperations.begin_update_dryrun` has a new overload `def begin_update_dryrun(self: None, resource_group_name: str, location: str, dryrun_name: str, parameters: DryrunPatch, content_type: str)` + - Method `ConnectorOperations.begin_update_dryrun` has a new overload `def begin_update_dryrun(self: None, resource_group_name: str, location: str, dryrun_name: str, parameters: IO[bytes], content_type: str)` + - Method `ConnectorOperations.generate_configurations` has a new overload `def generate_configurations(self: None, resource_group_name: str, location: str, connector_name: str, parameters: Optional[ConfigurationInfo], content_type: str)` + - Method `ConnectorOperations.generate_configurations` has a new overload `def generate_configurations(self: None, resource_group_name: str, location: str, connector_name: str, parameters: Optional[IO[bytes]], content_type: str)` + - Method `LinkerOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, providers: str, linkers: str, resource_uri: str, linker_name: str, parameters: LinkerResource, content_type: str)` + - Method `LinkerOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, providers: str, linkers: str, resource_uri: str, linker_name: str, parameters: IO[bytes], content_type: str)` + - Method `LinkerOperations.update` has a new overload `def update(self: None, providers: str, linkers: str, resource_uri: str, linker_name: str, parameters: LinkerPatch, content_type: str)` + - Method `LinkerOperations.update` has a new overload `def update(self: None, providers: str, linkers: str, resource_uri: str, linker_name: str, parameters: IO[bytes], content_type: str)` + - Method `LinkersOperations.begin_create_dryrun` has a new overload `def begin_create_dryrun(self: None, providers: str, dryruns: str, resource_uri: str, dryrun_name: str, parameters: DryrunResource, content_type: str)` + - Method `LinkersOperations.begin_create_dryrun` has a new overload `def begin_create_dryrun(self: None, providers: str, dryruns: str, resource_uri: str, dryrun_name: str, parameters: IO[bytes], content_type: str)` + - Method `LinkersOperations.begin_update_dryrun` has a new overload `def begin_update_dryrun(self: None, providers: str, dryruns: str, resource_uri: str, dryrun_name: str, parameters: DryrunPatch, content_type: str)` + - Method `LinkersOperations.begin_update_dryrun` has a new overload `def begin_update_dryrun(self: None, providers: str, dryruns: str, resource_uri: str, dryrun_name: str, parameters: IO[bytes], content_type: str)` + - Method `LinkersOperations.generate_configurations` has a new overload `def generate_configurations(self: None, providers: str, linkers: str, resource_uri: str, linker_name: str, parameters: Optional[ConfigurationInfo], content_type: str)` + - Method `LinkersOperations.generate_configurations` has a new overload `def generate_configurations(self: None, providers: str, linkers: str, resource_uri: str, linker_name: str, parameters: Optional[IO[bytes]], content_type: str)` + +### Breaking Changes + + - Method `ServiceLinkerManagementClient.__init__` inserted a `positional_or_keyword` parameter `subscription_id` + - Deleted or renamed enum value `ActionType.ENABLE` + - Deleted or renamed enum value `ActionType.OPT_OUT` + - Method `ConfigurationNameResult.__init__` removed default value `None` from its parameter `value` + - Method `DaprConfigurationList.__init__` removed default value `None` from its parameter `value` + - Method `DryrunList.__init__` removed default value `None` from its parameter `value` + - Method `ResourceList.__init__` removed default value `None` from its parameter `value` + - Deleted or renamed model `DatabaseAadAuthInfo` + - Deleted or renamed model `LinkerProperties` + - Method `ConnectorOperations.begin_create_dryrun` deleted or renamed its parameter `subscription_id` of kind `positional_or_keyword` + - Method `ConnectorOperations.begin_create_or_update` deleted or renamed its parameter `subscription_id` of kind `positional_or_keyword` + - Method `ConnectorOperations.begin_delete` deleted or renamed its parameter `subscription_id` of kind `positional_or_keyword` + - Method `ConnectorOperations.begin_update` deleted or renamed its parameter `subscription_id` of kind `positional_or_keyword` + - Method `ConnectorOperations.begin_update_dryrun` deleted or renamed its parameter `subscription_id` of kind `positional_or_keyword` + - Method `ConnectorOperations.begin_validate` deleted or renamed its parameter `subscription_id` of kind `positional_or_keyword` + - Method `ConnectorOperations.delete_dryrun` deleted or renamed its parameter `subscription_id` of kind `positional_or_keyword` + - Method `ConnectorOperations.generate_configurations` deleted or renamed its parameter `subscription_id` of kind `positional_or_keyword` + - Method `ConnectorOperations.get` deleted or renamed its parameter `subscription_id` of kind `positional_or_keyword` + - Method `ConnectorOperations.get_dryrun` deleted or renamed its parameter `subscription_id` of kind `positional_or_keyword` + - Method `ConnectorOperations.list` deleted or renamed its parameter `subscription_id` of kind `positional_or_keyword` + - Method `ConnectorOperations.list_dryrun` deleted or renamed its parameter `subscription_id` of kind `positional_or_keyword` + - Method `LinkerOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `providers` + - Method `LinkerOperations.begin_create_or_update` inserted a `positional_or_keyword` parameter `linkers` + - Method `LinkerOperations.begin_delete` inserted a `positional_or_keyword` parameter `providers` + - Method `LinkerOperations.begin_delete` inserted a `positional_or_keyword` parameter `linkers` + - Method `LinkerOperations.begin_validate` inserted a `positional_or_keyword` parameter `providers` + - Method `LinkerOperations.begin_validate` inserted a `positional_or_keyword` parameter `linkers` + - Method `LinkerOperations.get` inserted a `positional_or_keyword` parameter `providers` + - Method `LinkerOperations.get` inserted a `positional_or_keyword` parameter `linkers` + - Method `LinkerOperations.list` inserted a `positional_or_keyword` parameter `providers` + - Method `LinkerOperations.list_configurations` inserted a `positional_or_keyword` parameter `providers` + - Method `LinkerOperations.list_configurations` inserted a `positional_or_keyword` parameter `linkers` + - Deleted or renamed method `LinkerOperations.begin_update` + - Method `LinkersOperations.begin_create_dryrun` inserted a `positional_or_keyword` parameter `providers` + - Method `LinkersOperations.begin_create_dryrun` inserted a `positional_or_keyword` parameter `dryruns` + - Method `LinkersOperations.begin_update_dryrun` inserted a `positional_or_keyword` parameter `providers` + - Method `LinkersOperations.begin_update_dryrun` inserted a `positional_or_keyword` parameter `dryruns` + - Method `LinkersOperations.delete_dryrun` inserted a `positional_or_keyword` parameter `providers` + - Method `LinkersOperations.delete_dryrun` inserted a `positional_or_keyword` parameter `dryruns` + - Method `LinkersOperations.generate_configurations` inserted a `positional_or_keyword` parameter `providers` + - Method `LinkersOperations.generate_configurations` inserted a `positional_or_keyword` parameter `linkers` + - Method `LinkersOperations.get_dryrun` inserted a `positional_or_keyword` parameter `providers` + - Method `LinkersOperations.get_dryrun` inserted a `positional_or_keyword` parameter `dryruns` + - Method `LinkersOperations.list_dryrun` inserted a `positional_or_keyword` parameter `providers` + ## 1.2.0b3 (2024-10-11) ### Features Added diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/README.md b/sdk/servicelinker/azure-mgmt-servicelinker/README.md index 28f6786aca1e..b795c315bf1f 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/README.md +++ b/sdk/servicelinker/azure-mgmt-servicelinker/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Service Linker Management Client Library. -This package has been tested with Python 3.8+. +This package has been tested with Python 3.9+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.8+ is required to use this package. +- Python 3.9+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json b/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json index 8d57bb5d90ad..d9f3c231d5ee 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json +++ b/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json @@ -1,11 +1,11 @@ { - "commit": "b61dcef24c4dbd9d1c26e321c9ea67465a5d8be7", + "commit": "1a9d4913c5d23f8fc0090e2568fdd71ce023f485", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.19.0", + "@autorest/python@6.34.1", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/servicelinker/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/servicelinker/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.34.1 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/servicelinker/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/__init__.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/__init__.py index b9e4ff815ed6..64cf09e24989 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/__init__.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._service_linker_management_client import ServiceLinkerManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._service_linker_management_client import ServiceLinkerManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "ServiceLinkerManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py index db59389ef848..41d1a4fcb65d 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py @@ -14,7 +14,6 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -26,18 +25,23 @@ class ServiceLinkerManagementClientConfiguration: # pylint: disable=too-many-in :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. Required. + :type subscription_id: str :keyword api_version: Api Version. Default value is "2024-07-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: api_version: str = kwargs.pop("api_version", "2024-07-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") self.credential = credential + self.subscription_id = subscription_id self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-servicelinker/{}".format(VERSION)) diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_service_linker_management_client.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_service_linker_management_client.py index 232da33028f5..1d55f9eca3c3 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_service_linker_management_client.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_service_linker_management_client.py @@ -7,17 +7,19 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from ._configuration import ServiceLinkerManagementClientConfiguration -from ._serialization import Deserializer, Serializer +from ._utils.serialization import Deserializer, Serializer from .operations import ( ConfigurationNamesOperations, ConnectorOperations, @@ -27,26 +29,27 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ServiceLinkerManagementClient: # pylint: disable=client-accepts-api-version-keyword +class ServiceLinkerManagementClient: """Microsoft.ServiceLinker provider. - :ivar connector: ConnectorOperations operations - :vartype connector: azure.mgmt.servicelinker.operations.ConnectorOperations :ivar linker: LinkerOperations operations :vartype linker: azure.mgmt.servicelinker.operations.LinkerOperations :ivar linkers: LinkersOperations operations :vartype linkers: azure.mgmt.servicelinker.operations.LinkersOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.servicelinker.operations.Operations :ivar configuration_names: ConfigurationNamesOperations operations :vartype configuration_names: azure.mgmt.servicelinker.operations.ConfigurationNamesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicelinker.operations.Operations + :ivar connector: ConnectorOperations operations + :vartype connector: azure.mgmt.servicelinker.operations.ConnectorOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param base_url: Service URL. Default value is "https://management.azure.com". + :param subscription_id: The ID of the target subscription. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2024-07-01-preview". Note that overriding this default value may result in unsupported behavior. @@ -56,9 +59,17 @@ class ServiceLinkerManagementClient: # pylint: disable=client-accepts-api-versi """ def __init__( - self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = ServiceLinkerManagementClientConfiguration(credential=credential, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ServiceLinkerManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -77,19 +88,19 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.connector = ConnectorOperations(self._client, self._config, self._serialize, self._deserialize) self.linker = LinkerOperations(self._client, self._config, self._serialize, self._deserialize) self.linkers = LinkersOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.configuration_names = ConfigurationNamesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.connector = ConnectorOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_utils/__init__.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_utils/__init__.py new file mode 100644 index 000000000000..0af9b28f6607 --- /dev/null +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_utils/__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. +# -------------------------------------------------------------------------- diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_serialization.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_utils/serialization.py similarity index 83% rename from sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_serialization.py rename to sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_utils/serialization.py index 8139854b97bb..f5187701d7be 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_serialization.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_utils/serialization.py @@ -1,30 +1,12 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# 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. # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -48,11 +30,8 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, - Mapping, ) try: @@ -62,13 +41,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -91,6 +70,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +93,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -155,6 +136,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -179,80 +165,31 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0.""" - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation.""" - return "Z" - - def dst(self, dt): - """No daylight saving for UTC.""" - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset): - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? None: self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -300,13 +244,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -326,7 +280,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -346,7 +304,9 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, @@ -380,12 +340,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -395,30 +358,31 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @classmethod - def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -426,9 +390,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -448,21 +414,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -501,11 +471,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -540,7 +512,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -560,13 +532,16 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -592,12 +567,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": @@ -633,7 +610,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -664,17 +642,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -703,7 +681,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -712,11 +690,13 @@ def body(self, data, data_type, **kwargs): def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -728,21 +708,20 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator @@ -759,19 +738,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -780,21 +760,20 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -805,7 +784,7 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -821,11 +800,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -841,23 +819,26 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + return eval(data_type)(data) # nosec # pylint: disable=eval-used @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -871,8 +852,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -882,15 +862,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -945,9 +923,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -971,7 +948,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -979,6 +956,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1003,7 +981,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1034,56 +1012,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1091,11 +1074,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1105,30 +1089,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1141,12 +1127,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1172,13 +1159,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1186,11 +1174,11 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data @@ -1211,7 +1199,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1232,17 +1222,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1279,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1331,22 +1333,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1354,7 +1355,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1363,9 +1364,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1401,27 +1402,29 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1440,13 +1443,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1476,9 +1479,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1505,6 +1507,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1516,7 +1520,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1531,10 +1535,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1552,10 +1558,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1579,24 +1587,35 @@ def _unpack_content(raw_data, content_type=None): def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1605,15 +1624,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1627,7 +1647,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1647,14 +1671,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1671,6 +1695,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1681,13 +1706,14 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1720,11 +1746,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1732,8 +1757,9 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1743,24 +1769,23 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1768,6 +1793,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1781,8 +1807,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1794,6 +1819,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1804,9 +1830,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1822,8 +1848,9 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1834,8 +1861,9 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1849,8 +1877,9 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal - :raises: DeserializationError if string format invalid. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1865,8 +1894,9 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1877,8 +1907,9 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1887,16 +1918,16 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1910,8 +1941,9 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1924,31 +1956,32 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1976,8 +2009,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1985,8 +2017,9 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore @@ -1996,5 +2029,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_version.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_version.py index 5d2aea489e57..c201a4d93923 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_version.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.2.0b3" +VERSION = "1.2.0b4" diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/__init__.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/__init__.py index aece02f5d17a..e25bb7dfa4e6 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/__init__.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._service_linker_management_client import ServiceLinkerManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._service_linker_management_client import ServiceLinkerManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "ServiceLinkerManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_configuration.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_configuration.py index aa280a9e587a..72cb3b4affa5 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_configuration.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_configuration.py @@ -14,7 +14,6 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -26,18 +25,23 @@ class ServiceLinkerManagementClientConfiguration: # pylint: disable=too-many-in :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. Required. + :type subscription_id: str :keyword api_version: Api Version. Default value is "2024-07-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: api_version: str = kwargs.pop("api_version", "2024-07-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") self.credential = credential + self.subscription_id = subscription_id self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-servicelinker/{}".format(VERSION)) diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_service_linker_management_client.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_service_linker_management_client.py index f9c1d875e594..0e9e5cef00ab 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_service_linker_management_client.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_service_linker_management_client.py @@ -7,16 +7,18 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models -from .._serialization import Deserializer, Serializer +from .._utils.serialization import Deserializer, Serializer from ._configuration import ServiceLinkerManagementClientConfiguration from .operations import ( ConfigurationNamesOperations, @@ -27,27 +29,28 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ServiceLinkerManagementClient: # pylint: disable=client-accepts-api-version-keyword +class ServiceLinkerManagementClient: """Microsoft.ServiceLinker provider. - :ivar connector: ConnectorOperations operations - :vartype connector: azure.mgmt.servicelinker.aio.operations.ConnectorOperations :ivar linker: LinkerOperations operations :vartype linker: azure.mgmt.servicelinker.aio.operations.LinkerOperations :ivar linkers: LinkersOperations operations :vartype linkers: azure.mgmt.servicelinker.aio.operations.LinkersOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.servicelinker.aio.operations.Operations :ivar configuration_names: ConfigurationNamesOperations operations :vartype configuration_names: azure.mgmt.servicelinker.aio.operations.ConfigurationNamesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicelinker.aio.operations.Operations + :ivar connector: ConnectorOperations operations + :vartype connector: azure.mgmt.servicelinker.aio.operations.ConnectorOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param base_url: Service URL. Default value is "https://management.azure.com". + :param subscription_id: The ID of the target subscription. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2024-07-01-preview". Note that overriding this default value may result in unsupported behavior. @@ -57,9 +60,17 @@ class ServiceLinkerManagementClient: # pylint: disable=client-accepts-api-versi """ def __init__( - self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = ServiceLinkerManagementClientConfiguration(credential=credential, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ServiceLinkerManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -78,19 +89,21 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.connector = ConnectorOperations(self._client, self._config, self._serialize, self._deserialize) self.linker = LinkerOperations(self._client, self._config, self._serialize, self._deserialize) self.linkers = LinkersOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.configuration_names = ConfigurationNamesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.connector = ConnectorOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/__init__.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/__init__.py index 80d740a2329c..c29af27f3423 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/__init__.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/__init__.py @@ -5,23 +5,29 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._connector_operations import ConnectorOperations -from ._linker_operations import LinkerOperations -from ._linkers_operations import LinkersOperations -from ._operations import Operations -from ._configuration_names_operations import ConfigurationNamesOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._linker_operations import LinkerOperations # type: ignore +from ._linkers_operations import LinkersOperations # type: ignore +from ._configuration_names_operations import ConfigurationNamesOperations # type: ignore +from ._operations import Operations # type: ignore +from ._connector_operations import ConnectorOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ConnectorOperations", "LinkerOperations", "LinkersOperations", - "Operations", "ConfigurationNamesOperations", + "Operations", + "ConnectorOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_configuration_names_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_configuration_names_operations.py index 2ed1bd8c73a1..69b36ac99fbb 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_configuration_names_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_configuration_names_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,12 +26,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._configuration_names_operations import build_list_request +from .._configuration import ServiceLinkerManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -50,10 +48,12 @@ class ConfigurationNamesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ServiceLinkerManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -78,7 +78,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConfigurationNameResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_connector_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_connector_operations.py index 51fb25b41058..4a901b9cd088 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_connector_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_connector_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._connector_operations import ( build_create_dryrun_request, build_create_or_update_request, @@ -46,11 +48,8 @@ build_update_request, build_validate_request, ) +from .._configuration import ServiceLinkerManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,36 +68,35 @@ class ConnectorOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ServiceLinkerManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_dryrun( - self, subscription_id: str, resource_group_name: str, location: str, **kwargs: Any - ) -> AsyncIterable["_models.DryrunResource"]: - """list dryrun jobs. + def list(self, resource_group_name: str, location: str, **kwargs: Any) -> AsyncIterable["_models.LinkerResource"]: + """Returns list of connector which connects to the resource, which supports to config the target + service during the resource provision. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :return: An iterator like instance of either DryrunResource or the result of cls(response) + :return: An iterator like instance of either LinkerResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.DryrunResource] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.LinkerResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DryrunList] = kwargs.pop("cls", None) + cls: ClsType[_models.ResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,10 +107,10 @@ def list_dryrun( def prepare_request(next_link=None): if not next_link: - _request = build_list_dryrun_request( - subscription_id=subscription_id, + _request = build_list_request( resource_group_name=resource_group_name, location=location, + subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, params=_params, @@ -137,7 +135,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("DryrunList", pipeline_response) + deserialized = self._deserialize("ResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -162,25 +160,23 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def get_dryrun( - self, subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any - ) -> _models.DryrunResource: - """get a dryrun job. + async def get( + self, resource_group_name: str, location: str, connector_name: str, **kwargs: Any + ) -> _models.LinkerResource: + """Returns Connector resource for a given name. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :return: DryrunResource or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.DryrunResource + :param connector_name: The name of the LinkerResource. Required. + :type connector_name: str + :return: LinkerResource or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.LinkerResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -192,13 +188,13 @@ async def get_dryrun( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) + cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - _request = build_get_dryrun_request( - subscription_id=subscription_id, + _request = build_get_request( resource_group_name=resource_group_name, location=location, - dryrun_name=dryrun_name, + connector_name=connector_name, + subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, params=_params, @@ -217,23 +213,22 @@ async def get_dryrun( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DryrunResource", pipeline_response.http_response) + deserialized = self._deserialize("LinkerResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_dryrun_initial( + async def _create_or_update_initial( self, - subscription_id: str, resource_group_name: str, location: str, - dryrun_name: str, - parameters: Union[_models.DryrunResource, IO[bytes]], + connector_name: str, + parameters: Union[_models.LinkerResource, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,13 +249,13 @@ async def _create_dryrun_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "DryrunResource") + _json = self._serialize.body(parameters, "LinkerResource") - _request = build_create_dryrun_request( - subscription_id=subscription_id, + _request = build_create_or_update_request( resource_group_name=resource_group_name, location=location, - dryrun_name=dryrun_name, + connector_name=connector_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, @@ -287,108 +282,106 @@ async def _create_dryrun_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_create_dryrun( + async def begin_create_or_update( self, - subscription_id: str, resource_group_name: str, location: str, - dryrun_name: str, - parameters: _models.DryrunResource, + connector_name: str, + parameters: _models.LinkerResource, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. + ) -> AsyncLROPoller[_models.LinkerResource]: + """Create or update Connector resource. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource + :param connector_name: The name of the LinkerResource. Required. + :type connector_name: str + :param parameters: Connector details. Required. + :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of + :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_dryrun( + async def begin_create_or_update( self, - subscription_id: str, resource_group_name: str, location: str, - dryrun_name: str, + connector_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. + ) -> AsyncLROPoller[_models.LinkerResource]: + """Create or update Connector resource. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. + :param connector_name: The name of the LinkerResource. Required. + :type connector_name: str + :param parameters: Connector details. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of + :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_dryrun( + async def begin_create_or_update( self, - subscription_id: str, resource_group_name: str, location: str, - dryrun_name: str, - parameters: Union[_models.DryrunResource, IO[bytes]], + connector_name: str, + parameters: Union[_models.LinkerResource, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. + ) -> AsyncLROPoller[_models.LinkerResource]: + """Create or update Connector resource. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Is either a DryrunResource type or a IO[bytes] type. + :param connector_name: The name of the LinkerResource. Required. + :type connector_name: str + :param parameters: Connector details. Is either a LinkerResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of + :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -396,16 +389,15 @@ async def begin_create_dryrun( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) + cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_dryrun_initial( - subscription_id=subscription_id, + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, location=location, - dryrun_name=dryrun_name, + connector_name=connector_name, parameters=parameters, api_version=api_version, content_type=content_type, @@ -418,7 +410,7 @@ async def begin_create_dryrun( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DryrunResource", pipeline_response.http_response) + deserialized = self._deserialize("LinkerResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -433,26 +425,25 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.DryrunResource].from_continuation_token( + return AsyncLROPoller[_models.LinkerResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.DryrunResource]( + return AsyncLROPoller[_models.LinkerResource]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _update_dryrun_initial( + async def _update_initial( self, - subscription_id: str, resource_group_name: str, location: str, - dryrun_name: str, - parameters: Union[_models.DryrunPatch, IO[bytes]], + connector_name: str, + parameters: Union[_models.LinkerPatch, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -473,13 +464,13 @@ async def _update_dryrun_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "DryrunPatch") + _json = self._serialize.body(parameters, "LinkerPatch") - _request = build_update_dryrun_request( - subscription_id=subscription_id, + _request = build_update_request( resource_group_name=resource_group_name, location=location, - dryrun_name=dryrun_name, + connector_name=connector_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, @@ -506,107 +497,105 @@ async def _update_dryrun_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_update_dryrun( + async def begin_update( self, - subscription_id: str, resource_group_name: str, location: str, - dryrun_name: str, - parameters: _models.DryrunPatch, + connector_name: str, + parameters: _models.LinkerPatch, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """update a dryrun job to do necessary check before actual creation. + ) -> AsyncLROPoller[_models.LinkerResource]: + """Operation to update an existing Connector. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch + :param connector_name: The name of the LinkerResource. Required. + :type connector_name: str + :param parameters: Connector details. Required. + :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of + :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_dryrun( + async def begin_update( self, - subscription_id: str, resource_group_name: str, location: str, - dryrun_name: str, + connector_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """update a dryrun job to do necessary check before actual creation. + ) -> AsyncLROPoller[_models.LinkerResource]: + """Operation to update an existing Connector. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. + :param connector_name: The name of the LinkerResource. Required. + :type connector_name: str + :param parameters: Connector details. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of + :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update_dryrun( + async def begin_update( self, - subscription_id: str, resource_group_name: str, location: str, - dryrun_name: str, - parameters: Union[_models.DryrunPatch, IO[bytes]], + connector_name: str, + parameters: Union[_models.LinkerPatch, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """update a dryrun job to do necessary check before actual creation. + ) -> AsyncLROPoller[_models.LinkerResource]: + """Operation to update an existing Connector. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Is either a DryrunPatch type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of + :param connector_name: The name of the LinkerResource. Required. + :type connector_name: str + :param parameters: Connector details. Is either a LinkerPatch type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch or IO[bytes] + :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -614,16 +603,15 @@ async def begin_update_dryrun( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) + cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_dryrun_initial( - subscription_id=subscription_id, + raw_result = await self._update_initial( resource_group_name=resource_group_name, location=location, - dryrun_name=dryrun_name, + connector_name=connector_name, parameters=parameters, api_version=api_version, content_type=content_type, @@ -636,7 +624,7 @@ async def begin_update_dryrun( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DryrunResource", pipeline_response.http_response) + deserialized = self._deserialize("LinkerResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -651,36 +639,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.DryrunResource].from_continuation_token( + return AsyncLROPoller[_models.LinkerResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.DryrunResource]( + return AsyncLROPoller[_models.LinkerResource]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace_async - async def delete_dryrun( # pylint: disable=inconsistent-return-statements - self, subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any - ) -> None: - """delete a dryrun job. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + async def _delete_initial( + self, resource_group_name: str, location: str, connector_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -692,408 +664,259 @@ async def delete_dryrun( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_delete_dryrun_request( - subscription_id=subscription_id, + _request = build_delete_request( resource_group_name=resource_group_name, location=location, - dryrun_name=dryrun_name, + connector_name=connector_name, + subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore - @distributed_trace - def list( - self, subscription_id: str, resource_group_name: str, location: str, **kwargs: Any - ) -> AsyncIterable["_models.LinkerResource"]: - """Returns list of connector which connects to the resource, which supports to config the target - service during the resource provision. + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, location: str, connector_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Connector. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :return: An iterator like instance of either LinkerResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.LinkerResource] + :param connector_name: The name of the LinkerResource. Required. + :type connector_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + location=location, + connector_name=connector_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceList", pipeline_response) - list_of_elem = deserialized.value + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) + return cls(pipeline_response, None, {}) # type: ignore - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> _models.LinkerResource: - """Returns Connector resource for a given name. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :return: LinkerResource or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.LinkerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LinkerResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Union[_models.LinkerResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: - _json = self._serialize.body(parameters, "LinkerResource") - - _request = build_create_or_update_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @overload - async def begin_create_or_update( + async def generate_configurations( self, - subscription_id: str, resource_group_name: str, location: str, connector_name: str, - parameters: _models.LinkerResource, + parameters: Optional[_models.ConfigurationInfo] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Create or update Connector resource. + ) -> _models.ConfigurationResult: + """Generate configurations for a Connector. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param connector_name: The name of resource. Required. + :param connector_name: The name of the LinkerResource. Required. :type connector_name: str - :param parameters: Connector details. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource + :param parameters: Connection Info, including format, secret store, etc. Default value is None. + :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] + :return: ConfigurationResult or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def generate_configurations( self, - subscription_id: str, resource_group_name: str, location: str, connector_name: str, - parameters: IO[bytes], + parameters: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Create or update Connector resource. + ) -> _models.ConfigurationResult: + """Generate configurations for a Connector. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param connector_name: The name of resource. Required. + :param connector_name: The name of the LinkerResource. Required. :type connector_name: str - :param parameters: Connector details. Required. + :param parameters: Connection Info, including format, secret store, etc. Default value is None. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] + :return: ConfigurationResult or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_or_update( + async def generate_configurations( self, - subscription_id: str, resource_group_name: str, location: str, connector_name: str, - parameters: Union[_models.LinkerResource, IO[bytes]], + parameters: Optional[Union[_models.ConfigurationInfo, IO[bytes]]] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Create or update Connector resource. + ) -> _models.ConfigurationResult: + """Generate configurations for a Connector. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param connector_name: The name of resource. Required. + :param connector_name: The name of the LinkerResource. Required. :type connector_name: str - :param parameters: Connector details. Is either a LinkerResource type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] + :param parameters: Connection Info, including format, secret store, etc. Is either a + ConfigurationInfo type or a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo or IO[bytes] + :return: ConfigurationResult or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LinkerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + cls: ClsType[_models.ConfigurationResult] = kwargs.pop("cls", None) - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.LinkerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.LinkerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + if parameters is not None: + _json = self._serialize.body(parameters, "ConfigurationInfo") + else: + _json = None + + _request = build_generate_configurations_request( + resource_group_name=resource_group_name, + location=location, + connector_name=connector_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - async def _delete_initial( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any + deserialized = self._deserialize("ConfigurationResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _validate_initial( + self, resource_group_name: str, location: str, connector_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1107,11 +930,11 @@ async def _delete_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_delete_request( - subscription_id=subscription_id, + _request = build_validate_request( resource_group_name=resource_group_name, location=location, connector_name=connector_name, + subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, params=_params, @@ -1126,7 +949,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -1135,43 +958,47 @@ async def _delete_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def begin_delete( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a Connector. + async def begin_validate( + self, resource_group_name: str, location: str, connector_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ValidateOperationResult]: + """Validate a Connector. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param connector_name: The name of resource. Required. + :param connector_name: The name of the LinkerResource. Required. :type connector_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns either ValidateOperationResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.ValidateOperationResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.ValidateOperationResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( - subscription_id=subscription_id, + raw_result = await self._validate_initial( resource_group_name=resource_group_name, location=location, connector_name=connector_name, @@ -1184,38 +1011,186 @@ async def begin_delete( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ValidateOperationResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.ValidateOperationResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.ValidateOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _update_initial( + @distributed_trace + def list_dryrun( + self, resource_group_name: str, location: str, **kwargs: Any + ) -> AsyncIterable["_models.DryrunResource"]: + """list dryrun jobs. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of Azure region. Required. + :type location: str + :return: An iterator like instance of either DryrunResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.DryrunResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DryrunList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_dryrun_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DryrunList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_dryrun( + self, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any + ) -> _models.DryrunResource: + """get a dryrun job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of Azure region. Required. + :type location: str + :param dryrun_name: The name of the DryrunResource. Required. + :type dryrun_name: str + :return: DryrunResource or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.DryrunResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) + + _request = build_get_dryrun_request( + resource_group_name=resource_group_name, + location=location, + dryrun_name=dryrun_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DryrunResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_dryrun_initial( self, - subscription_id: str, resource_group_name: str, location: str, - connector_name: str, - parameters: Union[_models.LinkerPatch, IO[bytes]], + dryrun_name: str, + parameters: Union[_models.DryrunResource, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1236,13 +1211,13 @@ async def _update_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "LinkerPatch") + _json = self._serialize.body(parameters, "DryrunResource") - _request = build_update_request( - subscription_id=subscription_id, + _request = build_create_dryrun_request( resource_group_name=resource_group_name, location=location, - connector_name=connector_name, + dryrun_name=dryrun_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, @@ -1260,7 +1235,7 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -1269,108 +1244,106 @@ async def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_update( + async def begin_create_dryrun( self, - subscription_id: str, resource_group_name: str, location: str, - connector_name: str, - parameters: _models.LinkerPatch, + dryrun_name: str, + parameters: _models.DryrunResource, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Operation to update an existing Connector. + ) -> AsyncLROPoller[_models.DryrunResource]: + """create a dryrun job to do necessary check before actual creation. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch + :param dryrun_name: The name of the DryrunResource. Required. + :type dryrun_name: str + :param parameters: dryrun resource. Required. + :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of + :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def begin_create_dryrun( self, - subscription_id: str, resource_group_name: str, location: str, - connector_name: str, + dryrun_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Operation to update an existing Connector. + ) -> AsyncLROPoller[_models.DryrunResource]: + """create a dryrun job to do necessary check before actual creation. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Required. + :param dryrun_name: The name of the DryrunResource. Required. + :type dryrun_name: str + :param parameters: dryrun resource. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of + :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update( + async def begin_create_dryrun( self, - subscription_id: str, resource_group_name: str, location: str, - connector_name: str, - parameters: Union[_models.LinkerPatch, IO[bytes]], + dryrun_name: str, + parameters: Union[_models.DryrunResource, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Operation to update an existing Connector. + ) -> AsyncLROPoller[_models.DryrunResource]: + """create a dryrun job to do necessary check before actual creation. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Is either a LinkerPatch type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch or IO[bytes] - :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of + :param dryrun_name: The name of the DryrunResource. Required. + :type dryrun_name: str + :param parameters: dryrun resource. Is either a DryrunResource type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1378,16 +1351,15 @@ async def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) + cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( - subscription_id=subscription_id, + raw_result = await self._create_dryrun_initial( resource_group_name=resource_group_name, location=location, - connector_name=connector_name, + dryrun_name=dryrun_name, parameters=parameters, api_version=api_version, content_type=content_type, @@ -1400,7 +1372,7 @@ async def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LinkerResource", pipeline_response.http_response) + deserialized = self._deserialize("DryrunResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1415,20 +1387,25 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.LinkerResource].from_continuation_token( + return AsyncLROPoller[_models.DryrunResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.LinkerResource]( + return AsyncLROPoller[_models.DryrunResource]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _validate_initial( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any + async def _update_dryrun_initial( + self, + resource_group_name: str, + location: str, + dryrun_name: str, + parameters: Union[_models.DryrunPatch, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1436,18 +1413,30 @@ async def _validate_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_validate_request( - subscription_id=subscription_id, + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "DryrunPatch") + + _request = build_update_dryrun_request( resource_group_name=resource_group_name, location=location, - connector_name=connector_name, + dryrun_name=dryrun_name, + subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -1470,49 +1459,124 @@ async def _validate_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + async def begin_update_dryrun( + self, + resource_group_name: str, + location: str, + dryrun_name: str, + parameters: _models.DryrunPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DryrunResource]: + """update a dryrun job to do necessary check before actual creation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of Azure region. Required. + :type location: str + :param dryrun_name: The name of the DryrunResource. Required. + :type dryrun_name: str + :param parameters: dryrun resource. Required. + :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_dryrun( + self, + resource_group_name: str, + location: str, + dryrun_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DryrunResource]: + """update a dryrun job to do necessary check before actual creation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of Azure region. Required. + :type location: str + :param dryrun_name: The name of the DryrunResource. Required. + :type dryrun_name: str + :param parameters: dryrun resource. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_validate( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ValidateOperationResult]: - """Validate a Connector. + async def begin_update_dryrun( + self, + resource_group_name: str, + location: str, + dryrun_name: str, + parameters: Union[_models.DryrunPatch, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DryrunResource]: + """update a dryrun job to do necessary check before actual creation. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :return: An instance of AsyncLROPoller that returns either ValidateOperationResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.ValidateOperationResult] + :param dryrun_name: The name of the DryrunResource. Required. + :type dryrun_name: str + :param parameters: dryrun resource. Is either a DryrunPatch type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ValidateOperationResult] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._validate_initial( - subscription_id=subscription_id, + raw_result = await self._update_dryrun_initial( resource_group_name=resource_group_name, location=location, - connector_name=connector_name, + dryrun_name=dryrun_name, + parameters=parameters, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -1522,125 +1586,47 @@ async def begin_validate( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ValidateOperationResult", pipeline_response.http_response) + deserialized = self._deserialize("DryrunResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ValidateOperationResult].from_continuation_token( + return AsyncLROPoller[_models.DryrunResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.ValidateOperationResult]( + return AsyncLROPoller[_models.DryrunResource]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @overload - async def generate_configurations( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Optional[_models.ConfigurationInfo] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def generate_configurations( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def generate_configurations( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Optional[Union[_models.ConfigurationInfo, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Connector. + async def delete_dryrun(self, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any) -> None: + """delete a dryrun job. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connection Info, including format, secret store, etc. Is either a - ConfigurationInfo type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo or IO[bytes] - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult + :param dryrun_name: The name of the DryrunResource. Required. + :type dryrun_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1648,33 +1634,18 @@ async def generate_configurations( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "ConfigurationInfo") - else: - _json = None + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_generate_configurations_request( - subscription_id=subscription_id, + _request = build_delete_dryrun_request( resource_group_name=resource_group_name, location=location, - connector_name=connector_name, + dryrun_name=dryrun_name, + subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -1687,14 +1658,10 @@ async def generate_configurations( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConfigurationResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py index 4099f256908a..505e28b53028 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +32,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._linker_operations import ( build_create_or_update_request, build_delete_request, @@ -41,11 +42,8 @@ build_update_request, build_validate_request, ) +from .._configuration import ServiceLinkerManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,16 +62,20 @@ class LinkerOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ServiceLinkerManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.LinkerResource"]: + def list(self, providers: str, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.LinkerResource"]: """Returns list of Linkers which connects to the resource. which supports to config both application and target service during the resource provision. + :param providers: {resourceUri}. Required. + :type providers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -88,7 +90,7 @@ def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.Linke api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,6 +102,7 @@ def prepare_request(next_link=None): if not next_link: _request = build_list_request( + providers=providers, resource_uri=resource_uri, api_version=api_version, headers=_headers, @@ -150,9 +153,15 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _models.LinkerResource: + async def get( + self, providers: str, linkers: str, resource_uri: str, linker_name: str, **kwargs: Any + ) -> _models.LinkerResource: """Returns Linker resource for a given name. + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -162,7 +171,7 @@ async def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _mode :rtype: ~azure.mgmt.servicelinker.models.LinkerResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -177,6 +186,8 @@ async def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _mode cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) _request = build_get_request( + providers=providers, + linkers=linkers, resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, @@ -205,9 +216,15 @@ async def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _mode return deserialized # type: ignore async def _create_or_update_initial( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerResource, IO[bytes]], **kwargs: Any + self, + providers: str, + linkers: str, + resource_uri: str, + linker_name: str, + parameters: Union[_models.LinkerResource, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,6 +248,8 @@ async def _create_or_update_initial( _json = self._serialize.body(parameters, "LinkerResource") _request = build_create_or_update_request( + providers=providers, + linkers=linkers, resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, @@ -259,16 +278,25 @@ async def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload async def begin_create_or_update( self, + providers: str, + linkers: str, resource_uri: str, linker_name: str, parameters: _models.LinkerResource, @@ -278,6 +306,10 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.LinkerResource]: """Create or update Linker resource. + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -297,6 +329,8 @@ async def begin_create_or_update( @overload async def begin_create_or_update( self, + providers: str, + linkers: str, resource_uri: str, linker_name: str, parameters: IO[bytes], @@ -306,6 +340,10 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.LinkerResource]: """Create or update Linker resource. + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -324,10 +362,20 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerResource, IO[bytes]], **kwargs: Any + self, + providers: str, + linkers: str, + resource_uri: str, + linker_name: str, + parameters: Union[_models.LinkerResource, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.LinkerResource]: """Create or update Linker resource. + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -352,6 +400,8 @@ async def begin_create_or_update( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_or_update_initial( + providers=providers, + linkers=linkers, resource_uri=resource_uri, linker_name=linker_name, parameters=parameters, @@ -391,8 +441,163 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial(self, resource_uri: str, linker_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + @overload + async def update( + self, + providers: str, + linkers: str, + resource_uri: str, + linker_name: str, + parameters: _models.LinkerPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LinkerResource: + """Operation to update an existing Linker. + + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. Required. + :type resource_uri: str + :param linker_name: The name Linker resource. Required. + :type linker_name: str + :param parameters: Linker details. Required. + :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: LinkerResource or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.LinkerResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + providers: str, + linkers: str, + resource_uri: str, + linker_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LinkerResource: + """Operation to update an existing Linker. + + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. Required. + :type resource_uri: str + :param linker_name: The name Linker resource. Required. + :type linker_name: str + :param parameters: Linker details. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: LinkerResource or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.LinkerResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + providers: str, + linkers: str, + resource_uri: str, + linker_name: str, + parameters: Union[_models.LinkerPatch, IO[bytes]], + **kwargs: Any + ) -> _models.LinkerResource: + """Operation to update an existing Linker. + + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. Required. + :type resource_uri: str + :param linker_name: The name Linker resource. Required. + :type linker_name: str + :param parameters: Linker details. Is either a LinkerPatch type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch or IO[bytes] + :return: LinkerResource or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.LinkerResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "LinkerPatch") + + _request = build_update_request( + providers=providers, + linkers=linkers, + resource_uri=resource_uri, + linker_name=linker_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("LinkerResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, providers: str, linkers: str, resource_uri: str, linker_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -407,6 +612,8 @@ async def _delete_initial(self, resource_uri: str, linker_name: str, **kwargs: A cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( + providers=providers, + linkers=linkers, resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, @@ -432,17 +639,30 @@ async def _delete_initial(self, resource_uri: str, linker_name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def begin_delete(self, resource_uri: str, linker_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete( + self, providers: str, linkers: str, resource_uri: str, linker_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Delete a Linker. + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -462,6 +682,8 @@ async def begin_delete(self, resource_uri: str, linker_name: str, **kwargs: Any) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( + providers=providers, + linkers=linkers, resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, @@ -495,10 +717,26 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _update_initial( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerPatch, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + @distributed_trace_async + async def list_configurations( + self, providers: str, linkers: str, resource_uri: str, linker_name: str, **kwargs: Any + ) -> _models.ConfigurationResult: + """list source configurations for a Linker. + + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. Required. + :type resource_uri: str + :param linker_name: The name Linker resource. Required. + :type linker_name: str + :return: ConfigurationResult or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -506,183 +744,46 @@ async def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "LinkerPatch") + cls: ClsType[_models.ConfigurationResult] = kwargs.pop("cls", None) - _request = build_update_request( + _request = build_list_configurations_request( + providers=providers, + linkers=linkers, resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("ConfigurationResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def begin_update( - self, - resource_uri: str, - linker_name: str, - parameters: _models.LinkerPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Linker details. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_uri: str, - linker_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Linker details. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerPatch, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Linker details. Is either a LinkerPatch type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch or IO[bytes] - :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_uri=resource_uri, - linker_name=linker_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LinkerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.LinkerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.LinkerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_initial(self, resource_uri: str, linker_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + async def _validate_initial( + self, providers: str, linkers: str, resource_uri: str, linker_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -697,6 +798,8 @@ async def _validate_initial(self, resource_uri: str, linker_name: str, **kwargs: cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_validate_request( + providers=providers, + linkers=linkers, resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, @@ -722,19 +825,28 @@ async def _validate_initial(self, resource_uri: str, linker_name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async async def begin_validate( - self, resource_uri: str, linker_name: str, **kwargs: Any + self, providers: str, linkers: str, resource_uri: str, linker_name: str, **kwargs: Any ) -> AsyncLROPoller[_models.ValidateOperationResult]: """Validate a Linker. + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -756,6 +868,8 @@ async def begin_validate( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._validate_initial( + providers=providers, + linkers=linkers, resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, @@ -791,60 +905,3 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller[_models.ValidateOperationResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - - @distributed_trace_async - async def list_configurations( - self, resource_uri: str, linker_name: str, **kwargs: Any - ) -> _models.ConfigurationResult: - """list source configurations for a Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ConfigurationResult] = kwargs.pop("cls", None) - - _request = build_list_configurations_request( - resource_uri=resource_uri, - linker_name=linker_name, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ConfigurationResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linkers_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linkers_operations.py index 5d0d76806cae..1a80223aca9c 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linkers_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linkers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +32,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._linkers_operations import ( build_create_dryrun_request, build_delete_dryrun_request, @@ -41,11 +42,8 @@ build_list_dryrun_request, build_update_dryrun_request, ) +from .._configuration import ServiceLinkerManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,15 +62,19 @@ class LinkersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ServiceLinkerManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_dryrun(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.DryrunResource"]: + def list_dryrun(self, providers: str, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.DryrunResource"]: """list dryrun jobs. + :param providers: {resourceUri}. Required. + :type providers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -87,7 +89,7 @@ def list_dryrun(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_model api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DryrunList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -99,6 +101,7 @@ def prepare_request(next_link=None): if not next_link: _request = build_list_dryrun_request( + providers=providers, resource_uri=resource_uri, api_version=api_version, headers=_headers, @@ -149,9 +152,15 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def get_dryrun(self, resource_uri: str, dryrun_name: str, **kwargs: Any) -> _models.DryrunResource: + async def get_dryrun( + self, providers: str, dryruns: str, resource_uri: str, dryrun_name: str, **kwargs: Any + ) -> _models.DryrunResource: """get a dryrun job. + :param providers: {resourceUri}. Required. + :type providers: str + :param dryruns: The name of the DryrunResource. Required. + :type dryruns: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -161,7 +170,7 @@ async def get_dryrun(self, resource_uri: str, dryrun_name: str, **kwargs: Any) - :rtype: ~azure.mgmt.servicelinker.models.DryrunResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -176,6 +185,8 @@ async def get_dryrun(self, resource_uri: str, dryrun_name: str, **kwargs: Any) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) _request = build_get_dryrun_request( + providers=providers, + dryruns=dryruns, resource_uri=resource_uri, dryrun_name=dryrun_name, api_version=api_version, @@ -204,9 +215,15 @@ async def get_dryrun(self, resource_uri: str, dryrun_name: str, **kwargs: Any) - return deserialized # type: ignore async def _create_dryrun_initial( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunResource, IO[bytes]], **kwargs: Any + self, + providers: str, + dryruns: str, + resource_uri: str, + dryrun_name: str, + parameters: Union[_models.DryrunResource, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -230,6 +247,8 @@ async def _create_dryrun_initial( _json = self._serialize.body(parameters, "DryrunResource") _request = build_create_dryrun_request( + providers=providers, + dryruns=dryruns, resource_uri=resource_uri, dryrun_name=dryrun_name, api_version=api_version, @@ -258,16 +277,25 @@ async def _create_dryrun_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload async def begin_create_dryrun( self, + providers: str, + dryruns: str, resource_uri: str, dryrun_name: str, parameters: _models.DryrunResource, @@ -277,6 +305,10 @@ async def begin_create_dryrun( ) -> AsyncLROPoller[_models.DryrunResource]: """create a dryrun job to do necessary check before actual creation. + :param providers: {resourceUri}. Required. + :type providers: str + :param dryruns: The name of the DryrunResource. Required. + :type dryruns: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -296,6 +328,8 @@ async def begin_create_dryrun( @overload async def begin_create_dryrun( self, + providers: str, + dryruns: str, resource_uri: str, dryrun_name: str, parameters: IO[bytes], @@ -305,6 +339,10 @@ async def begin_create_dryrun( ) -> AsyncLROPoller[_models.DryrunResource]: """create a dryrun job to do necessary check before actual creation. + :param providers: {resourceUri}. Required. + :type providers: str + :param dryruns: The name of the DryrunResource. Required. + :type dryruns: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -323,10 +361,20 @@ async def begin_create_dryrun( @distributed_trace_async async def begin_create_dryrun( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunResource, IO[bytes]], **kwargs: Any + self, + providers: str, + dryruns: str, + resource_uri: str, + dryrun_name: str, + parameters: Union[_models.DryrunResource, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.DryrunResource]: """create a dryrun job to do necessary check before actual creation. + :param providers: {resourceUri}. Required. + :type providers: str + :param dryruns: The name of the DryrunResource. Required. + :type dryruns: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -351,6 +399,8 @@ async def begin_create_dryrun( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_dryrun_initial( + providers=providers, + dryruns=dryruns, resource_uri=resource_uri, dryrun_name=dryrun_name, parameters=parameters, @@ -391,9 +441,15 @@ def get_long_running_output(pipeline_response): ) async def _update_dryrun_initial( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunPatch, IO[bytes]], **kwargs: Any + self, + providers: str, + dryruns: str, + resource_uri: str, + dryrun_name: str, + parameters: Union[_models.DryrunPatch, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -417,6 +473,8 @@ async def _update_dryrun_initial( _json = self._serialize.body(parameters, "DryrunPatch") _request = build_update_dryrun_request( + providers=providers, + dryruns=dryruns, resource_uri=resource_uri, dryrun_name=dryrun_name, api_version=api_version, @@ -445,16 +503,25 @@ async def _update_dryrun_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload async def begin_update_dryrun( self, + providers: str, + dryruns: str, resource_uri: str, dryrun_name: str, parameters: _models.DryrunPatch, @@ -464,6 +531,10 @@ async def begin_update_dryrun( ) -> AsyncLROPoller[_models.DryrunResource]: """add a dryrun job to do necessary check before actual creation. + :param providers: {resourceUri}. Required. + :type providers: str + :param dryruns: The name of the DryrunResource. Required. + :type dryruns: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -483,6 +554,8 @@ async def begin_update_dryrun( @overload async def begin_update_dryrun( self, + providers: str, + dryruns: str, resource_uri: str, dryrun_name: str, parameters: IO[bytes], @@ -492,6 +565,10 @@ async def begin_update_dryrun( ) -> AsyncLROPoller[_models.DryrunResource]: """add a dryrun job to do necessary check before actual creation. + :param providers: {resourceUri}. Required. + :type providers: str + :param dryruns: The name of the DryrunResource. Required. + :type dryruns: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -510,10 +587,20 @@ async def begin_update_dryrun( @distributed_trace_async async def begin_update_dryrun( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunPatch, IO[bytes]], **kwargs: Any + self, + providers: str, + dryruns: str, + resource_uri: str, + dryrun_name: str, + parameters: Union[_models.DryrunPatch, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.DryrunResource]: """add a dryrun job to do necessary check before actual creation. + :param providers: {resourceUri}. Required. + :type providers: str + :param dryruns: The name of the DryrunResource. Required. + :type dryruns: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -537,6 +624,8 @@ async def begin_update_dryrun( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._update_dryrun_initial( + providers=providers, + dryruns=dryruns, resource_uri=resource_uri, dryrun_name=dryrun_name, parameters=parameters, @@ -559,7 +648,7 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) @@ -577,11 +666,15 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete_dryrun( # pylint: disable=inconsistent-return-statements - self, resource_uri: str, dryrun_name: str, **kwargs: Any + async def delete_dryrun( + self, providers: str, dryruns: str, resource_uri: str, dryrun_name: str, **kwargs: Any ) -> None: """delete a dryrun job. + :param providers: {resourceUri}. Required. + :type providers: str + :param dryruns: The name of the DryrunResource. Required. + :type dryruns: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -591,7 +684,7 @@ async def delete_dryrun( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -606,6 +699,8 @@ async def delete_dryrun( # pylint: disable=inconsistent-return-statements cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_dryrun_request( + providers=providers, + dryruns=dryruns, resource_uri=resource_uri, dryrun_name=dryrun_name, api_version=api_version, @@ -632,6 +727,8 @@ async def delete_dryrun( # pylint: disable=inconsistent-return-statements @overload async def generate_configurations( self, + providers: str, + linkers: str, resource_uri: str, linker_name: str, parameters: Optional[_models.ConfigurationInfo] = None, @@ -641,6 +738,10 @@ async def generate_configurations( ) -> _models.ConfigurationResult: """Generate configurations for a Linker. + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -659,6 +760,8 @@ async def generate_configurations( @overload async def generate_configurations( self, + providers: str, + linkers: str, resource_uri: str, linker_name: str, parameters: Optional[IO[bytes]] = None, @@ -668,6 +771,10 @@ async def generate_configurations( ) -> _models.ConfigurationResult: """Generate configurations for a Linker. + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -686,6 +793,8 @@ async def generate_configurations( @distributed_trace_async async def generate_configurations( self, + providers: str, + linkers: str, resource_uri: str, linker_name: str, parameters: Optional[Union[_models.ConfigurationInfo, IO[bytes]]] = None, @@ -693,6 +802,10 @@ async def generate_configurations( ) -> _models.ConfigurationResult: """Generate configurations for a Linker. + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -705,7 +818,7 @@ async def generate_configurations( :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -732,6 +845,8 @@ async def generate_configurations( _json = None _request = build_generate_configurations_request( + providers=providers, + linkers=linkers, resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, @@ -783,7 +898,7 @@ def list_dapr_configurations( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprConfigurationList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py index 88b2f81c8d33..9881bc143913 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,12 +26,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._operations import build_list_request +from .._configuration import ServiceLinkerManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -50,14 +48,16 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ServiceLinkerManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: - """Lists the available ServiceLinker REST API operations. + """List the operations for the provider. :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.Operation] @@ -69,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/__init__.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/__init__.py index fff44a3114d0..1bfe91ce148a 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/__init__.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/__init__.py @@ -5,93 +5,104 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccessKeyInfoBase -from ._models_py3 import AuthInfoBase -from ._models_py3 import AzureAppConfigProperties -from ._models_py3 import AzureKeyVaultProperties -from ._models_py3 import AzureResource -from ._models_py3 import AzureResourcePropertiesBase -from ._models_py3 import BasicErrorDryrunPrerequisiteResult -from ._models_py3 import ConfigurationInfo -from ._models_py3 import ConfigurationName -from ._models_py3 import ConfigurationNameItem -from ._models_py3 import ConfigurationNameResult -from ._models_py3 import ConfigurationResult -from ._models_py3 import ConfigurationStore -from ._models_py3 import ConfluentBootstrapServer -from ._models_py3 import ConfluentSchemaRegistry -from ._models_py3 import CreateOrUpdateDryrunParameters -from ._models_py3 import DaprConfigurationList -from ._models_py3 import DaprConfigurationResource -from ._models_py3 import DaprMetadata -from ._models_py3 import DaprProperties -from ._models_py3 import DatabaseAadAuthInfo -from ._models_py3 import DryrunList -from ._models_py3 import DryrunOperationPreview -from ._models_py3 import DryrunParameters -from ._models_py3 import DryrunPatch -from ._models_py3 import DryrunPrerequisiteResult -from ._models_py3 import DryrunResource -from ._models_py3 import EasyAuthMicrosoftEntraIDAuthInfo -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import FabricPlatform -from ._models_py3 import FirewallRules -from ._models_py3 import KeyVaultSecretReferenceSecretInfo -from ._models_py3 import KeyVaultSecretUriSecretInfo -from ._models_py3 import LinkerPatch -from ._models_py3 import LinkerProperties -from ._models_py3 import LinkerResource -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import PermissionsMissingDryrunPrerequisiteResult -from ._models_py3 import ProxyResource -from ._models_py3 import PublicNetworkSolution -from ._models_py3 import Resource -from ._models_py3 import ResourceList -from ._models_py3 import SecretAuthInfo -from ._models_py3 import SecretInfoBase -from ._models_py3 import SecretStore -from ._models_py3 import SelfHostedServer -from ._models_py3 import ServicePrincipalCertificateAuthInfo -from ._models_py3 import ServicePrincipalSecretAuthInfo -from ._models_py3 import SourceConfiguration -from ._models_py3 import SystemAssignedIdentityAuthInfo -from ._models_py3 import SystemData -from ._models_py3 import TargetServiceBase -from ._models_py3 import UserAccountAuthInfo -from ._models_py3 import UserAssignedIdentityAuthInfo -from ._models_py3 import VNetSolution -from ._models_py3 import ValidateOperationResult -from ._models_py3 import ValidationResultItem -from ._models_py3 import ValueSecretInfo +from typing import TYPE_CHECKING -from ._service_linker_management_client_enums import AccessKeyPermissions -from ._service_linker_management_client_enums import ActionType -from ._service_linker_management_client_enums import AllowType -from ._service_linker_management_client_enums import AuthMode -from ._service_linker_management_client_enums import AuthType -from ._service_linker_management_client_enums import AzureResourceType -from ._service_linker_management_client_enums import ClientType -from ._service_linker_management_client_enums import CreatedByType -from ._service_linker_management_client_enums import DaprBindingComponentDirection -from ._service_linker_management_client_enums import DaprMetadataRequired -from ._service_linker_management_client_enums import DeleteOrUpdateBehavior -from ._service_linker_management_client_enums import DryrunActionName -from ._service_linker_management_client_enums import DryrunPrerequisiteResultType -from ._service_linker_management_client_enums import DryrunPreviewOperationType -from ._service_linker_management_client_enums import LinkerConfigurationType -from ._service_linker_management_client_enums import Origin -from ._service_linker_management_client_enums import SecretSourceType -from ._service_linker_management_client_enums import SecretType -from ._service_linker_management_client_enums import TargetServiceType -from ._service_linker_management_client_enums import VNetSolutionType -from ._service_linker_management_client_enums import ValidationResultStatus +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccessKeyInfoBase, + AuthInfoBase, + AzureAppConfigProperties, + AzureKeyVaultProperties, + AzureResource, + AzureResourceManagerArmResponseDryrunResource, + AzureResourceManagerArmResponseValidateOperationResult, + AzureResourcePropertiesBase, + BasicErrorDryrunPrerequisiteResult, + ConfigurationInfo, + ConfigurationName, + ConfigurationNameItem, + ConfigurationNameResult, + ConfigurationResult, + ConfigurationStore, + ConfluentBootstrapServer, + ConfluentSchemaRegistry, + CreateOrUpdateDryrunParameters, + DaprConfigurationList, + DaprConfigurationResource, + DaprMetadata, + DaprProperties, + DryrunList, + DryrunOperationPreview, + DryrunParameters, + DryrunPatch, + DryrunPrerequisiteResult, + DryrunResource, + EasyAuthMicrosoftEntraIDAuthInfo, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + FabricPlatform, + FirewallRules, + KeyVaultSecretReferenceSecretInfo, + KeyVaultSecretUriSecretInfo, + LinkerPatch, + LinkerResource, + Operation, + OperationDisplay, + OperationListResult, + PermissionsMissingDryrunPrerequisiteResult, + ProxyResource, + PublicNetworkSolution, + Resource, + ResourceList, + SecretAuthInfo, + SecretInfoBase, + SecretStore, + SelfHostedServer, + ServicePrincipalCertificateAuthInfo, + ServicePrincipalSecretAuthInfo, + SourceConfiguration, + SystemAssignedIdentityAuthInfo, + SystemData, + TargetServiceBase, + UserAccountAuthInfo, + UserAssignedIdentityAuthInfo, + VNetSolution, + ValidateOperationResult, + ValidationResultItem, + ValueSecretInfo, +) + +from ._service_linker_management_client_enums import ( # type: ignore + AccessKeyPermissions, + ActionType, + AllowType, + AuthMode, + AuthType, + AzureResourceType, + ClientType, + CreatedByType, + DaprBindingComponentDirection, + DaprMetadataRequired, + DeleteOrUpdateBehavior, + DryrunActionName, + DryrunPrerequisiteResultType, + DryrunPreviewOperationType, + LinkerConfigurationType, + Origin, + SecretSourceType, + SecretType, + TargetServiceType, + VNetSolutionType, + ValidationResultStatus, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -100,6 +111,8 @@ "AzureAppConfigProperties", "AzureKeyVaultProperties", "AzureResource", + "AzureResourceManagerArmResponseDryrunResource", + "AzureResourceManagerArmResponseValidateOperationResult", "AzureResourcePropertiesBase", "BasicErrorDryrunPrerequisiteResult", "ConfigurationInfo", @@ -115,7 +128,6 @@ "DaprConfigurationResource", "DaprMetadata", "DaprProperties", - "DatabaseAadAuthInfo", "DryrunList", "DryrunOperationPreview", "DryrunParameters", @@ -131,7 +143,6 @@ "KeyVaultSecretReferenceSecretInfo", "KeyVaultSecretUriSecretInfo", "LinkerPatch", - "LinkerProperties", "LinkerResource", "Operation", "OperationDisplay", @@ -179,5 +190,5 @@ "VNetSolutionType", "ValidationResultStatus", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py index 07d452598e2d..1556d7d4decb 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py @@ -1,5 +1,5 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 -# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,10 +10,9 @@ import datetime from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union -from .. import _serialization +from .._utils import serialization as _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -300,6 +299,58 @@ def __init__( self.resource_properties = resource_properties +class AzureResourceManagerArmResponseDryrunResource(_serialization.Model): # pylint: disable=name-too-long + """Azure operation completed successfully. + + All required parameters must be populated in order to send to server. + + :ivar body: The body type of the operation request or response. Required. + :vartype body: ~azure.mgmt.servicelinker.models.DryrunResource + """ + + _validation = { + "body": {"required": True}, + } + + _attribute_map = { + "body": {"key": "body", "type": "DryrunResource"}, + } + + def __init__(self, *, body: "_models.DryrunResource", **kwargs: Any) -> None: + """ + :keyword body: The body type of the operation request or response. Required. + :paramtype body: ~azure.mgmt.servicelinker.models.DryrunResource + """ + super().__init__(**kwargs) + self.body = body + + +class AzureResourceManagerArmResponseValidateOperationResult(_serialization.Model): # pylint: disable=name-too-long + """Azure operation completed successfully. + + All required parameters must be populated in order to send to server. + + :ivar body: The body type of the operation request or response. Required. + :vartype body: ~azure.mgmt.servicelinker.models.ValidateOperationResult + """ + + _validation = { + "body": {"required": True}, + } + + _attribute_map = { + "body": {"key": "body", "type": "ValidateOperationResult"}, + } + + def __init__(self, *, body: "_models.ValidateOperationResult", **kwargs: Any) -> None: + """ + :keyword body: The body type of the operation request or response. Required. + :paramtype body: ~azure.mgmt.servicelinker.models.ValidateOperationResult + """ + super().__init__(**kwargs) + self.body = body + + class DryrunPrerequisiteResult(_serialization.Model): """A result of dryrun. @@ -380,8 +431,7 @@ class ConfigurationInfo(_serialization.Model): ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior :ivar action: Optional, indicate whether to apply configurations on source application. If enable, generate configurations and applied to the source application. Default is enable. If - optOut, no configuration change will be made on source. Known values are: "Internal", "enable", - and "optOut". + optOut, no configuration change will be made on source. "Internal" :vartype action: str or ~azure.mgmt.servicelinker.models.ActionType :ivar customized_keys: Optional. A dictionary of default key name and customized key name mapping. If not specified, default key name will be used for generate configurations. @@ -428,8 +478,7 @@ def __init__( ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior :keyword action: Optional, indicate whether to apply configurations on source application. If enable, generate configurations and applied to the source application. Default is enable. If - optOut, no configuration change will be made on source. Known values are: "Internal", "enable", - and "optOut". + optOut, no configuration change will be made on source. "Internal" :paramtype action: str or ~azure.mgmt.servicelinker.models.ActionType :keyword customized_keys: Optional. A dictionary of default key name and customized key name mapping. If not specified, default key name will be used for generate configurations. @@ -569,16 +618,16 @@ class ConfigurationNameResult(_serialization.Model): """Configuration Name list which will be set based on different target resource, client type, auth type. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to server. - :ivar value: Expected configuration names for each target service. + :ivar value: The ConfigurationNameItem items on this page. Required. :vartype value: list[~azure.mgmt.servicelinker.models.ConfigurationNameItem] - :ivar next_link: Link to next page of resources. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -586,14 +635,18 @@ class ConfigurationNameResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.ConfigurationNameItem"]] = None, **kwargs: Any) -> None: + def __init__( + self, *, value: List["_models.ConfigurationNameItem"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Expected configuration names for each target service. + :keyword value: The ConfigurationNameItem items on this page. Required. :paramtype value: list[~azure.mgmt.servicelinker.models.ConfigurationNameItem] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link = next_link class ConfigurationResult(_serialization.Model): @@ -700,96 +753,6 @@ def __init__(self, *, endpoint: Optional[str] = None, **kwargs: Any) -> None: self.endpoint = endpoint -class LinkerProperties(_serialization.Model): - """The properties of the Linker. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar target_service: The target service properties. - :vartype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase - :ivar auth_info: The authentication type. - :vartype auth_info: ~azure.mgmt.servicelinker.models.AuthInfoBase - :ivar client_type: The application client type. Known values are: "none", "dotnet", "java", - "python", "go", "php", "ruby", "django", "nodejs", "springBoot", "kafka-springBoot", - "jms-springBoot", and "dapr". - :vartype client_type: str or ~azure.mgmt.servicelinker.models.ClientType - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - :ivar v_net_solution: The VNet solution. - :vartype v_net_solution: ~azure.mgmt.servicelinker.models.VNetSolution - :ivar secret_store: An option to store secret value in secure place. - :vartype secret_store: ~azure.mgmt.servicelinker.models.SecretStore - :ivar scope: connection scope in source service. - :vartype scope: str - :ivar public_network_solution: The network solution. - :vartype public_network_solution: ~azure.mgmt.servicelinker.models.PublicNetworkSolution - :ivar configuration_info: The connection information consumed by applications, including - secrets, connection strings. - :vartype configuration_info: ~azure.mgmt.servicelinker.models.ConfigurationInfo - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "target_service": {"key": "targetService", "type": "TargetServiceBase"}, - "auth_info": {"key": "authInfo", "type": "AuthInfoBase"}, - "client_type": {"key": "clientType", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "v_net_solution": {"key": "vNetSolution", "type": "VNetSolution"}, - "secret_store": {"key": "secretStore", "type": "SecretStore"}, - "scope": {"key": "scope", "type": "str"}, - "public_network_solution": {"key": "publicNetworkSolution", "type": "PublicNetworkSolution"}, - "configuration_info": {"key": "configurationInfo", "type": "ConfigurationInfo"}, - } - - def __init__( - self, - *, - target_service: Optional["_models.TargetServiceBase"] = None, - auth_info: Optional["_models.AuthInfoBase"] = None, - client_type: Optional[Union[str, "_models.ClientType"]] = None, - v_net_solution: Optional["_models.VNetSolution"] = None, - secret_store: Optional["_models.SecretStore"] = None, - scope: Optional[str] = None, - public_network_solution: Optional["_models.PublicNetworkSolution"] = None, - configuration_info: Optional["_models.ConfigurationInfo"] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_service: The target service properties. - :paramtype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase - :keyword auth_info: The authentication type. - :paramtype auth_info: ~azure.mgmt.servicelinker.models.AuthInfoBase - :keyword client_type: The application client type. Known values are: "none", "dotnet", "java", - "python", "go", "php", "ruby", "django", "nodejs", "springBoot", "kafka-springBoot", - "jms-springBoot", and "dapr". - :paramtype client_type: str or ~azure.mgmt.servicelinker.models.ClientType - :keyword v_net_solution: The VNet solution. - :paramtype v_net_solution: ~azure.mgmt.servicelinker.models.VNetSolution - :keyword secret_store: An option to store secret value in secure place. - :paramtype secret_store: ~azure.mgmt.servicelinker.models.SecretStore - :keyword scope: connection scope in source service. - :paramtype scope: str - :keyword public_network_solution: The network solution. - :paramtype public_network_solution: ~azure.mgmt.servicelinker.models.PublicNetworkSolution - :keyword configuration_info: The connection information consumed by applications, including - secrets, connection strings. - :paramtype configuration_info: ~azure.mgmt.servicelinker.models.ConfigurationInfo - """ - super().__init__(**kwargs) - self.target_service = target_service - self.auth_info = auth_info - self.client_type = client_type - self.provisioning_state = None - self.v_net_solution = v_net_solution - self.secret_store = secret_store - self.scope = scope - self.public_network_solution = public_network_solution - self.configuration_info = configuration_info - - class DryrunParameters(_serialization.Model): """The parameters of the dryrun. @@ -818,13 +781,15 @@ def __init__(self, **kwargs: Any) -> None: self.action_name: Optional[str] = None -class CreateOrUpdateDryrunParameters(DryrunParameters, LinkerProperties): +class CreateOrUpdateDryrunParameters(DryrunParameters): """The dryrun parameters for creation or update a linker. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. + :ivar action_name: The name of action for you dryrun job. Required. "createOrUpdate" + :vartype action_name: str or ~azure.mgmt.servicelinker.models.DryrunActionName :ivar target_service: The target service properties. :vartype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase :ivar auth_info: The authentication type. @@ -846,16 +811,15 @@ class CreateOrUpdateDryrunParameters(DryrunParameters, LinkerProperties): :ivar configuration_info: The connection information consumed by applications, including secrets, connection strings. :vartype configuration_info: ~azure.mgmt.servicelinker.models.ConfigurationInfo - :ivar action_name: The name of action for you dryrun job. Required. "createOrUpdate" - :vartype action_name: str or ~azure.mgmt.servicelinker.models.DryrunActionName """ _validation = { - "provisioning_state": {"readonly": True}, "action_name": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { + "action_name": {"key": "actionName", "type": "str"}, "target_service": {"key": "targetService", "type": "TargetServiceBase"}, "auth_info": {"key": "authInfo", "type": "AuthInfoBase"}, "client_type": {"key": "clientType", "type": "str"}, @@ -865,7 +829,6 @@ class CreateOrUpdateDryrunParameters(DryrunParameters, LinkerProperties): "scope": {"key": "scope", "type": "str"}, "public_network_solution": {"key": "publicNetworkSolution", "type": "PublicNetworkSolution"}, "configuration_info": {"key": "configurationInfo", "type": "ConfigurationInfo"}, - "action_name": {"key": "actionName", "type": "str"}, } def __init__( @@ -902,42 +865,32 @@ def __init__( secrets, connection strings. :paramtype configuration_info: ~azure.mgmt.servicelinker.models.ConfigurationInfo """ - super().__init__( - target_service=target_service, - auth_info=auth_info, - client_type=client_type, - v_net_solution=v_net_solution, - secret_store=secret_store, - scope=scope, - public_network_solution=public_network_solution, - configuration_info=configuration_info, - **kwargs - ) + super().__init__(**kwargs) + self.action_name: str = "createOrUpdate" self.target_service = target_service self.auth_info = auth_info self.client_type = client_type - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.v_net_solution = v_net_solution self.secret_store = secret_store self.scope = scope self.public_network_solution = public_network_solution self.configuration_info = configuration_info - self.action_name: str = "createOrUpdate" class DaprConfigurationList(_serialization.Model): """Dapr configuration list supported by Service Connector. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to server. - :ivar value: The list of dapr configurations. + :ivar value: The DaprConfigurationResource items on this page. Required. :vartype value: list[~azure.mgmt.servicelinker.models.DaprConfigurationResource] - :ivar next_link: Link to next page of resources. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ _validation = { - "next_link": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { @@ -945,14 +898,18 @@ class DaprConfigurationList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DaprConfigurationResource"]] = None, **kwargs: Any) -> None: + def __init__( + self, *, value: List["_models.DaprConfigurationResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: The list of dapr configurations. + :keyword value: The DaprConfigurationResource items on this page. Required. :paramtype value: list[~azure.mgmt.servicelinker.models.DaprConfigurationResource] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link = next_link class DaprConfigurationResource(_serialization.Model): @@ -1119,56 +1076,42 @@ def __init__( self.secret_store_component = secret_store_component self.metadata = metadata self.scopes = scopes - self.runtime_version = None - self.binding_component_direction = None - - -class DatabaseAadAuthInfo(_serialization.Model): - """The extra auth info required by Database AAD authentication. - - :ivar user_name: Username created in the database which is mapped to a user in AAD. - :vartype user_name: str - """ - - _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, - } - - def __init__(self, *, user_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword user_name: Username created in the database which is mapped to a user in AAD. - :paramtype user_name: str - """ - super().__init__(**kwargs) - self.user_name = user_name + self.runtime_version: Optional[str] = None + self.binding_component_direction: Optional[Union[str, "_models.DaprBindingComponentDirection"]] = None class DryrunList(_serialization.Model): """The list of dryrun. - :ivar next_link: The link used to get the next page of dryrun list. - :vartype next_link: str - :ivar value: The list of dryrun. + All required parameters must be populated in order to send to server. + + :ivar value: The DryrunResource items on this page. Required. :vartype value: list[~azure.mgmt.servicelinker.models.DryrunResource] + :ivar next_link: The link to the next page of items. + :vartype next_link: str """ + _validation = { + "value": {"required": True}, + } + _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, "value": {"key": "value", "type": "[DryrunResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.DryrunResource"]] = None, **kwargs: Any + self, *, value: List["_models.DryrunResource"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword next_link: The link used to get the next page of dryrun list. - :paramtype next_link: str - :keyword value: The list of dryrun. + :keyword value: The DryrunResource items on this page. Required. :paramtype value: list[~azure.mgmt.servicelinker.models.DryrunResource] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) - self.next_link = next_link self.value = value + self.next_link = next_link class DryrunOperationPreview(_serialization.Model): @@ -1265,9 +1208,9 @@ def __init__(self, *, parameters: Optional["_models.DryrunParameters"] = None, * """ super().__init__(**kwargs) self.parameters = parameters - self.prerequisite_results = None - self.operation_previews = None - self.provisioning_state = None + self.prerequisite_results: Optional[List["_models.DryrunPrerequisiteResult"]] = None + self.operation_previews: Optional[List["_models.DryrunOperationPreview"]] = None + self.provisioning_state: Optional[str] = None class Resource(_serialization.Model): @@ -1276,7 +1219,7 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1305,10 +1248,10 @@ class Resource(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None class ProxyResource(Resource): @@ -1318,7 +1261,7 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1337,7 +1280,7 @@ class DryrunResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1385,9 +1328,9 @@ def __init__(self, *, parameters: Optional["_models.DryrunParameters"] = None, * """ super().__init__(**kwargs) self.parameters = parameters - self.prerequisite_results = None - self.operation_previews = None - self.provisioning_state = None + self.prerequisite_results: Optional[List["_models.DryrunPrerequisiteResult"]] = None + self.operation_previews: Optional[List["_models.DryrunOperationPreview"]] = None + self.provisioning_state: Optional[str] = None class EasyAuthMicrosoftEntraIDAuthInfo(AuthInfoBase): @@ -1481,8 +1424,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorDetail(_serialization.Model): @@ -1521,11 +1464,11 @@ class ErrorDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorDetail"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ErrorResponse(_serialization.Model): @@ -1816,7 +1759,7 @@ def __init__( self.target_service = target_service self.auth_info = auth_info self.client_type = client_type - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.v_net_solution = v_net_solution self.secret_store = secret_store self.scope = scope @@ -1824,13 +1767,13 @@ def __init__( self.configuration_info = configuration_info -class LinkerResource(ProxyResource): # pylint: disable=too-many-instance-attributes +class LinkerResource(ProxyResource): """Linker of source and target resource. Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1925,7 +1868,7 @@ def __init__( self.target_service = target_service self.auth_info = auth_info self.client_type = client_type - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.v_net_solution = v_net_solution self.secret_store = secret_store self.scope = scope @@ -1951,7 +1894,7 @@ class Operation(_serialization.Model): and "user,system". :vartype origin: str or ~azure.mgmt.servicelinker.models.Origin :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Known values are: "Internal", "enable", and "optOut". + internal only APIs. "Internal" :vartype action_type: str or ~azure.mgmt.servicelinker.models.ActionType """ @@ -1976,11 +1919,11 @@ def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kw :paramtype display: ~azure.mgmt.servicelinker.models.OperationDisplay """ super().__init__(**kwargs) - self.name = None - self.is_data_action = None + self.name: Optional[str] = None + self.is_data_action: Optional[bool] = None self.display = display - self.origin = None - self.action_type = None + self.origin: Optional[Union[str, "_models.Origin"]] = None + self.action_type: Optional[Union[str, "_models.ActionType"]] = None class OperationDisplay(_serialization.Model): @@ -2019,10 +1962,10 @@ class OperationDisplay(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None + self.provider: Optional[str] = None + self.resource: Optional[str] = None + self.operation: Optional[str] = None + self.description: Optional[str] = None class OperationListResult(_serialization.Model): @@ -2050,8 +1993,8 @@ class OperationListResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value: Optional[List["_models.Operation"]] = None + self.next_link: Optional[str] = None class PermissionsMissingDryrunPrerequisiteResult(DryrunPrerequisiteResult): # pylint: disable=name-too-long @@ -2114,7 +2057,7 @@ class PublicNetworkSolution(_serialization.Model): ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior :ivar action: Optional. Indicates public network solution. If enable, enable public network access of target service with best try. Default is enable. If optOut, opt out public network - access configuration. Known values are: "Internal", "enable", and "optOut". + access configuration. "Internal" :vartype action: str or ~azure.mgmt.servicelinker.models.ActionType :ivar firewall_rules: Describe firewall rules of target service to make sure source application could connect to the target. @@ -2143,7 +2086,7 @@ def __init__( ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior :keyword action: Optional. Indicates public network solution. If enable, enable public network access of target service with best try. Default is enable. If optOut, opt out public network - access configuration. Known values are: "Internal", "enable", and "optOut". + access configuration. "Internal" :paramtype action: str or ~azure.mgmt.servicelinker.models.ActionType :keyword firewall_rules: Describe firewall rules of target service to make sure source application could connect to the target. @@ -2158,29 +2101,35 @@ def __init__( class ResourceList(_serialization.Model): """The list of Linker. - :ivar next_link: The Linker used to get the next page of Linker list. - :vartype next_link: str - :ivar value: The list of Linkers. + All required parameters must be populated in order to send to server. + + :ivar value: The LinkerResource items on this page. Required. :vartype value: list[~azure.mgmt.servicelinker.models.LinkerResource] + :ivar next_link: The link to the next page of items. + :vartype next_link: str """ + _validation = { + "value": {"required": True}, + } + _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, "value": {"key": "value", "type": "[LinkerResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.LinkerResource"]] = None, **kwargs: Any + self, *, value: List["_models.LinkerResource"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword next_link: The Linker used to get the next page of Linker list. - :paramtype next_link: str - :keyword value: The list of Linkers. + :keyword value: The LinkerResource items on this page. Required. :paramtype value: list[~azure.mgmt.servicelinker.models.LinkerResource] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) - self.next_link = next_link self.value = value + self.next_link = next_link class SecretAuthInfo(AuthInfoBase): @@ -2385,13 +2334,11 @@ def __init__( self.roles = roles -class ServicePrincipalSecretAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): +class ServicePrincipalSecretAuthInfo(AuthInfoBase): """The authentication info when authType is servicePrincipal secret. All required parameters must be populated in order to send to server. - :ivar user_name: Username created in the database which is mapped to a user in AAD. - :vartype user_name: str :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", "accessKey", "userAccount", and "easyAuthMicrosoftEntraID". @@ -2401,6 +2348,8 @@ class ServicePrincipalSecretAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. Known values are: "optInAllAuth" and "optOutAllAuth". :vartype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode + :ivar user_name: Username created in the database which is mapped to a user in AAD. + :vartype user_name: str :ivar client_id: ServicePrincipal application clientId for servicePrincipal auth. Required. :vartype client_id: str :ivar principal_id: Principal Id for servicePrincipal auth. Required. @@ -2423,9 +2372,9 @@ class ServicePrincipalSecretAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): } _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, "auth_type": {"key": "authType", "type": "str"}, "auth_mode": {"key": "authMode", "type": "str"}, + "user_name": {"key": "userName", "type": "str"}, "client_id": {"key": "clientId", "type": "str"}, "principal_id": {"key": "principalId", "type": "str"}, "secret": {"key": "secret", "type": "str"}, @@ -2439,20 +2388,20 @@ def __init__( client_id: str, principal_id: str, secret: str, - user_name: Optional[str] = None, auth_mode: Optional[Union[str, "_models.AuthMode"]] = None, + user_name: Optional[str] = None, delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, roles: Optional[List[str]] = None, **kwargs: Any ) -> None: """ - :keyword user_name: Username created in the database which is mapped to a user in AAD. - :paramtype user_name: str :keyword auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, service linker configures authentication such as enabling identity on source resource and granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. Known values are: "optInAllAuth" and "optOutAllAuth". :paramtype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode + :keyword user_name: Username created in the database which is mapped to a user in AAD. + :paramtype user_name: str :keyword client_id: ServicePrincipal application clientId for servicePrincipal auth. Required. :paramtype client_id: str :keyword principal_id: Principal Id for servicePrincipal auth. Required. @@ -2466,15 +2415,14 @@ def __init__( :keyword roles: Optional, this value specifies the Azure roles to be assigned. Automatically. :paramtype roles: list[str] """ - super().__init__(auth_mode=auth_mode, user_name=user_name, **kwargs) - self.user_name = user_name + super().__init__(auth_mode=auth_mode, **kwargs) self.auth_type: str = "servicePrincipalSecret" + self.user_name = user_name self.client_id = client_id self.principal_id = principal_id self.secret = secret self.delete_or_update_behavior = delete_or_update_behavior self.roles = roles - self.auth_mode = auth_mode class SourceConfiguration(_serialization.Model): @@ -2530,18 +2478,16 @@ def __init__( super().__init__(**kwargs) self.name = name self.value = value - self.config_type = None + self.config_type: Optional[Union[str, "_models.LinkerConfigurationType"]] = None self.key_vault_reference_identity = key_vault_reference_identity self.description = description -class SystemAssignedIdentityAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): +class SystemAssignedIdentityAuthInfo(AuthInfoBase): """The authentication info when authType is systemAssignedIdentity. All required parameters must be populated in order to send to server. - :ivar user_name: Username created in the database which is mapped to a user in AAD. - :vartype user_name: str :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", "accessKey", "userAccount", and "easyAuthMicrosoftEntraID". @@ -2551,6 +2497,8 @@ class SystemAssignedIdentityAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. Known values are: "optInAllAuth" and "optOutAllAuth". :vartype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode + :ivar user_name: Username created in the database which is mapped to a user in AAD. + :vartype user_name: str :ivar delete_or_update_behavior: Indicates whether to clean up previous operation when Linker is updating or deleting. Known values are: "Default" and "ForcedCleanup". :vartype delete_or_update_behavior: str or @@ -2564,9 +2512,9 @@ class SystemAssignedIdentityAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): } _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, "auth_type": {"key": "authType", "type": "str"}, "auth_mode": {"key": "authMode", "type": "str"}, + "user_name": {"key": "userName", "type": "str"}, "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, "roles": {"key": "roles", "type": "[str]"}, } @@ -2574,20 +2522,20 @@ class SystemAssignedIdentityAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): def __init__( self, *, - user_name: Optional[str] = None, auth_mode: Optional[Union[str, "_models.AuthMode"]] = None, + user_name: Optional[str] = None, delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, roles: Optional[List[str]] = None, **kwargs: Any ) -> None: """ - :keyword user_name: Username created in the database which is mapped to a user in AAD. - :paramtype user_name: str :keyword auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, service linker configures authentication such as enabling identity on source resource and granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. Known values are: "optInAllAuth" and "optOutAllAuth". :paramtype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode + :keyword user_name: Username created in the database which is mapped to a user in AAD. + :paramtype user_name: str :keyword delete_or_update_behavior: Indicates whether to clean up previous operation when Linker is updating or deleting. Known values are: "Default" and "ForcedCleanup". :paramtype delete_or_update_behavior: str or @@ -2595,12 +2543,11 @@ def __init__( :keyword roles: Optional, this value specifies the Azure role to be assigned. :paramtype roles: list[str] """ - super().__init__(auth_mode=auth_mode, user_name=user_name, **kwargs) - self.user_name = user_name + super().__init__(auth_mode=auth_mode, **kwargs) self.auth_type: str = "systemAssignedIdentity" + self.user_name = user_name self.delete_or_update_behavior = delete_or_update_behavior self.roles = roles - self.auth_mode = auth_mode class SystemData(_serialization.Model): @@ -2667,13 +2614,11 @@ def __init__( self.last_modified_at = last_modified_at -class UserAccountAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): +class UserAccountAuthInfo(AuthInfoBase): """The authentication info when authType is user account. All required parameters must be populated in order to send to server. - :ivar user_name: Username created in the database which is mapped to a user in AAD. - :vartype user_name: str :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", "accessKey", "userAccount", and "easyAuthMicrosoftEntraID". @@ -2683,6 +2628,8 @@ class UserAccountAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. Known values are: "optInAllAuth" and "optOutAllAuth". :vartype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode + :ivar user_name: Username created in the database which is mapped to a user in AAD. + :vartype user_name: str :ivar principal_id: Principal Id for user account. :vartype principal_id: str :ivar delete_or_update_behavior: Indicates whether to clean up previous operation when Linker @@ -2698,9 +2645,9 @@ class UserAccountAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): } _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, "auth_type": {"key": "authType", "type": "str"}, "auth_mode": {"key": "authMode", "type": "str"}, + "user_name": {"key": "userName", "type": "str"}, "principal_id": {"key": "principalId", "type": "str"}, "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, "roles": {"key": "roles", "type": "[str]"}, @@ -2709,21 +2656,21 @@ class UserAccountAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): def __init__( self, *, - user_name: Optional[str] = None, auth_mode: Optional[Union[str, "_models.AuthMode"]] = None, + user_name: Optional[str] = None, principal_id: Optional[str] = None, delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, roles: Optional[List[str]] = None, **kwargs: Any ) -> None: """ - :keyword user_name: Username created in the database which is mapped to a user in AAD. - :paramtype user_name: str :keyword auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, service linker configures authentication such as enabling identity on source resource and granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. Known values are: "optInAllAuth" and "optOutAllAuth". :paramtype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode + :keyword user_name: Username created in the database which is mapped to a user in AAD. + :paramtype user_name: str :keyword principal_id: Principal Id for user account. :paramtype principal_id: str :keyword delete_or_update_behavior: Indicates whether to clean up previous operation when @@ -2733,22 +2680,19 @@ def __init__( :keyword roles: Optional, this value specifies the Azure roles to be assigned. Automatically. :paramtype roles: list[str] """ - super().__init__(auth_mode=auth_mode, user_name=user_name, **kwargs) - self.user_name = user_name + super().__init__(auth_mode=auth_mode, **kwargs) self.auth_type: str = "userAccount" + self.user_name = user_name self.principal_id = principal_id self.delete_or_update_behavior = delete_or_update_behavior self.roles = roles - self.auth_mode = auth_mode -class UserAssignedIdentityAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): +class UserAssignedIdentityAuthInfo(AuthInfoBase): """The authentication info when authType is userAssignedIdentity. All required parameters must be populated in order to send to server. - :ivar user_name: Username created in the database which is mapped to a user in AAD. - :vartype user_name: str :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", "accessKey", "userAccount", and "easyAuthMicrosoftEntraID". @@ -2758,6 +2702,8 @@ class UserAssignedIdentityAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. Known values are: "optInAllAuth" and "optOutAllAuth". :vartype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode + :ivar user_name: Username created in the database which is mapped to a user in AAD. + :vartype user_name: str :ivar client_id: Client Id for userAssignedIdentity. :vartype client_id: str :ivar subscription_id: Subscription id for userAssignedIdentity. @@ -2775,9 +2721,9 @@ class UserAssignedIdentityAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): } _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, "auth_type": {"key": "authType", "type": "str"}, "auth_mode": {"key": "authMode", "type": "str"}, + "user_name": {"key": "userName", "type": "str"}, "client_id": {"key": "clientId", "type": "str"}, "subscription_id": {"key": "subscriptionId", "type": "str"}, "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, @@ -2787,8 +2733,8 @@ class UserAssignedIdentityAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): def __init__( self, *, - user_name: Optional[str] = None, auth_mode: Optional[Union[str, "_models.AuthMode"]] = None, + user_name: Optional[str] = None, client_id: Optional[str] = None, subscription_id: Optional[str] = None, delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, @@ -2796,13 +2742,13 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword user_name: Username created in the database which is mapped to a user in AAD. - :paramtype user_name: str :keyword auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, service linker configures authentication such as enabling identity on source resource and granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. Known values are: "optInAllAuth" and "optOutAllAuth". :paramtype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode + :keyword user_name: Username created in the database which is mapped to a user in AAD. + :paramtype user_name: str :keyword client_id: Client Id for userAssignedIdentity. :paramtype client_id: str :keyword subscription_id: Subscription id for userAssignedIdentity. @@ -2814,14 +2760,13 @@ def __init__( :keyword roles: Optional, this value specifies the Azure role to be assigned. :paramtype roles: list[str] """ - super().__init__(auth_mode=auth_mode, user_name=user_name, **kwargs) - self.user_name = user_name + super().__init__(auth_mode=auth_mode, **kwargs) self.auth_type: str = "userAssignedIdentity" + self.user_name = user_name self.client_id = client_id self.subscription_id = subscription_id self.delete_or_update_behavior = delete_or_update_behavior self.roles = roles - self.auth_mode = auth_mode class ValidateOperationResult(_serialization.Model): diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_service_linker_management_client_enums.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_service_linker_management_client_enums.py index e2e26bea2d33..845e5ce8aadf 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_service_linker_management_client_enums.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_service_linker_management_client_enums.py @@ -24,8 +24,6 @@ class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" INTERNAL = "Internal" - ENABLE = "enable" - OPT_OUT = "optOut" class AllowType(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/__init__.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/__init__.py index 80d740a2329c..c29af27f3423 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/__init__.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/__init__.py @@ -5,23 +5,29 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._connector_operations import ConnectorOperations -from ._linker_operations import LinkerOperations -from ._linkers_operations import LinkersOperations -from ._operations import Operations -from ._configuration_names_operations import ConfigurationNamesOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._linker_operations import LinkerOperations # type: ignore +from ._linkers_operations import LinkersOperations # type: ignore +from ._configuration_names_operations import ConfigurationNamesOperations # type: ignore +from ._operations import Operations # type: ignore +from ._connector_operations import ConnectorOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ConnectorOperations", "LinkerOperations", "LinkersOperations", - "Operations", "ConfigurationNamesOperations", + "Operations", + "ConnectorOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_configuration_names_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_configuration_names_operations.py index d1a3d5b34aa9..3b66919e5f19 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_configuration_names_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_configuration_names_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,12 +26,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import ServiceLinkerManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -76,10 +73,12 @@ class ConfigurationNamesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ServiceLinkerManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -103,7 +102,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConfigurationNameResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_connector_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_connector_operations.py index 4ea74c6ab1ac..87021d66113f 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_connector_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_connector_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import ServiceLinkerManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,9 +42,7 @@ _SERIALIZER.client_side_validation = False -def build_list_dryrun_request( - subscription_id: str, resource_group_name: str, location: str, **kwargs: Any -) -> HttpRequest: +def build_list_request(resource_group_name: str, location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -56,8 +52,8 @@ def build_list_dryrun_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors", + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -77,8 +73,8 @@ def build_list_dryrun_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_dryrun_request( - subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any +def build_get_request( + resource_group_name: str, location: str, connector_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -89,15 +85,15 @@ def build_get_dryrun_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}", + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "location": _SERIALIZER.url("location", location, "str", min_length=1), - "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), + "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -111,8 +107,8 @@ def build_get_dryrun_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_dryrun_request( - subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, location: str, connector_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -124,15 +120,15 @@ def build_create_dryrun_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}", + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "location": _SERIALIZER.url("location", location, "str", min_length=1), - "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), + "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -148,8 +144,8 @@ def build_create_dryrun_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_dryrun_request( - subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any +def build_update_request( + resource_group_name: str, location: str, connector_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -161,15 +157,15 @@ def build_update_dryrun_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}", + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "location": _SERIALIZER.url("location", location, "str", min_length=1), - "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), + "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -185,8 +181,8 @@ def build_update_dryrun_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_dryrun_request( - subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any +def build_delete_request( + resource_group_name: str, location: str, connector_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -197,15 +193,15 @@ def build_delete_dryrun_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}", + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "location": _SERIALIZER.url("location", location, "str", min_length=1), - "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), + "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -219,24 +215,28 @@ def build_delete_dryrun_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request(subscription_id: str, resource_group_name: str, location: str, **kwargs: Any) -> HttpRequest: +def build_generate_configurations_request( + resource_group_name: str, location: str, connector_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/generateConfigurations", + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "location": _SERIALIZER.url("location", location, "str", min_length=1), + "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -245,13 +245,15 @@ def build_list_request(subscription_id: str, resource_group_name: str, location: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any +def build_validate_request( + resource_group_name: str, location: str, connector_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -262,8 +264,8 @@ def build_get_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate", + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -281,31 +283,29 @@ def build_get_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request( - subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any +def build_list_dryrun_request( + resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns", + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "location": _SERIALIZER.url("location", location, "str", min_length=1), - "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -314,15 +314,13 @@ def build_create_or_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( - subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any +def build_get_dryrun_request( + resource_group_name: str, location: str, dryrun_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -333,15 +331,15 @@ def build_delete_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}", + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "location": _SERIALIZER.url("location", location, "str", min_length=1), - "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), + "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -352,11 +350,11 @@ def build_delete_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request( - subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any +def build_create_dryrun_request( + resource_group_name: str, location: str, dryrun_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -368,15 +366,15 @@ def build_update_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}", + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "location": _SERIALIZER.url("location", location, "str", min_length=1), - "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), + "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -389,30 +387,31 @@ def build_update_request( _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_request( - subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any +def build_update_dryrun_request( + resource_group_name: str, location: str, dryrun_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}", + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "location": _SERIALIZER.url("location", location, "str", min_length=1), - "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), + "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -421,33 +420,34 @@ def build_validate_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_generate_configurations_request( - subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any +def build_delete_dryrun_request( + resource_group_name: str, location: str, dryrun_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/generateConfigurations", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}", + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "location": _SERIALIZER.url("location", location, "str", min_length=1), - "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), + "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -456,11 +456,9 @@ def build_generate_configurations_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) class ConnectorOperations: @@ -477,35 +475,34 @@ class ConnectorOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ServiceLinkerManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_dryrun( - self, subscription_id: str, resource_group_name: str, location: str, **kwargs: Any - ) -> Iterable["_models.DryrunResource"]: - """list dryrun jobs. + def list(self, resource_group_name: str, location: str, **kwargs: Any) -> Iterable["_models.LinkerResource"]: + """Returns list of connector which connects to the resource, which supports to config the target + service during the resource provision. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :return: An iterator like instance of either DryrunResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.DryrunResource] + :return: An iterator like instance of either LinkerResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.LinkerResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DryrunList] = kwargs.pop("cls", None) + cls: ClsType[_models.ResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -516,10 +513,10 @@ def list_dryrun( def prepare_request(next_link=None): if not next_link: - _request = build_list_dryrun_request( - subscription_id=subscription_id, + _request = build_list_request( resource_group_name=resource_group_name, location=location, + subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, params=_params, @@ -544,7 +541,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("DryrunList", pipeline_response) + deserialized = self._deserialize("ResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -569,25 +566,23 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def get_dryrun( - self, subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any - ) -> _models.DryrunResource: - """get a dryrun job. + def get( + self, resource_group_name: str, location: str, connector_name: str, **kwargs: Any + ) -> _models.LinkerResource: + """Returns Connector resource for a given name. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :return: DryrunResource or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.DryrunResource + :param connector_name: The name of the LinkerResource. Required. + :type connector_name: str + :return: LinkerResource or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.LinkerResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -599,13 +594,13 @@ def get_dryrun( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) + cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - _request = build_get_dryrun_request( - subscription_id=subscription_id, + _request = build_get_request( resource_group_name=resource_group_name, location=location, - dryrun_name=dryrun_name, + connector_name=connector_name, + subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, params=_params, @@ -624,23 +619,22 @@ def get_dryrun( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DryrunResource", pipeline_response.http_response) + deserialized = self._deserialize("LinkerResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_dryrun_initial( + def _create_or_update_initial( self, - subscription_id: str, resource_group_name: str, location: str, - dryrun_name: str, - parameters: Union[_models.DryrunResource, IO[bytes]], + connector_name: str, + parameters: Union[_models.LinkerResource, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -661,13 +655,13 @@ def _create_dryrun_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "DryrunResource") + _json = self._serialize.body(parameters, "LinkerResource") - _request = build_create_dryrun_request( - subscription_id=subscription_id, + _request = build_create_or_update_request( resource_group_name=resource_group_name, location=location, - dryrun_name=dryrun_name, + connector_name=connector_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, @@ -694,108 +688,106 @@ def _create_dryrun_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_create_dryrun( + def begin_create_or_update( self, - subscription_id: str, resource_group_name: str, location: str, - dryrun_name: str, - parameters: _models.DryrunResource, + connector_name: str, + parameters: _models.LinkerResource, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. + ) -> LROPoller[_models.LinkerResource]: + """Create or update Connector resource. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource + :param connector_name: The name of the LinkerResource. Required. + :type connector_name: str + :param parameters: Connector details. Required. + :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either DryrunResource or the result of + :return: An instance of LROPoller that returns either LinkerResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_dryrun( + def begin_create_or_update( self, - subscription_id: str, resource_group_name: str, location: str, - dryrun_name: str, + connector_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. + ) -> LROPoller[_models.LinkerResource]: + """Create or update Connector resource. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. + :param connector_name: The name of the LinkerResource. Required. + :type connector_name: str + :param parameters: Connector details. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either DryrunResource or the result of + :return: An instance of LROPoller that returns either LinkerResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_dryrun( + def begin_create_or_update( self, - subscription_id: str, resource_group_name: str, location: str, - dryrun_name: str, - parameters: Union[_models.DryrunResource, IO[bytes]], + connector_name: str, + parameters: Union[_models.LinkerResource, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. + ) -> LROPoller[_models.LinkerResource]: + """Create or update Connector resource. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Is either a DryrunResource type or a IO[bytes] type. + :param connector_name: The name of the LinkerResource. Required. + :type connector_name: str + :param parameters: Connector details. Is either a LinkerResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource or IO[bytes] - :return: An instance of LROPoller that returns either DryrunResource or the result of + :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource or IO[bytes] + :return: An instance of LROPoller that returns either LinkerResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -803,16 +795,15 @@ def begin_create_dryrun( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) + cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_dryrun_initial( - subscription_id=subscription_id, + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, location=location, - dryrun_name=dryrun_name, + connector_name=connector_name, parameters=parameters, api_version=api_version, content_type=content_type, @@ -825,7 +816,7 @@ def begin_create_dryrun( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DryrunResource", pipeline_response.http_response) + deserialized = self._deserialize("LinkerResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -839,26 +830,25 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.DryrunResource].from_continuation_token( + return LROPoller[_models.LinkerResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.DryrunResource]( + return LROPoller[_models.LinkerResource]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _update_dryrun_initial( + def _update_initial( self, - subscription_id: str, resource_group_name: str, location: str, - dryrun_name: str, - parameters: Union[_models.DryrunPatch, IO[bytes]], + connector_name: str, + parameters: Union[_models.LinkerPatch, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -879,13 +869,13 @@ def _update_dryrun_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "DryrunPatch") + _json = self._serialize.body(parameters, "LinkerPatch") - _request = build_update_dryrun_request( - subscription_id=subscription_id, + _request = build_update_request( resource_group_name=resource_group_name, location=location, - dryrun_name=dryrun_name, + connector_name=connector_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, @@ -912,107 +902,105 @@ def _update_dryrun_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_update_dryrun( + def begin_update( self, - subscription_id: str, resource_group_name: str, location: str, - dryrun_name: str, - parameters: _models.DryrunPatch, + connector_name: str, + parameters: _models.LinkerPatch, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """update a dryrun job to do necessary check before actual creation. + ) -> LROPoller[_models.LinkerResource]: + """Operation to update an existing Connector. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch + :param connector_name: The name of the LinkerResource. Required. + :type connector_name: str + :param parameters: Connector details. Required. + :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either DryrunResource or the result of + :return: An instance of LROPoller that returns either LinkerResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_dryrun( + def begin_update( self, - subscription_id: str, resource_group_name: str, location: str, - dryrun_name: str, + connector_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """update a dryrun job to do necessary check before actual creation. + ) -> LROPoller[_models.LinkerResource]: + """Operation to update an existing Connector. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. + :param connector_name: The name of the LinkerResource. Required. + :type connector_name: str + :param parameters: Connector details. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either DryrunResource or the result of + :return: An instance of LROPoller that returns either LinkerResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update_dryrun( + def begin_update( self, - subscription_id: str, resource_group_name: str, location: str, - dryrun_name: str, - parameters: Union[_models.DryrunPatch, IO[bytes]], + connector_name: str, + parameters: Union[_models.LinkerPatch, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """update a dryrun job to do necessary check before actual creation. + ) -> LROPoller[_models.LinkerResource]: + """Operation to update an existing Connector. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Is either a DryrunPatch type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch or IO[bytes] - :return: An instance of LROPoller that returns either DryrunResource or the result of + :param connector_name: The name of the LinkerResource. Required. + :type connector_name: str + :param parameters: Connector details. Is either a LinkerPatch type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch or IO[bytes] + :return: An instance of LROPoller that returns either LinkerResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1020,16 +1008,15 @@ def begin_update_dryrun( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) + cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_dryrun_initial( - subscription_id=subscription_id, + raw_result = self._update_initial( resource_group_name=resource_group_name, location=location, - dryrun_name=dryrun_name, + connector_name=connector_name, parameters=parameters, api_version=api_version, content_type=content_type, @@ -1042,7 +1029,7 @@ def begin_update_dryrun( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DryrunResource", pipeline_response.http_response) + deserialized = self._deserialize("LinkerResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1056,36 +1043,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.DryrunResource].from_continuation_token( + return LROPoller[_models.LinkerResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.DryrunResource]( + return LROPoller[_models.LinkerResource]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace - def delete_dryrun( # pylint: disable=inconsistent-return-statements - self, subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any - ) -> None: - """delete a dryrun job. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _delete_initial( + self, resource_group_name: str, location: str, connector_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1097,406 +1068,258 @@ def delete_dryrun( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_delete_dryrun_request( - subscription_id=subscription_id, + _request = build_delete_request( resource_group_name=resource_group_name, location=location, - dryrun_name=dryrun_name, + connector_name=connector_name, + subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list( - self, subscription_id: str, resource_group_name: str, location: str, **kwargs: Any - ) -> Iterable["_models.LinkerResource"]: - """Returns list of connector which connects to the resource, which supports to config the target - service during the resource provision. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :return: An iterator like instance of either LinkerResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") ) - response = pipeline_response.http_response + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return ItemPaged(get_next, extract_data) + return deserialized # type: ignore @distributed_trace - def get( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> _models.LinkerResource: - """Returns Connector resource for a given name. + def begin_delete( + self, resource_group_name: str, location: str, connector_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a Connector. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param connector_name: The name of resource. Required. + :param connector_name: The name of the LinkerResource. Required. :type connector_name: str - :return: LinkerResource or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.LinkerResource + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - - _request = build_get_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LinkerResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Union[_models.LinkerResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + location=location, + connector_name=connector_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) else: - _json = self._serialize.body(parameters, "LinkerResource") - - _request = build_create_or_update_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @overload - def begin_create_or_update( + def generate_configurations( self, - subscription_id: str, resource_group_name: str, location: str, connector_name: str, - parameters: _models.LinkerResource, + parameters: Optional[_models.ConfigurationInfo] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Create or update Connector resource. + ) -> _models.ConfigurationResult: + """Generate configurations for a Connector. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param connector_name: The name of resource. Required. + :param connector_name: The name of the LinkerResource. Required. :type connector_name: str - :param parameters: Connector details. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource + :param parameters: Connection Info, including format, secret store, etc. Default value is None. + :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] + :return: ConfigurationResult or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def generate_configurations( self, - subscription_id: str, resource_group_name: str, location: str, connector_name: str, - parameters: IO[bytes], + parameters: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Create or update Connector resource. + ) -> _models.ConfigurationResult: + """Generate configurations for a Connector. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param connector_name: The name of resource. Required. + :param connector_name: The name of the LinkerResource. Required. :type connector_name: str - :param parameters: Connector details. Required. + :param parameters: Connection Info, including format, secret store, etc. Default value is None. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] + :return: ConfigurationResult or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_or_update( + def generate_configurations( self, - subscription_id: str, resource_group_name: str, location: str, connector_name: str, - parameters: Union[_models.LinkerResource, IO[bytes]], + parameters: Optional[Union[_models.ConfigurationInfo, IO[bytes]]] = None, **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Create or update Connector resource. + ) -> _models.ConfigurationResult: + """Generate configurations for a Connector. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param connector_name: The name of resource. Required. + :param connector_name: The name of the LinkerResource. Required. :type connector_name: str - :param parameters: Connector details. Is either a LinkerResource type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource or IO[bytes] - :return: An instance of LROPoller that returns either LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] + :param parameters: Connection Info, including format, secret store, etc. Is either a + ConfigurationInfo type or a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo or IO[bytes] + :return: ConfigurationResult or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LinkerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + cls: ClsType[_models.ConfigurationResult] = kwargs.pop("cls", None) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - polling_method = polling - if cont_token: - return LROPoller[_models.LinkerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.LinkerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + if parameters is not None: + _json = self._serialize.body(parameters, "ConfigurationInfo") + else: + _json = None + + _request = build_generate_configurations_request( + resource_group_name=resource_group_name, + location=location, + connector_name=connector_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - def _delete_initial( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConfigurationResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _validate_initial( + self, resource_group_name: str, location: str, connector_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1510,11 +1333,11 @@ def _delete_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_delete_request( - subscription_id=subscription_id, + _request = build_validate_request( resource_group_name=resource_group_name, location=location, connector_name=connector_name, + subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, params=_params, @@ -1529,7 +1352,7 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -1538,43 +1361,46 @@ def _delete_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def begin_delete( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a Connector. + def begin_validate( + self, resource_group_name: str, location: str, connector_name: str, **kwargs: Any + ) -> LROPoller[_models.ValidateOperationResult]: + """Validate a Connector. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param connector_name: The name of resource. Required. + :param connector_name: The name of the LinkerResource. Required. :type connector_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns either ValidateOperationResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.ValidateOperationResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.ValidateOperationResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( - subscription_id=subscription_id, + raw_result = self._validate_initial( resource_group_name=resource_group_name, location=location, connector_name=connector_name, @@ -1587,37 +1413,183 @@ def begin_delete( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ValidateOperationResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.ValidateOperationResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.ValidateOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _update_initial( + @distributed_trace + def list_dryrun(self, resource_group_name: str, location: str, **kwargs: Any) -> Iterable["_models.DryrunResource"]: + """list dryrun jobs. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of Azure region. Required. + :type location: str + :return: An iterator like instance of either DryrunResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.DryrunResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DryrunList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_dryrun_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DryrunList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_dryrun( + self, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any + ) -> _models.DryrunResource: + """get a dryrun job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of Azure region. Required. + :type location: str + :param dryrun_name: The name of the DryrunResource. Required. + :type dryrun_name: str + :return: DryrunResource or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.DryrunResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) + + _request = build_get_dryrun_request( + resource_group_name=resource_group_name, + location=location, + dryrun_name=dryrun_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DryrunResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_dryrun_initial( self, - subscription_id: str, resource_group_name: str, location: str, - connector_name: str, - parameters: Union[_models.LinkerPatch, IO[bytes]], + dryrun_name: str, + parameters: Union[_models.DryrunResource, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1638,13 +1610,13 @@ def _update_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "LinkerPatch") + _json = self._serialize.body(parameters, "DryrunResource") - _request = build_update_request( - subscription_id=subscription_id, + _request = build_create_dryrun_request( resource_group_name=resource_group_name, location=location, - connector_name=connector_name, + dryrun_name=dryrun_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, @@ -1662,7 +1634,7 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -1671,108 +1643,106 @@ def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_update( + def begin_create_dryrun( self, - subscription_id: str, resource_group_name: str, location: str, - connector_name: str, - parameters: _models.LinkerPatch, + dryrun_name: str, + parameters: _models.DryrunResource, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Operation to update an existing Connector. + ) -> LROPoller[_models.DryrunResource]: + """create a dryrun job to do necessary check before actual creation. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch + :param dryrun_name: The name of the DryrunResource. Required. + :type dryrun_name: str + :param parameters: dryrun resource. Required. + :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either LinkerResource or the result of + :return: An instance of LROPoller that returns either DryrunResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update( + def begin_create_dryrun( self, - subscription_id: str, resource_group_name: str, location: str, - connector_name: str, + dryrun_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Operation to update an existing Connector. + ) -> LROPoller[_models.DryrunResource]: + """create a dryrun job to do necessary check before actual creation. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Required. + :param dryrun_name: The name of the DryrunResource. Required. + :type dryrun_name: str + :param parameters: dryrun resource. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either LinkerResource or the result of + :return: An instance of LROPoller that returns either DryrunResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update( + def begin_create_dryrun( self, - subscription_id: str, resource_group_name: str, location: str, - connector_name: str, - parameters: Union[_models.LinkerPatch, IO[bytes]], + dryrun_name: str, + parameters: Union[_models.DryrunResource, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Operation to update an existing Connector. + ) -> LROPoller[_models.DryrunResource]: + """create a dryrun job to do necessary check before actual creation. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Is either a LinkerPatch type or a IO[bytes] type. + :param dryrun_name: The name of the DryrunResource. Required. + :type dryrun_name: str + :param parameters: dryrun resource. Is either a DryrunResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch or IO[bytes] - :return: An instance of LROPoller that returns either LinkerResource or the result of + :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource or IO[bytes] + :return: An instance of LROPoller that returns either DryrunResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1780,16 +1750,15 @@ def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) + cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( - subscription_id=subscription_id, + raw_result = self._create_dryrun_initial( resource_group_name=resource_group_name, location=location, - connector_name=connector_name, + dryrun_name=dryrun_name, parameters=parameters, api_version=api_version, content_type=content_type, @@ -1802,7 +1771,7 @@ def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LinkerResource", pipeline_response.http_response) + deserialized = self._deserialize("DryrunResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1816,20 +1785,25 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.LinkerResource].from_continuation_token( + return LROPoller[_models.DryrunResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.LinkerResource]( + return LROPoller[_models.DryrunResource]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _validate_initial( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any + def _update_dryrun_initial( + self, + resource_group_name: str, + location: str, + dryrun_name: str, + parameters: Union[_models.DryrunPatch, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1837,18 +1811,30 @@ def _validate_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_validate_request( - subscription_id=subscription_id, + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "DryrunPatch") + + _request = build_update_dryrun_request( resource_group_name=resource_group_name, location=location, - connector_name=connector_name, + dryrun_name=dryrun_name, + subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -1871,48 +1857,124 @@ def _validate_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + def begin_update_dryrun( + self, + resource_group_name: str, + location: str, + dryrun_name: str, + parameters: _models.DryrunPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DryrunResource]: + """update a dryrun job to do necessary check before actual creation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of Azure region. Required. + :type location: str + :param dryrun_name: The name of the DryrunResource. Required. + :type dryrun_name: str + :param parameters: dryrun resource. Required. + :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DryrunResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_dryrun( + self, + resource_group_name: str, + location: str, + dryrun_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DryrunResource]: + """update a dryrun job to do necessary check before actual creation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of Azure region. Required. + :type location: str + :param dryrun_name: The name of the DryrunResource. Required. + :type dryrun_name: str + :param parameters: dryrun resource. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DryrunResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_validate( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> LROPoller[_models.ValidateOperationResult]: - """Validate a Connector. + def begin_update_dryrun( + self, + resource_group_name: str, + location: str, + dryrun_name: str, + parameters: Union[_models.DryrunPatch, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DryrunResource]: + """update a dryrun job to do necessary check before actual creation. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :return: An instance of LROPoller that returns either ValidateOperationResult or the result of + :param dryrun_name: The name of the DryrunResource. Required. + :type dryrun_name: str + :param parameters: dryrun resource. Is either a DryrunPatch type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch or IO[bytes] + :return: An instance of LROPoller that returns either DryrunResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.ValidateOperationResult] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ValidateOperationResult] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._validate_initial( - subscription_id=subscription_id, + raw_result = self._update_dryrun_initial( resource_group_name=resource_group_name, location=location, - connector_name=connector_name, + dryrun_name=dryrun_name, + parameters=parameters, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -1922,125 +1984,48 @@ def begin_validate( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ValidateOperationResult", pipeline_response.http_response) + deserialized = self._deserialize("DryrunResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.ValidateOperationResult].from_continuation_token( + return LROPoller[_models.DryrunResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.ValidateOperationResult]( + return LROPoller[_models.DryrunResource]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @overload - def generate_configurations( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Optional[_models.ConfigurationInfo] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def generate_configurations( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def generate_configurations( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Optional[Union[_models.ConfigurationInfo, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Connector. + def delete_dryrun( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any + ) -> None: + """delete a dryrun job. - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The name of Azure region. Required. :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connection Info, including format, secret store, etc. Is either a - ConfigurationInfo type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo or IO[bytes] - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult + :param dryrun_name: The name of the DryrunResource. Required. + :type dryrun_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2048,33 +2033,18 @@ def generate_configurations( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConfigurationResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "ConfigurationInfo") - else: - _json = None + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_generate_configurations_request( - subscription_id=subscription_id, + _request = build_delete_dryrun_request( resource_group_name=resource_group_name, location=location, - connector_name=connector_name, + dryrun_name=dryrun_name, + subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -2087,14 +2057,10 @@ def generate_configurations( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConfigurationResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py index cc46f9171d39..0aef0907d3d0 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import ServiceLinkerManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +42,7 @@ _SERIALIZER.client_side_validation = False -def build_list_request(resource_uri: str, **kwargs: Any) -> HttpRequest: +def build_list_request(providers: str, resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -52,9 +50,10 @@ def build_list_request(resource_uri: str, **kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers") + _url = kwargs.pop("template_url", "/{resourceUri}/{providers}/{resourceUri}/connectors") path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "providers": _SERIALIZER.url("providers", providers, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -68,7 +67,7 @@ def build_list_request(resource_uri: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request(resource_uri: str, linker_name: str, **kwargs: Any) -> HttpRequest: +def build_get_request(providers: str, linkers: str, resource_uri: str, linker_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -76,9 +75,13 @@ def build_get_request(resource_uri: str, linker_name: str, **kwargs: Any) -> Htt accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}") + _url = kwargs.pop( + "template_url", "/{resourceUri}/{providers}/Microsoft.ServiceLinker/{linkers}/{resourceUri}/{linkerName}" + ) path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "providers": _SERIALIZER.url("providers", providers, "str"), + "linkers": _SERIALIZER.url("linkers", linkers, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str"), "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), } @@ -93,7 +96,9 @@ def build_get_request(resource_uri: str, linker_name: str, **kwargs: Any) -> Htt return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request(resource_uri: str, linker_name: str, **kwargs: Any) -> HttpRequest: +def build_create_or_update_request( + providers: str, linkers: str, resource_uri: str, linker_name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -102,9 +107,13 @@ def build_create_or_update_request(resource_uri: str, linker_name: str, **kwargs accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}") + _url = kwargs.pop( + "template_url", "/{resourceUri}/{providers}/Microsoft.ServiceLinker/{linkers}/{resourceUri}/{linkerName}" + ) path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "providers": _SERIALIZER.url("providers", providers, "str"), + "linkers": _SERIALIZER.url("linkers", linkers, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str"), "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), } @@ -121,17 +130,24 @@ def build_create_or_update_request(resource_uri: str, linker_name: str, **kwargs return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request(resource_uri: str, linker_name: str, **kwargs: Any) -> HttpRequest: +def build_update_request( + providers: str, linkers: str, resource_uri: str, linker_name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}") + _url = kwargs.pop( + "template_url", "/{resourceUri}/{providers}/Microsoft.ServiceLinker/{linkers}/{resourceUri}/{linkerName}" + ) path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "providers": _SERIALIZER.url("providers", providers, "str"), + "linkers": _SERIALIZER.url("linkers", linkers, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str"), "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), } @@ -141,23 +157,30 @@ def build_delete_request(resource_uri: str, linker_name: str, **kwargs: Any) -> _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request(resource_uri: str, linker_name: str, **kwargs: Any) -> HttpRequest: +def build_delete_request( + providers: str, linkers: str, resource_uri: str, linker_name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}") + _url = kwargs.pop( + "template_url", "/{resourceUri}/{providers}/Microsoft.ServiceLinker/{linkers}/{resourceUri}/{linkerName}" + ) path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "providers": _SERIALIZER.url("providers", providers, "str"), + "linkers": _SERIALIZER.url("linkers", linkers, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str"), "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), } @@ -167,14 +190,14 @@ def build_update_request(resource_uri: str, linker_name: str, **kwargs: Any) -> _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_request(resource_uri: str, linker_name: str, **kwargs: Any) -> HttpRequest: +def build_list_configurations_request( + providers: str, linkers: str, resource_uri: str, linker_name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -183,10 +206,13 @@ def build_validate_request(resource_uri: str, linker_name: str, **kwargs: Any) - # Construct URL _url = kwargs.pop( - "template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/validateLinker" + "template_url", + "/{resourceUri}/{providers}/Microsoft.ServiceLinker/{linkers}/{resourceUri}/{linkerName}/listConfigurations", ) path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "providers": _SERIALIZER.url("providers", providers, "str"), + "linkers": _SERIALIZER.url("linkers", linkers, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str"), "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), } @@ -201,7 +227,9 @@ def build_validate_request(resource_uri: str, linker_name: str, **kwargs: Any) - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_configurations_request(resource_uri: str, linker_name: str, **kwargs: Any) -> HttpRequest: +def build_validate_request( + providers: str, linkers: str, resource_uri: str, linker_name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -210,10 +238,13 @@ def build_list_configurations_request(resource_uri: str, linker_name: str, **kwa # Construct URL _url = kwargs.pop( - "template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/listConfigurations" - ) # pylint: disable=line-too-long + "template_url", + "/{resourceUri}/{providers}/Microsoft.ServiceLinker/{linkers}/{resourceUri}/{linkerName}/validateLinker", + ) path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "providers": _SERIALIZER.url("providers", providers, "str"), + "linkers": _SERIALIZER.url("linkers", linkers, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str"), "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), } @@ -242,16 +273,20 @@ class LinkerOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ServiceLinkerManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.LinkerResource"]: + def list(self, providers: str, resource_uri: str, **kwargs: Any) -> Iterable["_models.LinkerResource"]: """Returns list of Linkers which connects to the resource. which supports to config both application and target service during the resource provision. + :param providers: {resourceUri}. Required. + :type providers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -265,7 +300,7 @@ def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.LinkerReso api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -277,6 +312,7 @@ def prepare_request(next_link=None): if not next_link: _request = build_list_request( + providers=providers, resource_uri=resource_uri, api_version=api_version, headers=_headers, @@ -327,9 +363,15 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _models.LinkerResource: + def get( + self, providers: str, linkers: str, resource_uri: str, linker_name: str, **kwargs: Any + ) -> _models.LinkerResource: """Returns Linker resource for a given name. + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -339,7 +381,7 @@ def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _models.Lin :rtype: ~azure.mgmt.servicelinker.models.LinkerResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -354,6 +396,8 @@ def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _models.Lin cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) _request = build_get_request( + providers=providers, + linkers=linkers, resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, @@ -382,9 +426,15 @@ def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _models.Lin return deserialized # type: ignore def _create_or_update_initial( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerResource, IO[bytes]], **kwargs: Any + self, + providers: str, + linkers: str, + resource_uri: str, + linker_name: str, + parameters: Union[_models.LinkerResource, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -408,6 +458,8 @@ def _create_or_update_initial( _json = self._serialize.body(parameters, "LinkerResource") _request = build_create_or_update_request( + providers=providers, + linkers=linkers, resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, @@ -436,16 +488,25 @@ def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload def begin_create_or_update( self, + providers: str, + linkers: str, resource_uri: str, linker_name: str, parameters: _models.LinkerResource, @@ -455,6 +516,10 @@ def begin_create_or_update( ) -> LROPoller[_models.LinkerResource]: """Create or update Linker resource. + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -474,6 +539,8 @@ def begin_create_or_update( @overload def begin_create_or_update( self, + providers: str, + linkers: str, resource_uri: str, linker_name: str, parameters: IO[bytes], @@ -483,6 +550,10 @@ def begin_create_or_update( ) -> LROPoller[_models.LinkerResource]: """Create or update Linker resource. + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -501,10 +572,20 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerResource, IO[bytes]], **kwargs: Any + self, + providers: str, + linkers: str, + resource_uri: str, + linker_name: str, + parameters: Union[_models.LinkerResource, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.LinkerResource]: """Create or update Linker resource. + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -529,6 +610,8 @@ def begin_create_or_update( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._create_or_update_initial( + providers=providers, + linkers=linkers, resource_uri=resource_uri, linker_name=linker_name, parameters=parameters, @@ -567,8 +650,163 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial(self, resource_uri: str, linker_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + @overload + def update( + self, + providers: str, + linkers: str, + resource_uri: str, + linker_name: str, + parameters: _models.LinkerPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LinkerResource: + """Operation to update an existing Linker. + + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. Required. + :type resource_uri: str + :param linker_name: The name Linker resource. Required. + :type linker_name: str + :param parameters: Linker details. Required. + :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: LinkerResource or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.LinkerResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + providers: str, + linkers: str, + resource_uri: str, + linker_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LinkerResource: + """Operation to update an existing Linker. + + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. Required. + :type resource_uri: str + :param linker_name: The name Linker resource. Required. + :type linker_name: str + :param parameters: Linker details. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: LinkerResource or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.LinkerResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + providers: str, + linkers: str, + resource_uri: str, + linker_name: str, + parameters: Union[_models.LinkerPatch, IO[bytes]], + **kwargs: Any + ) -> _models.LinkerResource: + """Operation to update an existing Linker. + + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. Required. + :type resource_uri: str + :param linker_name: The name Linker resource. Required. + :type linker_name: str + :param parameters: Linker details. Is either a LinkerPatch type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch or IO[bytes] + :return: LinkerResource or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.LinkerResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "LinkerPatch") + + _request = build_update_request( + providers=providers, + linkers=linkers, + resource_uri=resource_uri, + linker_name=linker_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("LinkerResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, providers: str, linkers: str, resource_uri: str, linker_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -583,6 +821,8 @@ def _delete_initial(self, resource_uri: str, linker_name: str, **kwargs: Any) -> cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( + providers=providers, + linkers=linkers, resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, @@ -608,17 +848,30 @@ def _delete_initial(self, resource_uri: str, linker_name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def begin_delete(self, resource_uri: str, linker_name: str, **kwargs: Any) -> LROPoller[None]: + def begin_delete( + self, providers: str, linkers: str, resource_uri: str, linker_name: str, **kwargs: Any + ) -> LROPoller[None]: """Delete a Linker. + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -638,6 +891,8 @@ def begin_delete(self, resource_uri: str, linker_name: str, **kwargs: Any) -> LR cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( + providers=providers, + linkers=linkers, resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, @@ -670,10 +925,26 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _update_initial( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerPatch, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + @distributed_trace + def list_configurations( + self, providers: str, linkers: str, resource_uri: str, linker_name: str, **kwargs: Any + ) -> _models.ConfigurationResult: + """list source configurations for a Linker. + + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. Required. + :type resource_uri: str + :param linker_name: The name Linker resource. Required. + :type linker_name: str + :return: ConfigurationResult or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -681,182 +952,46 @@ def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "LinkerPatch") + cls: ClsType[_models.ConfigurationResult] = kwargs.pop("cls", None) - _request = build_update_request( + _request = build_list_configurations_request( + providers=providers, + linkers=linkers, resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("ConfigurationResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def begin_update( - self, - resource_uri: str, - linker_name: str, - parameters: _models.LinkerPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Linker details. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_uri: str, - linker_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Linker details. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerPatch, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Linker details. Is either a LinkerPatch type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch or IO[bytes] - :return: An instance of LROPoller that returns either LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_uri=resource_uri, - linker_name=linker_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LinkerResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.LinkerResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.LinkerResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_initial(self, resource_uri: str, linker_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _validate_initial( + self, providers: str, linkers: str, resource_uri: str, linker_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -871,6 +1006,8 @@ def _validate_initial(self, resource_uri: str, linker_name: str, **kwargs: Any) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_validate_request( + providers=providers, + linkers=linkers, resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, @@ -896,19 +1033,28 @@ def _validate_initial(self, resource_uri: str, linker_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace def begin_validate( - self, resource_uri: str, linker_name: str, **kwargs: Any + self, providers: str, linkers: str, resource_uri: str, linker_name: str, **kwargs: Any ) -> LROPoller[_models.ValidateOperationResult]: """Validate a Linker. + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -929,6 +1075,8 @@ def begin_validate( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._validate_initial( + providers=providers, + linkers=linkers, resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, @@ -964,58 +1112,3 @@ def get_long_running_output(pipeline_response): return LROPoller[_models.ValidateOperationResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - - @distributed_trace - def list_configurations(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _models.ConfigurationResult: - """list source configurations for a Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ConfigurationResult] = kwargs.pop("cls", None) - - _request = build_list_configurations_request( - resource_uri=resource_uri, - linker_name=linker_name, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ConfigurationResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linkers_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linkers_operations.py index 9dbe340d891c..11abd7c2ba6f 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linkers_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linkers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import ServiceLinkerManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +42,7 @@ _SERIALIZER.client_side_validation = False -def build_list_dryrun_request(resource_uri: str, **kwargs: Any) -> HttpRequest: +def build_list_dryrun_request(providers: str, resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -52,9 +50,10 @@ def build_list_dryrun_request(resource_uri: str, **kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns") + _url = kwargs.pop("template_url", "/{resourceUri}/{providers}/{resourceUri}/dryruns") path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "providers": _SERIALIZER.url("providers", providers, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -68,7 +67,9 @@ def build_list_dryrun_request(resource_uri: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_dryrun_request(resource_uri: str, dryrun_name: str, **kwargs: Any) -> HttpRequest: +def build_get_dryrun_request( + providers: str, dryruns: str, resource_uri: str, dryrun_name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -76,9 +77,13 @@ def build_get_dryrun_request(resource_uri: str, dryrun_name: str, **kwargs: Any) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}") + _url = kwargs.pop( + "template_url", "/{resourceUri}/{providers}/Microsoft.ServiceLinker/{dryruns}/{resourceUri}/{dryrunName}" + ) path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "providers": _SERIALIZER.url("providers", providers, "str"), + "dryruns": _SERIALIZER.url("dryruns", dryruns, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str"), "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), } @@ -93,7 +98,9 @@ def build_get_dryrun_request(resource_uri: str, dryrun_name: str, **kwargs: Any) return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_dryrun_request(resource_uri: str, dryrun_name: str, **kwargs: Any) -> HttpRequest: +def build_create_dryrun_request( + providers: str, dryruns: str, resource_uri: str, dryrun_name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -102,9 +109,13 @@ def build_create_dryrun_request(resource_uri: str, dryrun_name: str, **kwargs: A accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}") + _url = kwargs.pop( + "template_url", "/{resourceUri}/{providers}/Microsoft.ServiceLinker/{dryruns}/{resourceUri}/{dryrunName}" + ) path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "providers": _SERIALIZER.url("providers", providers, "str"), + "dryruns": _SERIALIZER.url("dryruns", dryruns, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str"), "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), } @@ -121,7 +132,9 @@ def build_create_dryrun_request(resource_uri: str, dryrun_name: str, **kwargs: A return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_dryrun_request(resource_uri: str, dryrun_name: str, **kwargs: Any) -> HttpRequest: +def build_update_dryrun_request( + providers: str, dryruns: str, resource_uri: str, dryrun_name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -130,9 +143,13 @@ def build_update_dryrun_request(resource_uri: str, dryrun_name: str, **kwargs: A accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}") + _url = kwargs.pop( + "template_url", "/{resourceUri}/{providers}/Microsoft.ServiceLinker/{dryruns}/{resourceUri}/{dryrunName}" + ) path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "providers": _SERIALIZER.url("providers", providers, "str"), + "dryruns": _SERIALIZER.url("dryruns", dryruns, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str"), "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), } @@ -149,7 +166,9 @@ def build_update_dryrun_request(resource_uri: str, dryrun_name: str, **kwargs: A return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_dryrun_request(resource_uri: str, dryrun_name: str, **kwargs: Any) -> HttpRequest: +def build_delete_dryrun_request( + providers: str, dryruns: str, resource_uri: str, dryrun_name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -157,9 +176,13 @@ def build_delete_dryrun_request(resource_uri: str, dryrun_name: str, **kwargs: A accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}") + _url = kwargs.pop( + "template_url", "/{resourceUri}/{providers}/Microsoft.ServiceLinker/{dryruns}/{resourceUri}/{dryrunName}" + ) path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "providers": _SERIALIZER.url("providers", providers, "str"), + "dryruns": _SERIALIZER.url("dryruns", dryruns, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str"), "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), } @@ -174,7 +197,9 @@ def build_delete_dryrun_request(resource_uri: str, dryrun_name: str, **kwargs: A return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_generate_configurations_request(resource_uri: str, linker_name: str, **kwargs: Any) -> HttpRequest: +def build_generate_configurations_request( + providers: str, linkers: str, resource_uri: str, linker_name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -184,10 +209,13 @@ def build_generate_configurations_request(resource_uri: str, linker_name: str, * # Construct URL _url = kwargs.pop( - "template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/generateConfigurations" - ) # pylint: disable=line-too-long + "template_url", + "/{resourceUri}/{providers}/Microsoft.ServiceLinker/{linkers}/{resourceUri}/{linkerName}/generateConfigurations", + ) path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "providers": _SERIALIZER.url("providers", providers, "str"), + "linkers": _SERIALIZER.url("linkers", linkers, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str"), "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), } @@ -214,7 +242,7 @@ def build_list_dapr_configurations_request(resource_uri: str, **kwargs: Any) -> # Construct URL _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/daprConfigurations") path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -242,15 +270,19 @@ class LinkersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ServiceLinkerManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_dryrun(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.DryrunResource"]: + def list_dryrun(self, providers: str, resource_uri: str, **kwargs: Any) -> Iterable["_models.DryrunResource"]: """list dryrun jobs. + :param providers: {resourceUri}. Required. + :type providers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -264,7 +296,7 @@ def list_dryrun(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.Dry api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DryrunList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -276,6 +308,7 @@ def prepare_request(next_link=None): if not next_link: _request = build_list_dryrun_request( + providers=providers, resource_uri=resource_uri, api_version=api_version, headers=_headers, @@ -326,9 +359,15 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def get_dryrun(self, resource_uri: str, dryrun_name: str, **kwargs: Any) -> _models.DryrunResource: + def get_dryrun( + self, providers: str, dryruns: str, resource_uri: str, dryrun_name: str, **kwargs: Any + ) -> _models.DryrunResource: """get a dryrun job. + :param providers: {resourceUri}. Required. + :type providers: str + :param dryruns: The name of the DryrunResource. Required. + :type dryruns: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -338,7 +377,7 @@ def get_dryrun(self, resource_uri: str, dryrun_name: str, **kwargs: Any) -> _mod :rtype: ~azure.mgmt.servicelinker.models.DryrunResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,6 +392,8 @@ def get_dryrun(self, resource_uri: str, dryrun_name: str, **kwargs: Any) -> _mod cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) _request = build_get_dryrun_request( + providers=providers, + dryruns=dryruns, resource_uri=resource_uri, dryrun_name=dryrun_name, api_version=api_version, @@ -381,9 +422,15 @@ def get_dryrun(self, resource_uri: str, dryrun_name: str, **kwargs: Any) -> _mod return deserialized # type: ignore def _create_dryrun_initial( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunResource, IO[bytes]], **kwargs: Any + self, + providers: str, + dryruns: str, + resource_uri: str, + dryrun_name: str, + parameters: Union[_models.DryrunResource, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -407,6 +454,8 @@ def _create_dryrun_initial( _json = self._serialize.body(parameters, "DryrunResource") _request = build_create_dryrun_request( + providers=providers, + dryruns=dryruns, resource_uri=resource_uri, dryrun_name=dryrun_name, api_version=api_version, @@ -435,16 +484,25 @@ def _create_dryrun_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload def begin_create_dryrun( self, + providers: str, + dryruns: str, resource_uri: str, dryrun_name: str, parameters: _models.DryrunResource, @@ -454,6 +512,10 @@ def begin_create_dryrun( ) -> LROPoller[_models.DryrunResource]: """create a dryrun job to do necessary check before actual creation. + :param providers: {resourceUri}. Required. + :type providers: str + :param dryruns: The name of the DryrunResource. Required. + :type dryruns: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -473,6 +535,8 @@ def begin_create_dryrun( @overload def begin_create_dryrun( self, + providers: str, + dryruns: str, resource_uri: str, dryrun_name: str, parameters: IO[bytes], @@ -482,6 +546,10 @@ def begin_create_dryrun( ) -> LROPoller[_models.DryrunResource]: """create a dryrun job to do necessary check before actual creation. + :param providers: {resourceUri}. Required. + :type providers: str + :param dryruns: The name of the DryrunResource. Required. + :type dryruns: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -500,10 +568,20 @@ def begin_create_dryrun( @distributed_trace def begin_create_dryrun( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunResource, IO[bytes]], **kwargs: Any + self, + providers: str, + dryruns: str, + resource_uri: str, + dryrun_name: str, + parameters: Union[_models.DryrunResource, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.DryrunResource]: """create a dryrun job to do necessary check before actual creation. + :param providers: {resourceUri}. Required. + :type providers: str + :param dryruns: The name of the DryrunResource. Required. + :type dryruns: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -528,6 +606,8 @@ def begin_create_dryrun( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._create_dryrun_initial( + providers=providers, + dryruns=dryruns, resource_uri=resource_uri, dryrun_name=dryrun_name, parameters=parameters, @@ -567,9 +647,15 @@ def get_long_running_output(pipeline_response): ) def _update_dryrun_initial( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunPatch, IO[bytes]], **kwargs: Any + self, + providers: str, + dryruns: str, + resource_uri: str, + dryrun_name: str, + parameters: Union[_models.DryrunPatch, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -593,6 +679,8 @@ def _update_dryrun_initial( _json = self._serialize.body(parameters, "DryrunPatch") _request = build_update_dryrun_request( + providers=providers, + dryruns=dryruns, resource_uri=resource_uri, dryrun_name=dryrun_name, api_version=api_version, @@ -621,16 +709,25 @@ def _update_dryrun_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload def begin_update_dryrun( self, + providers: str, + dryruns: str, resource_uri: str, dryrun_name: str, parameters: _models.DryrunPatch, @@ -640,6 +737,10 @@ def begin_update_dryrun( ) -> LROPoller[_models.DryrunResource]: """add a dryrun job to do necessary check before actual creation. + :param providers: {resourceUri}. Required. + :type providers: str + :param dryruns: The name of the DryrunResource. Required. + :type dryruns: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -659,6 +760,8 @@ def begin_update_dryrun( @overload def begin_update_dryrun( self, + providers: str, + dryruns: str, resource_uri: str, dryrun_name: str, parameters: IO[bytes], @@ -668,6 +771,10 @@ def begin_update_dryrun( ) -> LROPoller[_models.DryrunResource]: """add a dryrun job to do necessary check before actual creation. + :param providers: {resourceUri}. Required. + :type providers: str + :param dryruns: The name of the DryrunResource. Required. + :type dryruns: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -686,10 +793,20 @@ def begin_update_dryrun( @distributed_trace def begin_update_dryrun( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunPatch, IO[bytes]], **kwargs: Any + self, + providers: str, + dryruns: str, + resource_uri: str, + dryrun_name: str, + parameters: Union[_models.DryrunPatch, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.DryrunResource]: """add a dryrun job to do necessary check before actual creation. + :param providers: {resourceUri}. Required. + :type providers: str + :param dryruns: The name of the DryrunResource. Required. + :type dryruns: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -713,6 +830,8 @@ def begin_update_dryrun( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._update_dryrun_initial( + providers=providers, + dryruns=dryruns, resource_uri=resource_uri, dryrun_name=dryrun_name, parameters=parameters, @@ -734,7 +853,7 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) @@ -753,10 +872,14 @@ def get_long_running_output(pipeline_response): @distributed_trace def delete_dryrun( # pylint: disable=inconsistent-return-statements - self, resource_uri: str, dryrun_name: str, **kwargs: Any + self, providers: str, dryruns: str, resource_uri: str, dryrun_name: str, **kwargs: Any ) -> None: """delete a dryrun job. + :param providers: {resourceUri}. Required. + :type providers: str + :param dryruns: The name of the DryrunResource. Required. + :type dryruns: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -766,7 +889,7 @@ def delete_dryrun( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -781,6 +904,8 @@ def delete_dryrun( # pylint: disable=inconsistent-return-statements cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_dryrun_request( + providers=providers, + dryruns=dryruns, resource_uri=resource_uri, dryrun_name=dryrun_name, api_version=api_version, @@ -807,6 +932,8 @@ def delete_dryrun( # pylint: disable=inconsistent-return-statements @overload def generate_configurations( self, + providers: str, + linkers: str, resource_uri: str, linker_name: str, parameters: Optional[_models.ConfigurationInfo] = None, @@ -816,6 +943,10 @@ def generate_configurations( ) -> _models.ConfigurationResult: """Generate configurations for a Linker. + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -834,6 +965,8 @@ def generate_configurations( @overload def generate_configurations( self, + providers: str, + linkers: str, resource_uri: str, linker_name: str, parameters: Optional[IO[bytes]] = None, @@ -843,6 +976,10 @@ def generate_configurations( ) -> _models.ConfigurationResult: """Generate configurations for a Linker. + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -861,6 +998,8 @@ def generate_configurations( @distributed_trace def generate_configurations( self, + providers: str, + linkers: str, resource_uri: str, linker_name: str, parameters: Optional[Union[_models.ConfigurationInfo, IO[bytes]]] = None, @@ -868,6 +1007,10 @@ def generate_configurations( ) -> _models.ConfigurationResult: """Generate configurations for a Linker. + :param providers: {resourceUri}. Required. + :type providers: str + :param linkers: The name of the LinkerResource. Required. + :type linkers: str :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str @@ -880,7 +1023,7 @@ def generate_configurations( :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -907,6 +1050,8 @@ def generate_configurations( _json = None _request = build_generate_configurations_request( + providers=providers, + linkers=linkers, resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, @@ -958,7 +1103,7 @@ def list_dapr_configurations( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprConfigurationList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py index 0259c24f99ee..bb5e4ddc8ff1 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,12 +26,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import ServiceLinkerManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -72,14 +69,16 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ServiceLinkerManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: - """Lists the available ServiceLinker REST API operations. + """List the operations for the provider. :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.Operation] @@ -91,7 +90,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/configuration_names_list.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/configuration_names_list.py index 5b5c65ae3fe5..d73281b7f523 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/configuration_names_list.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/configuration_names_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,6 +28,7 @@ def main(): client = ServiceLinkerManagementClient( credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", ) response = client.configuration_names.list() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_create.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_create.py index 151c58b5910c..16dd8b16d6fa 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_create.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_create.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,10 +28,10 @@ def main(): client = ServiceLinkerManagementClient( credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.connector.begin_create_dryrun( - subscription_id="00000000-0000-0000-0000-000000000000", resource_group_name="test-rg", location="westus", dryrun_name="dryrunName", diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_delete.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_delete.py index c53ff293faa8..a3bbf99d71b9 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_delete.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_delete.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,10 +28,10 @@ def main(): client = ServiceLinkerManagementClient( credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", ) client.connector.delete_dryrun( - subscription_id="00000000-0000-0000-0000-000000000000", resource_group_name="test-rg", location="westus", dryrun_name="dryrunName", diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_get.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_get.py index 857088da4af8..8e172bceafc8 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_get.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,10 +28,10 @@ def main(): client = ServiceLinkerManagementClient( credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.connector.get_dryrun( - subscription_id="00000000-0000-0000-0000-000000000000", resource_group_name="test-rg", location="westus", dryrun_name="dryrunName", diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_list.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_list.py index a39ba8807504..96ad5239dd75 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_list.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,10 +28,10 @@ def main(): client = ServiceLinkerManagementClient( credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.connector.list_dryrun( - subscription_id="00000000-0000-0000-0000-000000000000", resource_group_name="test-rg", location="westus", ) diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_update.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_update.py index 5096981cdc2a..5b92c48cea2f 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_update.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,10 +28,10 @@ def main(): client = ServiceLinkerManagementClient( credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.connector.begin_update_dryrun( - subscription_id="00000000-0000-0000-0000-000000000000", resource_group_name="test-rg", location="westus", dryrun_name="dryrunName", diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_list.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_list.py index 161448d6ebf3..e2d581ad0bb4 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_list.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,10 +28,10 @@ def main(): client = ServiceLinkerManagementClient( credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.connector.list( - subscription_id="00000000-0000-0000-0000-000000000000", resource_group_name="test-rg", location="westus", ) diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connectors.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connectors.py index 73a3169f4cf7..e9356f91af25 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connectors.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connectors.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,10 +28,10 @@ def main(): client = ServiceLinkerManagementClient( credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.connector.get( - subscription_id="00000000-0000-0000-0000-000000000000", resource_group_name="test-rg", location="westus", connector_name="connectorName", diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_connector.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_connector.py index bec798058acf..cb9683712d29 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_connector.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_connector.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,10 +28,10 @@ def main(): client = ServiceLinkerManagementClient( credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", ) client.connector.begin_delete( - subscription_id="00000000-0000-0000-0000-000000000000", resource_group_name="test-rg", location="westus", connector_name="connectorName", diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_dryrun.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_dryrun.py deleted file mode 100644 index 481c5daf5ec0..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_dryrun.py +++ /dev/null @@ -1,40 +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 azure.identity import DefaultAzureCredential - -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python delete_dryrun.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - client.linkers.delete_dryrun( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - dryrun_name="dryrunName", - ) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2024-07-01-preview/examples/DeleteDryrun.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_linker.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_linker.py deleted file mode 100644 index 72d189718004..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_linker.py +++ /dev/null @@ -1,40 +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 azure.identity import DefaultAzureCredential - -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python delete_linker.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - client.linker.begin_delete( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - linker_name="linkName", - ).result() - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2024-07-01-preview/examples/DeleteLinker.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/generate_configurations.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/generate_configurations.py index b26343ab1d20..1590afae806d 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/generate_configurations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/generate_configurations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,10 +28,10 @@ def main(): client = ServiceLinkerManagementClient( credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.connector.generate_configurations( - subscription_id="00000000-0000-0000-0000-000000000000", resource_group_name="test-rg", location="westus", connector_name="connectorName", diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_configurations.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_configurations.py deleted file mode 100644 index 779dea6db532..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_configurations.py +++ /dev/null @@ -1,41 +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 azure.identity import DefaultAzureCredential - -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python get_configurations.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linker.list_configurations( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.App/containerApps/test-app", - linker_name="linkName", - ) - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2024-07-01-preview/examples/GetConfigurations.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dapr_configurations.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dapr_configurations.py index 8d388a74cc14..0f092705ff09 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dapr_configurations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dapr_configurations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,6 +28,7 @@ def main(): client = ServiceLinkerManagementClient( credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", ) response = client.linkers.list_dapr_configurations( diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dryrun.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dryrun.py deleted file mode 100644 index 81e9eb1848bd..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dryrun.py +++ /dev/null @@ -1,41 +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 azure.identity import DefaultAzureCredential - -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python get_dryrun.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linkers.get_dryrun( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - dryrun_name="dryrunName", - ) - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2024-07-01-preview/examples/GetDryrun.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker.py deleted file mode 100644 index 22bd38147c1d..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker.py +++ /dev/null @@ -1,41 +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 azure.identity import DefaultAzureCredential - -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python linker.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linker.get( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - linker_name="linkName", - ) - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2024-07-01-preview/examples/Linker.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_generate_configurations.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_generate_configurations.py deleted file mode 100644 index f67ecb95747f..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_generate_configurations.py +++ /dev/null @@ -1,41 +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 azure.identity import DefaultAzureCredential - -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python linker_generate_configurations.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linkers.generate_configurations( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - linker_name="linkName", - ) - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2024-07-01-preview/examples/LinkerGenerateConfigurations.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_list.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_list.py deleted file mode 100644 index 3e5cb067e46b..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_list.py +++ /dev/null @@ -1,41 +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 azure.identity import DefaultAzureCredential - -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python linker_list.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linker.list( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2024-07-01-preview/examples/LinkerList.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/list_dryrun.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/list_dryrun.py deleted file mode 100644 index 924b975a31dd..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/list_dryrun.py +++ /dev/null @@ -1,41 +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 azure.identity import DefaultAzureCredential - -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python list_dryrun.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linkers.list_dryrun( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2024-07-01-preview/examples/ListDryrun.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/operations_list.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/operations_list.py index cd50768982fb..758e1eab6cf9 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/operations_list.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/operations_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,6 +28,7 @@ def main(): client = ServiceLinkerManagementClient( credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", ) response = client.operations.list() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_connector.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_connector.py index 4eeb225e0fc2..11327b4befcf 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_connector.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_connector.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,10 +28,10 @@ def main(): client = ServiceLinkerManagementClient( credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.connector.begin_update( - subscription_id="00000000-0000-0000-0000-000000000000", resource_group_name="test-rg", location="westus", connector_name="connectorName", diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_dryrun.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_dryrun.py deleted file mode 100644 index acd25cc71ae1..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_dryrun.py +++ /dev/null @@ -1,57 +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 azure.identity import DefaultAzureCredential - -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python patch_dryrun.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linkers.begin_update_dryrun( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - dryrun_name="dryrunName", - parameters={ - "properties": { - "parameters": { - "actionName": "createOrUpdate", - "authInfo": { - "authType": "secret", - "name": "name", - "secretInfo": {"secretType": "rawValue", "value": "secret"}, - }, - "targetService": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db", - "type": "AzureResource", - }, - } - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2024-07-01-preview/examples/PatchDryrun.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_linker.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_linker.py deleted file mode 100644 index fe538cee0606..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_linker.py +++ /dev/null @@ -1,55 +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 azure.identity import DefaultAzureCredential - -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python patch_linker.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linker.begin_update( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - linker_name="linkName", - parameters={ - "properties": { - "authInfo": { - "authType": "servicePrincipalSecret", - "clientId": "name", - "principalId": "id", - "secret": "secret", - }, - "targetService": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db", - "type": "AzureResource", - }, - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2024-07-01-preview/examples/PatchLinker.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_connector.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_connector.py index f1868b6127df..39396c2340a1 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_connector.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_connector.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,10 +28,10 @@ def main(): client = ServiceLinkerManagementClient( credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.connector.begin_create_or_update( - subscription_id="00000000-0000-0000-0000-000000000000", resource_group_name="test-rg", location="westus", connector_name="connectorName", diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_dryrun.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_dryrun.py deleted file mode 100644 index bc141b91f2ce..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_dryrun.py +++ /dev/null @@ -1,57 +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 azure.identity import DefaultAzureCredential - -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python put_dryrun.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linkers.begin_create_dryrun( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - dryrun_name="dryrunName", - parameters={ - "properties": { - "parameters": { - "actionName": "createOrUpdate", - "authInfo": { - "authType": "secret", - "name": "name", - "secretInfo": {"secretType": "rawValue", "value": "secret"}, - }, - "targetService": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db", - "type": "AzureResource", - }, - } - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2024-07-01-preview/examples/PutDryrun.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_linker.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_linker.py deleted file mode 100644 index 0b84a95cbad8..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_linker.py +++ /dev/null @@ -1,55 +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 azure.identity import DefaultAzureCredential - -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python put_linker.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linker.begin_create_or_update( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - linker_name="linkName", - parameters={ - "properties": { - "authInfo": { - "authType": "secret", - "name": "name", - "secretInfo": {"secretType": "rawValue", "value": "secret"}, - }, - "targetService": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DBforPostgreSQL/servers/test-pg/databases/test-db", - "type": "AzureResource", - }, - "vNetSolution": {"type": "serviceEndpoint"}, - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2024-07-01-preview/examples/PutLinker.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_connector_success.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_connector_success.py index 4e0750a1e8b3..82ad165549a2 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_connector_success.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_connector_success.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,10 +28,10 @@ def main(): client = ServiceLinkerManagementClient( credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.connector.begin_validate( - subscription_id="00000000-0000-0000-0000-000000000000", resource_group_name="test-rg", location="westus", connector_name="connectorName", diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_linker_success.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_linker_success.py deleted file mode 100644 index c24265c42058..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_linker_success.py +++ /dev/null @@ -1,41 +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 azure.identity import DefaultAzureCredential - -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python validate_linker_success.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linker.begin_validate( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - linker_name="linkName", - ).result() - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2024-07-01-preview/examples/ValidateLinkerSuccess.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/conftest.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/conftest.py index 74ab781506a7..2c862c8fb832 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/conftest.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/conftest.py @@ -18,7 +18,7 @@ load_dotenv() -# aovid record sensitive identity information in recordings +# For security, please avoid record sensitive identity information in recordings @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): servicelinkermanagement_subscription_id = os.environ.get( diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_configuration_names_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_configuration_names_operations.py index 06900e621739..26127a38ff10 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_configuration_names_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_configuration_names_operations.py @@ -20,7 +20,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_configuration_names_list(self, resource_group): response = self.client.configuration_names.list( api_version="2024-07-01-preview", ) diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_configuration_names_operations_async.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_configuration_names_operations_async.py index c466e824043d..8dc64abdf5cb 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_configuration_names_operations_async.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_configuration_names_operations_async.py @@ -21,7 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_configuration_names_list(self, resource_group): response = self.client.configuration_names.list( api_version="2024-07-01-preview", ) diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_connector_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_connector_operations.py index 140479ee3996..ccb11a7abe15 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_connector_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_connector_operations.py @@ -20,105 +20,8 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_dryrun(self, resource_group): - response = self.client.connector.list_dryrun( - subscription_id="str", - resource_group_name=resource_group.name, - location="str", - api_version="2024-07-01-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_get_dryrun(self, resource_group): - response = self.client.connector.get_dryrun( - subscription_id="str", - resource_group_name=resource_group.name, - location="str", - dryrun_name="str", - api_version="2024-07-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_begin_create_dryrun(self, resource_group): - response = self.client.connector.begin_create_dryrun( - subscription_id="str", - resource_group_name=resource_group.name, - location="str", - dryrun_name="str", - parameters={ - "id": "str", - "name": "str", - "operationPreviews": [ - {"action": "str", "description": "str", "name": "str", "operationType": "str", "scope": "str"} - ], - "parameters": "dryrun_parameters", - "prerequisiteResults": ["dryrun_prerequisite_result"], - "provisioningState": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - }, - api_version="2024-07-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_begin_update_dryrun(self, resource_group): - response = self.client.connector.begin_update_dryrun( - subscription_id="str", - resource_group_name=resource_group.name, - location="str", - dryrun_name="str", - parameters={ - "operationPreviews": [ - {"action": "str", "description": "str", "name": "str", "operationType": "str", "scope": "str"} - ], - "parameters": "dryrun_parameters", - "prerequisiteResults": ["dryrun_prerequisite_result"], - "provisioningState": "str", - }, - api_version="2024-07-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_delete_dryrun(self, resource_group): - response = self.client.connector.delete_dryrun( - subscription_id="str", - resource_group_name=resource_group.name, - location="str", - dryrun_name="str", - api_version="2024-07-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_list(self, resource_group): + def test_connector_list(self, resource_group): response = self.client.connector.list( - subscription_id="str", resource_group_name=resource_group.name, location="str", api_version="2024-07-01-preview", @@ -129,9 +32,8 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_connector_get(self, resource_group): response = self.client.connector.get( - subscription_id="str", resource_group_name=resource_group.name, location="str", connector_name="str", @@ -143,9 +45,8 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_connector_begin_create_or_update(self, resource_group): response = self.client.connector.begin_create_or_update( - subscription_id="str", resource_group_name=resource_group.name, location="str", connector_name="str", @@ -201,23 +102,8 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): - response = self.client.connector.begin_delete( - subscription_id="str", - resource_group_name=resource_group.name, - location="str", - connector_name="str", - api_version="2024-07-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_begin_update(self, resource_group): + def test_connector_begin_update(self, resource_group): response = self.client.connector.begin_update( - subscription_id="str", resource_group_name=resource_group.name, location="str", connector_name="str", @@ -262,9 +148,8 @@ def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_validate(self, resource_group): - response = self.client.connector.begin_validate( - subscription_id="str", + def test_connector_begin_delete(self, resource_group): + response = self.client.connector.begin_delete( resource_group_name=resource_group.name, location="str", connector_name="str", @@ -276,9 +161,8 @@ def test_begin_validate(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_generate_configurations(self, resource_group): + def test_connector_generate_configurations(self, resource_group): response = self.client.connector.generate_configurations( - subscription_id="str", resource_group_name=resource_group.name, location="str", connector_name="str", @@ -287,3 +171,107 @@ def test_generate_configurations(self, resource_group): # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_connector_begin_validate(self, resource_group): + response = self.client.connector.begin_validate( + resource_group_name=resource_group.name, + location="str", + connector_name="str", + api_version="2024-07-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_connector_list_dryrun(self, resource_group): + response = self.client.connector.list_dryrun( + resource_group_name=resource_group.name, + location="str", + api_version="2024-07-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_connector_get_dryrun(self, resource_group): + response = self.client.connector.get_dryrun( + resource_group_name=resource_group.name, + location="str", + dryrun_name="str", + api_version="2024-07-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_connector_begin_create_dryrun(self, resource_group): + response = self.client.connector.begin_create_dryrun( + resource_group_name=resource_group.name, + location="str", + dryrun_name="str", + parameters={ + "id": "str", + "name": "str", + "operationPreviews": [ + {"action": "str", "description": "str", "name": "str", "operationType": "str", "scope": "str"} + ], + "parameters": "dryrun_parameters", + "prerequisiteResults": ["dryrun_prerequisite_result"], + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-07-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_connector_begin_update_dryrun(self, resource_group): + response = self.client.connector.begin_update_dryrun( + resource_group_name=resource_group.name, + location="str", + dryrun_name="str", + parameters={ + "operationPreviews": [ + {"action": "str", "description": "str", "name": "str", "operationType": "str", "scope": "str"} + ], + "parameters": "dryrun_parameters", + "prerequisiteResults": ["dryrun_prerequisite_result"], + "provisioningState": "str", + }, + api_version="2024-07-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_connector_delete_dryrun(self, resource_group): + response = self.client.connector.delete_dryrun( + resource_group_name=resource_group.name, + location="str", + dryrun_name="str", + api_version="2024-07-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_connector_operations_async.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_connector_operations_async.py index 8c26fe7c677e..df2d5d24e3c1 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_connector_operations_async.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_connector_operations_async.py @@ -21,109 +21,8 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_dryrun(self, resource_group): - response = self.client.connector.list_dryrun( - subscription_id="str", - resource_group_name=resource_group.name, - location="str", - api_version="2024-07-01-preview", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_get_dryrun(self, resource_group): - response = await self.client.connector.get_dryrun( - subscription_id="str", - resource_group_name=resource_group.name, - location="str", - dryrun_name="str", - api_version="2024-07-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_begin_create_dryrun(self, resource_group): - response = await ( - await self.client.connector.begin_create_dryrun( - subscription_id="str", - resource_group_name=resource_group.name, - location="str", - dryrun_name="str", - parameters={ - "id": "str", - "name": "str", - "operationPreviews": [ - {"action": "str", "description": "str", "name": "str", "operationType": "str", "scope": "str"} - ], - "parameters": "dryrun_parameters", - "prerequisiteResults": ["dryrun_prerequisite_result"], - "provisioningState": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - }, - api_version="2024-07-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_begin_update_dryrun(self, resource_group): - response = await ( - await self.client.connector.begin_update_dryrun( - subscription_id="str", - resource_group_name=resource_group.name, - location="str", - dryrun_name="str", - parameters={ - "operationPreviews": [ - {"action": "str", "description": "str", "name": "str", "operationType": "str", "scope": "str"} - ], - "parameters": "dryrun_parameters", - "prerequisiteResults": ["dryrun_prerequisite_result"], - "provisioningState": "str", - }, - api_version="2024-07-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_delete_dryrun(self, resource_group): - response = await self.client.connector.delete_dryrun( - subscription_id="str", - resource_group_name=resource_group.name, - location="str", - dryrun_name="str", - api_version="2024-07-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_connector_list(self, resource_group): response = self.client.connector.list( - subscription_id="str", resource_group_name=resource_group.name, location="str", api_version="2024-07-01-preview", @@ -134,9 +33,8 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_connector_get(self, resource_group): response = await self.client.connector.get( - subscription_id="str", resource_group_name=resource_group.name, location="str", connector_name="str", @@ -148,10 +46,9 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_connector_begin_create_or_update(self, resource_group): response = await ( await self.client.connector.begin_create_or_update( - subscription_id="str", resource_group_name=resource_group.name, location="str", connector_name="str", @@ -214,26 +111,9 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): - response = await ( - await self.client.connector.begin_delete( - subscription_id="str", - resource_group_name=resource_group.name, - location="str", - connector_name="str", - api_version="2024-07-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_begin_update(self, resource_group): + async def test_connector_begin_update(self, resource_group): response = await ( await self.client.connector.begin_update( - subscription_id="str", resource_group_name=resource_group.name, location="str", connector_name="str", @@ -285,10 +165,9 @@ async def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_validate(self, resource_group): + async def test_connector_begin_delete(self, resource_group): response = await ( - await self.client.connector.begin_validate( - subscription_id="str", + await self.client.connector.begin_delete( resource_group_name=resource_group.name, location="str", connector_name="str", @@ -301,9 +180,8 @@ async def test_begin_validate(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_generate_configurations(self, resource_group): + async def test_connector_generate_configurations(self, resource_group): response = await self.client.connector.generate_configurations( - subscription_id="str", resource_group_name=resource_group.name, location="str", connector_name="str", @@ -312,3 +190,113 @@ async def test_generate_configurations(self, resource_group): # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_connector_begin_validate(self, resource_group): + response = await ( + await self.client.connector.begin_validate( + resource_group_name=resource_group.name, + location="str", + connector_name="str", + api_version="2024-07-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_connector_list_dryrun(self, resource_group): + response = self.client.connector.list_dryrun( + resource_group_name=resource_group.name, + location="str", + api_version="2024-07-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_connector_get_dryrun(self, resource_group): + response = await self.client.connector.get_dryrun( + resource_group_name=resource_group.name, + location="str", + dryrun_name="str", + api_version="2024-07-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_connector_begin_create_dryrun(self, resource_group): + response = await ( + await self.client.connector.begin_create_dryrun( + resource_group_name=resource_group.name, + location="str", + dryrun_name="str", + parameters={ + "id": "str", + "name": "str", + "operationPreviews": [ + {"action": "str", "description": "str", "name": "str", "operationType": "str", "scope": "str"} + ], + "parameters": "dryrun_parameters", + "prerequisiteResults": ["dryrun_prerequisite_result"], + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-07-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_connector_begin_update_dryrun(self, resource_group): + response = await ( + await self.client.connector.begin_update_dryrun( + resource_group_name=resource_group.name, + location="str", + dryrun_name="str", + parameters={ + "operationPreviews": [ + {"action": "str", "description": "str", "name": "str", "operationType": "str", "scope": "str"} + ], + "parameters": "dryrun_parameters", + "prerequisiteResults": ["dryrun_prerequisite_result"], + "provisioningState": "str", + }, + api_version="2024-07-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_connector_delete_dryrun(self, resource_group): + response = await self.client.connector.delete_dryrun( + resource_group_name=resource_group.name, + location="str", + dryrun_name="str", + api_version="2024-07-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_linker_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_linker_operations.py index 70f75028cccf..3ec48d572a58 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_linker_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_linker_operations.py @@ -20,8 +20,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_linker_list(self, resource_group): response = self.client.linker.list( + providers="str", resource_uri="str", api_version="2024-07-01-preview", ) @@ -31,8 +32,10 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_linker_get(self, resource_group): response = self.client.linker.get( + providers="str", + linkers="str", resource_uri="str", linker_name="str", api_version="2024-07-01-preview", @@ -43,8 +46,10 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_linker_begin_create_or_update(self, resource_group): response = self.client.linker.begin_create_or_update( + providers="str", + linkers="str", resource_uri="str", linker_name="str", parameters={ @@ -99,20 +104,10 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): - response = self.client.linker.begin_delete( - resource_uri="str", - linker_name="str", - api_version="2024-07-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_begin_update(self, resource_group): - response = self.client.linker.begin_update( + def test_linker_update(self, resource_group): + response = self.client.linker.update( + providers="str", + linkers="str", resource_uri="str", linker_name="str", parameters={ @@ -149,15 +144,17 @@ def test_begin_update(self, resource_group): "vNetSolution": {"deleteOrUpdateBehavior": "str", "type": "str"}, }, api_version="2024-07-01-preview", - ).result() # call '.result()' to poll until service return final result + ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_validate(self, resource_group): - response = self.client.linker.begin_validate( + def test_linker_begin_delete(self, resource_group): + response = self.client.linker.begin_delete( + providers="str", + linkers="str", resource_uri="str", linker_name="str", api_version="2024-07-01-preview", @@ -168,8 +165,10 @@ def test_begin_validate(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_configurations(self, resource_group): + def test_linker_list_configurations(self, resource_group): response = self.client.linker.list_configurations( + providers="str", + linkers="str", resource_uri="str", linker_name="str", api_version="2024-07-01-preview", @@ -177,3 +176,17 @@ def test_list_configurations(self, resource_group): # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_linker_begin_validate(self, resource_group): + response = self.client.linker.begin_validate( + providers="str", + linkers="str", + resource_uri="str", + linker_name="str", + api_version="2024-07-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_linker_operations_async.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_linker_operations_async.py index 9c951337a4ad..778418edb608 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_linker_operations_async.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_linker_operations_async.py @@ -21,8 +21,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_linker_list(self, resource_group): response = self.client.linker.list( + providers="str", resource_uri="str", api_version="2024-07-01-preview", ) @@ -32,8 +33,10 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_linker_get(self, resource_group): response = await self.client.linker.get( + providers="str", + linkers="str", resource_uri="str", linker_name="str", api_version="2024-07-01-preview", @@ -44,9 +47,11 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_linker_begin_create_or_update(self, resource_group): response = await ( await self.client.linker.begin_create_or_update( + providers="str", + linkers="str", resource_uri="str", linker_name="str", parameters={ @@ -108,9 +113,58 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_linker_update(self, resource_group): + response = await self.client.linker.update( + providers="str", + linkers="str", + resource_uri="str", + linker_name="str", + parameters={ + "authInfo": "auth_info_base", + "clientType": "str", + "configurationInfo": { + "action": "str", + "additionalConfigurations": {"str": "str"}, + "additionalConnectionStringProperties": {"str": "str"}, + "configurationStore": {"appConfigurationId": "str"}, + "customizedKeys": {"str": "str"}, + "daprProperties": { + "bindingComponentDirection": "str", + "componentType": "str", + "metadata": [ + {"description": "str", "name": "str", "required": "str", "secretRef": "str", "value": "str"} + ], + "runtimeVersion": "str", + "scopes": ["str"], + "secretStoreComponent": "str", + "version": "str", + }, + "deleteOrUpdateBehavior": "str", + }, + "provisioningState": "str", + "publicNetworkSolution": { + "action": "str", + "deleteOrUpdateBehavior": "str", + "firewallRules": {"azureServices": "str", "callerClientIP": "str", "ipRanges": ["str"]}, + }, + "scope": "str", + "secretStore": {"keyVaultId": "str", "keyVaultSecretName": "str"}, + "targetService": "target_service_base", + "vNetSolution": {"deleteOrUpdateBehavior": "str", "type": "str"}, + }, + api_version="2024-07-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_linker_begin_delete(self, resource_group): response = await ( await self.client.linker.begin_delete( + providers="str", + linkers="str", resource_uri="str", linker_name="str", api_version="2024-07-01-preview", @@ -122,62 +176,25 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update(self, resource_group): - response = await ( - await self.client.linker.begin_update( - resource_uri="str", - linker_name="str", - parameters={ - "authInfo": "auth_info_base", - "clientType": "str", - "configurationInfo": { - "action": "str", - "additionalConfigurations": {"str": "str"}, - "additionalConnectionStringProperties": {"str": "str"}, - "configurationStore": {"appConfigurationId": "str"}, - "customizedKeys": {"str": "str"}, - "daprProperties": { - "bindingComponentDirection": "str", - "componentType": "str", - "metadata": [ - { - "description": "str", - "name": "str", - "required": "str", - "secretRef": "str", - "value": "str", - } - ], - "runtimeVersion": "str", - "scopes": ["str"], - "secretStoreComponent": "str", - "version": "str", - }, - "deleteOrUpdateBehavior": "str", - }, - "provisioningState": "str", - "publicNetworkSolution": { - "action": "str", - "deleteOrUpdateBehavior": "str", - "firewallRules": {"azureServices": "str", "callerClientIP": "str", "ipRanges": ["str"]}, - }, - "scope": "str", - "secretStore": {"keyVaultId": "str", "keyVaultSecretName": "str"}, - "targetService": "target_service_base", - "vNetSolution": {"deleteOrUpdateBehavior": "str", "type": "str"}, - }, - api_version="2024-07-01-preview", - ) - ).result() # call '.result()' to poll until service return final result + async def test_linker_list_configurations(self, resource_group): + response = await self.client.linker.list_configurations( + providers="str", + linkers="str", + resource_uri="str", + linker_name="str", + api_version="2024-07-01-preview", + ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_validate(self, resource_group): + async def test_linker_begin_validate(self, resource_group): response = await ( await self.client.linker.begin_validate( + providers="str", + linkers="str", resource_uri="str", linker_name="str", api_version="2024-07-01-preview", @@ -186,15 +203,3 @@ async def test_begin_validate(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_list_configurations(self, resource_group): - response = await self.client.linker.list_configurations( - resource_uri="str", - linker_name="str", - api_version="2024-07-01-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_linkers_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_linkers_operations.py index 3548c4d5c6da..eda43be6d901 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_linkers_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_linkers_operations.py @@ -20,8 +20,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_dryrun(self, resource_group): + def test_linkers_list_dryrun(self, resource_group): response = self.client.linkers.list_dryrun( + providers="str", resource_uri="str", api_version="2024-07-01-preview", ) @@ -31,8 +32,10 @@ def test_list_dryrun(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_dryrun(self, resource_group): + def test_linkers_get_dryrun(self, resource_group): response = self.client.linkers.get_dryrun( + providers="str", + dryruns="str", resource_uri="str", dryrun_name="str", api_version="2024-07-01-preview", @@ -43,8 +46,10 @@ def test_get_dryrun(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_dryrun(self, resource_group): + def test_linkers_begin_create_dryrun(self, resource_group): response = self.client.linkers.begin_create_dryrun( + providers="str", + dryruns="str", resource_uri="str", dryrun_name="str", parameters={ @@ -74,8 +79,10 @@ def test_begin_create_dryrun(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update_dryrun(self, resource_group): + def test_linkers_begin_update_dryrun(self, resource_group): response = self.client.linkers.begin_update_dryrun( + providers="str", + dryruns="str", resource_uri="str", dryrun_name="str", parameters={ @@ -94,8 +101,10 @@ def test_begin_update_dryrun(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete_dryrun(self, resource_group): + def test_linkers_delete_dryrun(self, resource_group): response = self.client.linkers.delete_dryrun( + providers="str", + dryruns="str", resource_uri="str", dryrun_name="str", api_version="2024-07-01-preview", @@ -106,8 +115,10 @@ def test_delete_dryrun(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_generate_configurations(self, resource_group): + def test_linkers_generate_configurations(self, resource_group): response = self.client.linkers.generate_configurations( + providers="str", + linkers="str", resource_uri="str", linker_name="str", api_version="2024-07-01-preview", @@ -118,7 +129,7 @@ def test_generate_configurations(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_dapr_configurations(self, resource_group): + def test_linkers_list_dapr_configurations(self, resource_group): response = self.client.linkers.list_dapr_configurations( resource_uri="str", api_version="2024-07-01-preview", diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_linkers_operations_async.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_linkers_operations_async.py index af8413a4ce9a..d7b6e3a0e35f 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_linkers_operations_async.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_linkers_operations_async.py @@ -21,8 +21,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_dryrun(self, resource_group): + async def test_linkers_list_dryrun(self, resource_group): response = self.client.linkers.list_dryrun( + providers="str", resource_uri="str", api_version="2024-07-01-preview", ) @@ -32,8 +33,10 @@ async def test_list_dryrun(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_dryrun(self, resource_group): + async def test_linkers_get_dryrun(self, resource_group): response = await self.client.linkers.get_dryrun( + providers="str", + dryruns="str", resource_uri="str", dryrun_name="str", api_version="2024-07-01-preview", @@ -44,9 +47,11 @@ async def test_get_dryrun(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_dryrun(self, resource_group): + async def test_linkers_begin_create_dryrun(self, resource_group): response = await ( await self.client.linkers.begin_create_dryrun( + providers="str", + dryruns="str", resource_uri="str", dryrun_name="str", parameters={ @@ -77,9 +82,11 @@ async def test_begin_create_dryrun(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update_dryrun(self, resource_group): + async def test_linkers_begin_update_dryrun(self, resource_group): response = await ( await self.client.linkers.begin_update_dryrun( + providers="str", + dryruns="str", resource_uri="str", dryrun_name="str", parameters={ @@ -99,8 +106,10 @@ async def test_begin_update_dryrun(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete_dryrun(self, resource_group): + async def test_linkers_delete_dryrun(self, resource_group): response = await self.client.linkers.delete_dryrun( + providers="str", + dryruns="str", resource_uri="str", dryrun_name="str", api_version="2024-07-01-preview", @@ -111,8 +120,10 @@ async def test_delete_dryrun(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_generate_configurations(self, resource_group): + async def test_linkers_generate_configurations(self, resource_group): response = await self.client.linkers.generate_configurations( + providers="str", + linkers="str", resource_uri="str", linker_name="str", api_version="2024-07-01-preview", @@ -123,7 +134,7 @@ async def test_generate_configurations(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_dapr_configurations(self, resource_group): + async def test_linkers_list_dapr_configurations(self, resource_group): response = self.client.linkers.list_dapr_configurations( resource_uri="str", api_version="2024-07-01-preview", diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_operations.py index 8d932442ed85..bb8de9cd29aa 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_operations.py @@ -20,7 +20,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_operations_list(self, resource_group): response = self.client.operations.list( api_version="2024-07-01-preview", ) diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_operations_async.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_operations_async.py index bfd5a41c5901..f7d7219e40cb 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_operations_async.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_tests/test_service_linker_management_operations_async.py @@ -21,7 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_operations_list(self, resource_group): response = self.client.operations.list( api_version="2024-07-01-preview", ) diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/setup.py b/sdk/servicelinker/azure-mgmt-servicelinker/setup.py index fa3281f8b346..a0fe73fce0d5 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/setup.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/setup.py @@ -53,7 +53,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -77,7 +76,7 @@ "isodate>=0.6.1", "typing-extensions>=4.6.0", "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", + "azure-mgmt-core>=1.5.0", ], - python_requires=">=3.8", + python_requires=">=3.9", )