From 74c8b73555b38305c35261f7f033c394495c569a Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 2 Aug 2022 22:26:16 +0000 Subject: [PATCH] CodeGen from PR 20081 in Azure/azure-rest-api-specs Merge c3301a473afea4dd69f20565c843caebc4060cfe into a1081882ea6ae33e65da9b86f6a031175c1f8fda --- .../azure-mgmt-appcontainers/_meta.json | 6 +- .../azure/mgmt/appcontainers/__init__.py | 13 +- .../_container_apps_api_client.py | 44 +- .../azure/mgmt/appcontainers/_metadata.json | 112 ----- .../azure/mgmt/appcontainers/_version.py | 2 +- .../azure/mgmt/appcontainers/aio/__init__.py | 13 +- .../aio/_container_apps_api_client.py | 44 +- .../appcontainers/aio/operations/__init__.py | 5 + .../operations/_certificates_operations.py | 122 +++--- ..._container_apps_auth_configs_operations.py | 105 +++-- .../operations/_container_apps_operations.py | 253 +++++++---- ...ainer_apps_revision_replicas_operations.py | 63 +-- .../_container_apps_revisions_operations.py | 110 +++-- ...ntainer_apps_source_controls_operations.py | 160 ++++--- .../operations/_dapr_components_operations.py | 118 +++-- .../_managed_environments_operations.py | 215 ++++++---- ...anaged_environments_storages_operations.py | 99 +++-- .../aio/operations/_namespaces_operations.py | 50 ++- .../aio/operations/_operations.py | 48 ++- .../appcontainers/aio/operations/_patch.py | 19 + .../mgmt/appcontainers/models/__init__.py | 6 +- .../_container_apps_api_client_enums.py | 43 +- .../mgmt/appcontainers/models/_models_py3.py | 386 ++++++++--------- .../azure/mgmt/appcontainers/models/_patch.py | 19 + .../mgmt/appcontainers/operations/__init__.py | 5 + .../operations/_certificates_operations.py | 222 +++++----- ..._container_apps_auth_configs_operations.py | 182 ++++---- .../operations/_container_apps_operations.py | 406 +++++++++++------- ...ainer_apps_revision_replicas_operations.py | 99 +++-- .../_container_apps_revisions_operations.py | 199 +++++---- ...ntainer_apps_source_controls_operations.py | 237 +++++----- .../operations/_dapr_components_operations.py | 212 +++++---- .../_managed_environments_operations.py | 332 ++++++++------ ...anaged_environments_storages_operations.py | 176 ++++---- .../operations/_namespaces_operations.py | 76 ++-- .../appcontainers/operations/_operations.py | 67 +-- .../mgmt/appcontainers/operations/_patch.py | 19 + 37 files changed, 2476 insertions(+), 1811 deletions(-) delete mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_metadata.json create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_patch.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_patch.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_patch.py diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json b/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json index 9738b12eb06f..0eb3c772b3ec 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json +++ b/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.13.0", + "@autorest/python@5.16.0", "@autorest/modelerfour@4.19.3" ], - "commit": "32143b0f5f230ee2601e3c5d1990188666a5058d", + "commit": "18a4254658027a47031bdf493997f9141436e12a", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/app/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/app/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/app/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/__init__.py index 962b4a502e4f..8e7c30acf5ac 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/__init__.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/__init__.py @@ -10,9 +10,14 @@ from ._version import VERSION __version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerAppsAPIClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py index 3dd561f1c96c..064e07fbb83a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py @@ -80,17 +80,39 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.container_apps_auth_configs = ContainerAppsAuthConfigsOperations(self._client, self._config, self._serialize, self._deserialize) - self.container_apps = ContainerAppsOperations(self._client, self._config, self._serialize, self._deserialize) - self.container_apps_revisions = ContainerAppsRevisionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.container_apps_revision_replicas = ContainerAppsRevisionReplicasOperations(self._client, self._config, self._serialize, self._deserialize) - self.dapr_components = DaprComponentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_environments = ManagedEnvironmentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_environments_storages = ManagedEnvironmentsStoragesOperations(self._client, self._config, self._serialize, self._deserialize) - self.container_apps_source_controls = ContainerAppsSourceControlsOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_apps_auth_configs = ContainerAppsAuthConfigsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps = ContainerAppsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_revisions = ContainerAppsRevisionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_revision_replicas = ContainerAppsRevisionReplicasOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.dapr_components = DaprComponentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_environments = ManagedEnvironmentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.namespaces = NamespacesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_environments_storages = ManagedEnvironmentsStoragesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_source_controls = ContainerAppsSourceControlsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_metadata.json b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_metadata.json deleted file mode 100644 index ef96a7b75251..000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_metadata.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "chosen_version": "2022-03-01", - "total_api_version_list": ["2022-03-01"], - "client": { - "name": "ContainerAppsAPIClient", - "filename": "_container_apps_api_client", - "description": "ContainerAppsAPIClient.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerAppsAPIClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerAppsAPIClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "The ID of the target subscription.", - "docstring_type": "str", - "required": true - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version=None, # type: Optional[str]", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "container_apps_auth_configs": "ContainerAppsAuthConfigsOperations", - "container_apps": "ContainerAppsOperations", - "container_apps_revisions": "ContainerAppsRevisionsOperations", - "container_apps_revision_replicas": "ContainerAppsRevisionReplicasOperations", - "dapr_components": "DaprComponentsOperations", - "operations": "Operations", - "managed_environments": "ManagedEnvironmentsOperations", - "certificates": "CertificatesOperations", - "namespaces": "NamespacesOperations", - "managed_environments_storages": "ManagedEnvironmentsStoragesOperations", - "container_apps_source_controls": "ContainerAppsSourceControlsOperations" - } -} \ No newline at end of file diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/__init__.py index cb4bbcce8e12..b642e4a85d62 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/__init__.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_apps_api_client import ContainerAppsAPIClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerAppsAPIClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py index 99da7f7ccaf7..c87a5a23387e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py @@ -80,17 +80,39 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.container_apps_auth_configs = ContainerAppsAuthConfigsOperations(self._client, self._config, self._serialize, self._deserialize) - self.container_apps = ContainerAppsOperations(self._client, self._config, self._serialize, self._deserialize) - self.container_apps_revisions = ContainerAppsRevisionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.container_apps_revision_replicas = ContainerAppsRevisionReplicasOperations(self._client, self._config, self._serialize, self._deserialize) - self.dapr_components = DaprComponentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_environments = ManagedEnvironmentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_environments_storages = ManagedEnvironmentsStoragesOperations(self._client, self._config, self._serialize, self._deserialize) - self.container_apps_source_controls = ContainerAppsSourceControlsOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_apps_auth_configs = ContainerAppsAuthConfigsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps = ContainerAppsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_revisions = ContainerAppsRevisionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_revision_replicas = ContainerAppsRevisionReplicasOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.dapr_components = DaprComponentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_environments = ManagedEnvironmentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.namespaces = NamespacesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_environments_storages = ManagedEnvironmentsStoragesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_source_controls = ContainerAppsSourceControlsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py index 505be253220b..30d9a2b2a7a3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py @@ -18,6 +18,9 @@ from ._managed_environments_storages_operations import ManagedEnvironmentsStoragesOperations from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'ContainerAppsAuthConfigsOperations', 'ContainerAppsOperations', @@ -31,3 +34,5 @@ 'ManagedEnvironmentsStoragesOperations', 'ContainerAppsSourceControlsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py index f4742e78a51a..3f967256ea15 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class CertificatesOperations: - """CertificatesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`certificates` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( @@ -51,7 +50,7 @@ def list( resource_group_name: str, environment_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CertificateCollection"]: + ) -> AsyncIterable[_models.CertificateCollection]: """Get the Certificates in a given managed environment. Get the Certificates in a given managed environment. @@ -67,13 +66,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.CertificateCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CertificateCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): environment_name=environment_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): environment_name=environment_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( environment_name: str, certificate_name: str, **kwargs: Any - ) -> "_models.Certificate": + ) -> _models.Certificate: """Get the specified Certificate. Get the specified Certificate. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Certificate"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Certificate] request = build_get_request( @@ -170,11 +179,13 @@ async def get( certificate_name=certificate_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -202,9 +213,9 @@ async def create_or_update( resource_group_name: str, environment_name: str, certificate_name: str, - certificate_envelope: Optional["_models.Certificate"] = None, + certificate_envelope: Optional[_models.Certificate] = None, **kwargs: Any - ) -> "_models.Certificate": + ) -> _models.Certificate: """Create or Update a Certificate. Create or Update a Certificate. @@ -222,14 +233,17 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Certificate"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Certificate] if certificate_envelope is not None: _json = self._serialize.body(certificate_envelope, 'Certificate') @@ -245,11 +259,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -294,13 +310,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -310,11 +329,13 @@ async def delete( # pylint: disable=inconsistent-return-statements certificate_name=certificate_name, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -338,9 +359,9 @@ async def update( resource_group_name: str, environment_name: str, certificate_name: str, - certificate_envelope: "_models.CertificatePatch", + certificate_envelope: _models.CertificatePatch, **kwargs: Any - ) -> "_models.Certificate": + ) -> _models.Certificate: """Update properties of a certificate. Patches a certificate. Currently only patching of tags is supported. @@ -358,14 +379,17 @@ async def update( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Certificate"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Certificate] _json = self._serialize.body(certificate_envelope, 'CertificatePatch') @@ -378,11 +402,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py index 3b3fc84f50d7..fdd4a22865f6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ContainerAppsAuthConfigsOperations: - """ContainerAppsAuthConfigsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_auth_configs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_container_app( @@ -51,7 +50,7 @@ def list_by_container_app( resource_group_name: str, container_app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AuthConfigCollection"]: + ) -> AsyncIterable[_models.AuthConfigCollection]: """Get the Container App AuthConfigs in a given resource group. Get the Container App AuthConfigs in a given resource group. @@ -67,13 +66,16 @@ def list_by_container_app( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.AuthConfigCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AuthConfigCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthConfigCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): container_app_name=container_app_name, api_version=api_version, template_url=self.list_by_container_app.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): container_app_name=container_app_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( container_app_name: str, auth_config_name: str, **kwargs: Any - ) -> "_models.AuthConfig": + ) -> _models.AuthConfig: """Get a AuthConfig of a Container App. Get a AuthConfig of a Container App. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.AuthConfig :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthConfig"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AuthConfig] request = build_get_request( @@ -170,11 +179,13 @@ async def get( auth_config_name=auth_config_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -202,12 +213,12 @@ async def create_or_update( resource_group_name: str, container_app_name: str, auth_config_name: str, - auth_config_envelope: "_models.AuthConfig", + auth_config_envelope: _models.AuthConfig, **kwargs: Any - ) -> "_models.AuthConfig": + ) -> _models.AuthConfig: """Create or update the AuthConfig for a Container App. - Description for Create or update the AuthConfig for a Container App. + Create or update the AuthConfig for a Container App. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str @@ -222,14 +233,17 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.AuthConfig :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthConfig"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AuthConfig] _json = self._serialize.body(auth_config_envelope, 'AuthConfig') @@ -242,11 +256,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -278,7 +294,7 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete a Container App AuthConfig. - Description for Delete a Container App AuthConfig. + Delete a Container App AuthConfig. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str @@ -291,13 +307,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -307,11 +326,13 @@ async def delete( # pylint: disable=inconsistent-return-statements auth_config_name=auth_config_name, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py index 14252e0ca694..e0bb429c1c11 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ContainerAppsOperations: - """ContainerAppsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_subscription( self, **kwargs: Any - ) -> AsyncIterable["_models.ContainerAppCollection"]: + ) -> AsyncIterable[_models.ContainerAppCollection]: """Get the Container Apps in a given subscription. Get the Container Apps in a given subscription. @@ -63,13 +62,16 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ContainerAppCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerAppCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerAppCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -77,9 +79,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -87,9 +91,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ContainerAppCollection"]: + ) -> AsyncIterable[_models.ContainerAppCollection]: """Get the Container Apps in a given resource group. Get the Container Apps in a given resource group. @@ -142,13 +148,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ContainerAppCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerAppCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerAppCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -157,9 +166,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -168,9 +179,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get( resource_group_name: str, container_app_name: str, **kwargs: Any - ) -> "_models.ContainerApp": + ) -> _models.ContainerApp: """Get the properties of a Container App. Get the properties of a Container App. @@ -224,13 +237,16 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.ContainerApp :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerApp"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerApp] request = build_get_request( @@ -239,11 +255,13 @@ async def get( container_app_name=container_app_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -269,17 +287,20 @@ async def _create_or_update_initial( self, resource_group_name: str, container_app_name: str, - container_app_envelope: "_models.ContainerApp", + container_app_envelope: _models.ContainerApp, **kwargs: Any - ) -> "_models.ContainerApp": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerApp"] + ) -> _models.ContainerApp: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerApp] _json = self._serialize.body(container_app_envelope, 'ContainerApp') @@ -291,11 +312,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -325,12 +348,12 @@ async def begin_create_or_update( self, resource_group_name: str, container_app_name: str, - container_app_envelope: "_models.ContainerApp", + container_app_envelope: _models.ContainerApp, **kwargs: Any - ) -> AsyncLROPoller["_models.ContainerApp"]: + ) -> AsyncLROPoller[_models.ContainerApp]: """Create or update a Container App. - Description for Create or update a Container App. + Create or update a Container App. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str @@ -351,37 +374,47 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ContainerApp] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerApp] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerApp"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, container_app_name=container_app_name, container_app_envelope=container_app_envelope, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ContainerApp', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -400,13 +433,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements container_app_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -415,11 +451,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements container_app_name=container_app_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -445,7 +483,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements ) -> AsyncLROPoller[None]: """Delete a Container App. - Description for Delete a Container App. + Delete a Container App. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str @@ -463,20 +501,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, container_app_name=container_app_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -486,8 +529,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -504,17 +553,20 @@ async def _update_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, container_app_name: str, - container_app_envelope: "_models.ContainerApp", + container_app_envelope: _models.ContainerApp, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(container_app_envelope, 'ContainerApp') @@ -526,11 +578,13 @@ async def _update_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -552,7 +606,7 @@ async def begin_update( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, container_app_name: str, - container_app_envelope: "_models.ContainerApp", + container_app_envelope: _models.ContainerApp, **kwargs: Any ) -> AsyncLROPoller[None]: """Update properties of a Container App. @@ -577,23 +631,28 @@ async def begin_update( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, container_app_name=container_app_name, container_app_envelope=container_app_envelope, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -603,8 +662,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -624,7 +689,7 @@ async def list_custom_host_name_analysis( container_app_name: str, custom_hostname: Optional[str] = None, **kwargs: Any - ) -> "_models.CustomHostnameAnalysisResult": + ) -> _models.CustomHostnameAnalysisResult: """Analyzes a custom hostname for a Container App. Analyzes a custom hostname for a Container App. @@ -640,13 +705,16 @@ async def list_custom_host_name_analysis( :rtype: ~azure.mgmt.appcontainers.models.CustomHostnameAnalysisResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomHostnameAnalysisResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CustomHostnameAnalysisResult] request = build_list_custom_host_name_analysis_request( @@ -656,11 +724,13 @@ async def list_custom_host_name_analysis( api_version=api_version, custom_hostname=custom_hostname, template_url=self.list_custom_host_name_analysis.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -688,7 +758,7 @@ async def list_secrets( resource_group_name: str, container_app_name: str, **kwargs: Any - ) -> "_models.SecretsCollection": + ) -> _models.SecretsCollection: """List secrets for a container app. List secrets for a container app. @@ -702,13 +772,16 @@ async def list_secrets( :rtype: ~azure.mgmt.appcontainers.models.SecretsCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretsCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SecretsCollection] request = build_list_secrets_request( @@ -717,11 +790,13 @@ async def list_secrets( container_app_name=container_app_name, api_version=api_version, template_url=self.list_secrets.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py index be675fe4c67a..518e4d8aebff 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py @@ -13,6 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ContainerAppsRevisionReplicasOperations: - """ContainerAppsRevisionReplicasOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_revision_replicas` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def get_replica( @@ -51,7 +50,7 @@ async def get_replica( revision_name: str, replica_name: str, **kwargs: Any - ) -> "_models.Replica": + ) -> _models.Replica: """Get a replica for a Container App Revision. Get a replica for a Container App Revision. @@ -69,13 +68,16 @@ async def get_replica( :rtype: ~azure.mgmt.appcontainers.models.Replica :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Replica"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Replica] request = build_get_replica_request( @@ -86,11 +88,13 @@ async def get_replica( replica_name=replica_name, api_version=api_version, template_url=self.get_replica.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -119,7 +123,7 @@ async def list_replicas( container_app_name: str, revision_name: str, **kwargs: Any - ) -> "_models.ReplicaCollection": + ) -> _models.ReplicaCollection: """List replicas for a Container App Revision. List replicas for a Container App Revision. @@ -135,13 +139,16 @@ async def list_replicas( :rtype: ~azure.mgmt.appcontainers.models.ReplicaCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicaCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ReplicaCollection] request = build_list_replicas_request( @@ -151,11 +158,13 @@ async def list_replicas( revision_name=revision_name, api_version=api_version, template_url=self.list_replicas.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py index e89886bbb4aa..65f074d560c3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ContainerAppsRevisionsOperations: - """ContainerAppsRevisionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_revisions` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_revisions( @@ -52,7 +51,7 @@ def list_revisions( container_app_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.RevisionCollection"]: + ) -> AsyncIterable[_models.RevisionCollection]: """Get the Revisions for a given Container App. Get the Revisions for a given Container App. @@ -69,13 +68,16 @@ def list_revisions( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.RevisionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RevisionCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RevisionCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -86,9 +88,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_revisions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -99,9 +103,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -142,7 +148,7 @@ async def get_revision( container_app_name: str, revision_name: str, **kwargs: Any - ) -> "_models.Revision": + ) -> _models.Revision: """Get a revision of a Container App. Get a revision of a Container App. @@ -158,13 +164,16 @@ async def get_revision( :rtype: ~azure.mgmt.appcontainers.models.Revision :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Revision"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Revision] request = build_get_revision_request( @@ -174,11 +183,13 @@ async def get_revision( revision_name=revision_name, api_version=api_version, template_url=self.get_revision.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -223,13 +234,16 @@ async def activate_revision( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_activate_revision_request( @@ -239,11 +253,13 @@ async def activate_revision( # pylint: disable=inconsistent-return-statements revision_name=revision_name, api_version=api_version, template_url=self.activate_revision.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -284,13 +300,16 @@ async def deactivate_revision( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_deactivate_revision_request( @@ -300,11 +319,13 @@ async def deactivate_revision( # pylint: disable=inconsistent-return-statements revision_name=revision_name, api_version=api_version, template_url=self.deactivate_revision.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -345,13 +366,16 @@ async def restart_revision( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_restart_revision_request( @@ -361,11 +385,13 @@ async def restart_revision( # pylint: disable=inconsistent-return-statements revision_name=revision_name, api_version=api_version, template_url=self.restart_revision.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py index bbc66a490a87..ec1f225a43bf 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ContainerAppsSourceControlsOperations: - """ContainerAppsSourceControlsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_source_controls` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_container_app( @@ -53,7 +52,7 @@ def list_by_container_app( resource_group_name: str, container_app_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SourceControlCollection"]: + ) -> AsyncIterable[_models.SourceControlCollection]: """Get the Container App SourceControls in a given resource group. Get the Container App SourceControls in a given resource group. @@ -69,13 +68,16 @@ def list_by_container_app( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.SourceControlCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControlCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -85,9 +87,11 @@ def prepare_request(next_link=None): container_app_name=container_app_name, api_version=api_version, template_url=self.list_by_container_app.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -97,9 +101,11 @@ def prepare_request(next_link=None): container_app_name=container_app_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -140,7 +146,7 @@ async def get( container_app_name: str, source_control_name: str, **kwargs: Any - ) -> "_models.SourceControl": + ) -> _models.SourceControl: """Get a SourceControl of a Container App. Get a SourceControl of a Container App. @@ -156,13 +162,16 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.SourceControl :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControl"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControl] request = build_get_request( @@ -172,11 +181,13 @@ async def get( source_control_name=source_control_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -203,17 +214,20 @@ async def _create_or_update_initial( resource_group_name: str, container_app_name: str, source_control_name: str, - source_control_envelope: "_models.SourceControl", + source_control_envelope: _models.SourceControl, **kwargs: Any - ) -> "_models.SourceControl": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControl"] + ) -> _models.SourceControl: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControl] _json = self._serialize.body(source_control_envelope, 'SourceControl') @@ -226,25 +240,27 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('SourceControl', pipeline_response) - if response.status_code == 202: + if response.status_code == 201: deserialized = self._deserialize('SourceControl', pipeline_response) if cls: @@ -261,12 +277,12 @@ async def begin_create_or_update( resource_group_name: str, container_app_name: str, source_control_name: str, - source_control_envelope: "_models.SourceControl", + source_control_envelope: _models.SourceControl, **kwargs: Any - ) -> AsyncLROPoller["_models.SourceControl"]: + ) -> AsyncLROPoller[_models.SourceControl]: """Create or update the SourceControl for a Container App. - Description for Create or update the SourceControl for a Container App. + Create or update the SourceControl for a Container App. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str @@ -289,17 +305,20 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SourceControl] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControl] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControl"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, @@ -307,20 +326,27 @@ async def begin_create_or_update( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SourceControl', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -340,13 +366,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements source_control_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -356,11 +385,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements source_control_name=source_control_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -387,7 +418,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements ) -> AsyncLROPoller[None]: """Delete a Container App SourceControl. - Description for Delete a Container App SourceControl. + Delete a Container App SourceControl. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str @@ -407,21 +438,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -431,8 +467,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py index 549c8275319c..c4f31ef32585 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class DaprComponentsOperations: - """DaprComponentsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`dapr_components` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( @@ -51,7 +50,7 @@ def list( resource_group_name: str, environment_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DaprComponentsCollection"]: + ) -> AsyncIterable[_models.DaprComponentsCollection]: """Get the Dapr Components for a managed environment. Get the Dapr Components for a managed environment. @@ -67,13 +66,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DaprComponentsCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DaprComponentsCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DaprComponentsCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): environment_name=environment_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): environment_name=environment_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( environment_name: str, component_name: str, **kwargs: Any - ) -> "_models.DaprComponent": + ) -> _models.DaprComponent: """Get a dapr component. Get a dapr component. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DaprComponent"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DaprComponent] request = build_get_request( @@ -170,11 +179,13 @@ async def get( component_name=component_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -202,9 +213,9 @@ async def create_or_update( resource_group_name: str, environment_name: str, component_name: str, - dapr_component_envelope: "_models.DaprComponent", + dapr_component_envelope: _models.DaprComponent, **kwargs: Any - ) -> "_models.DaprComponent": + ) -> _models.DaprComponent: """Creates or updates a Dapr Component. Creates or updates a Dapr Component in a Managed Environment. @@ -222,14 +233,17 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DaprComponent"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DaprComponent] _json = self._serialize.body(dapr_component_envelope, 'DaprComponent') @@ -242,11 +256,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -291,13 +307,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -307,11 +326,13 @@ async def delete( # pylint: disable=inconsistent-return-statements component_name=component_name, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -336,7 +357,7 @@ async def list_secrets( environment_name: str, component_name: str, **kwargs: Any - ) -> "_models.DaprSecretsCollection": + ) -> _models.DaprSecretsCollection: """List secrets for a dapr component. List secrets for a dapr component. @@ -352,13 +373,16 @@ async def list_secrets( :rtype: ~azure.mgmt.appcontainers.models.DaprSecretsCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DaprSecretsCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DaprSecretsCollection] request = build_list_secrets_request( @@ -368,11 +392,13 @@ async def list_secrets( component_name=component_name, api_version=api_version, template_url=self.list_secrets.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py index 04589e9efe70..93e7d0105983 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedEnvironmentsOperations: - """ManagedEnvironmentsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`managed_environments` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_subscription( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedEnvironmentsCollection"]: + ) -> AsyncIterable[_models.ManagedEnvironmentsCollection]: """Get all Environments for a subscription. Get all Managed Environments for a subscription. @@ -63,13 +62,16 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ManagedEnvironmentsCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironmentsCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentsCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -77,9 +79,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -87,9 +91,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedEnvironmentsCollection"]: + ) -> AsyncIterable[_models.ManagedEnvironmentsCollection]: """Get all the Environments in a resource group. Get all the Managed Environments in a resource group. @@ -142,13 +148,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ManagedEnvironmentsCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironmentsCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentsCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -157,9 +166,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -168,9 +179,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get( resource_group_name: str, environment_name: str, **kwargs: Any - ) -> "_models.ManagedEnvironment": + ) -> _models.ManagedEnvironment: """Get the properties of a Managed Environment. Get the properties of a Managed Environment used to host container apps. @@ -224,13 +237,16 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironment] request = build_get_request( @@ -239,11 +255,13 @@ async def get( environment_name=environment_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -269,17 +287,20 @@ async def _create_or_update_initial( self, resource_group_name: str, environment_name: str, - environment_envelope: "_models.ManagedEnvironment", + environment_envelope: _models.ManagedEnvironment, **kwargs: Any - ) -> "_models.ManagedEnvironment": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironment"] + ) -> _models.ManagedEnvironment: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironment] _json = self._serialize.body(environment_envelope, 'ManagedEnvironment') @@ -291,11 +312,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -325,9 +348,9 @@ async def begin_create_or_update( self, resource_group_name: str, environment_name: str, - environment_envelope: "_models.ManagedEnvironment", + environment_envelope: _models.ManagedEnvironment, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedEnvironment"]: + ) -> AsyncLROPoller[_models.ManagedEnvironment]: """Creates or updates a Managed Environment. Creates or updates a Managed Environment used to host container apps. @@ -351,37 +374,47 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ManagedEnvironment] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironment] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironment"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, environment_name=environment_name, environment_envelope=environment_envelope, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedEnvironment', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -400,13 +433,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements environment_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -415,11 +451,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements environment_name=environment_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -463,20 +501,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, environment_name=environment_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -486,8 +529,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -504,17 +553,20 @@ async def _update_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, environment_name: str, - environment_envelope: "_models.ManagedEnvironment", + environment_envelope: _models.ManagedEnvironment, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(environment_envelope, 'ManagedEnvironment') @@ -526,11 +578,13 @@ async def _update_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -552,7 +606,7 @@ async def begin_update( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, environment_name: str, - environment_envelope: "_models.ManagedEnvironment", + environment_envelope: _models.ManagedEnvironment, **kwargs: Any ) -> AsyncLROPoller[None]: """Update Managed Environment's properties. @@ -577,23 +631,28 @@ async def begin_update( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, environment_name=environment_name, environment_envelope=environment_envelope, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -603,8 +662,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py index 5a62d101684a..384a42fbeb94 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py @@ -13,6 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedEnvironmentsStoragesOperations: - """ManagedEnvironmentsStoragesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`managed_environments_storages` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def list( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, environment_name: str, **kwargs: Any - ) -> "_models.ManagedEnvironmentStoragesCollection": + ) -> _models.ManagedEnvironmentStoragesCollection: """Get all storages for a managedEnvironment. Get all storages for a managedEnvironment. @@ -63,13 +62,16 @@ async def list( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStoragesCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentStoragesCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironmentStoragesCollection] request = build_list_request( @@ -78,11 +80,13 @@ async def list( environment_name=environment_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -111,7 +115,7 @@ async def get( environment_name: str, storage_name: str, **kwargs: Any - ) -> "_models.ManagedEnvironmentStorage": + ) -> _models.ManagedEnvironmentStorage: """Get storage for a managedEnvironment. Get storage for a managedEnvironment. @@ -127,13 +131,16 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentStorage"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironmentStorage] request = build_get_request( @@ -143,11 +150,13 @@ async def get( storage_name=storage_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -175,9 +184,9 @@ async def create_or_update( resource_group_name: str, environment_name: str, storage_name: str, - storage_envelope: "_models.ManagedEnvironmentStorage", + storage_envelope: _models.ManagedEnvironmentStorage, **kwargs: Any - ) -> "_models.ManagedEnvironmentStorage": + ) -> _models.ManagedEnvironmentStorage: """Create or update storage for a managedEnvironment. Create or update storage for a managedEnvironment. @@ -195,14 +204,17 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentStorage"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironmentStorage] _json = self._serialize.body(storage_envelope, 'ManagedEnvironmentStorage') @@ -215,11 +227,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -264,13 +278,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -280,11 +297,13 @@ async def delete( # pylint: disable=inconsistent-return-statements storage_name=storage_name, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py index bf9e9706e7bc..e931c7b17361 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py @@ -13,6 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class NamespacesOperations: - """NamespacesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`namespaces` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def check_name_availability( self, resource_group_name: str, environment_name: str, - check_name_availability_request: "_models.CheckNameAvailabilityRequest", + check_name_availability_request: _models.CheckNameAvailabilityRequest, **kwargs: Any - ) -> "_models.CheckNameAvailabilityResponse": + ) -> _models.CheckNameAvailabilityResponse: """Checks the resource name availability. Checks if resource name is available. @@ -67,14 +66,17 @@ async def check_name_availability( :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResponse] _json = self._serialize.body(check_name_availability_request, 'CheckNameAvailabilityRequest') @@ -86,11 +88,13 @@ async def check_name_availability( content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py index a2773cdaf1ab..4586ee9323be 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py @@ -14,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.AvailableOperations"]: + ) -> AsyncIterable[_models.AvailableOperations]: """Lists all of the available RP operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AvailableOperations] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py index 1948f779e92c..4a2ed697285b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py @@ -137,7 +137,9 @@ Type, UnauthenticatedClientActionV2, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AllowedAudiencesValidation', 'AllowedPrincipals', @@ -267,3 +269,5 @@ 'Type', 'UnauthenticatedClientActionV2', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py index 942689302057..7735cb27f77b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py @@ -7,18 +7,17 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AccessMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AccessMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Access mode for storage """ READ_ONLY = "ReadOnly" READ_WRITE = "ReadWrite" -class ActiveRevisionsMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ActiveRevisionsMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ActiveRevisionsMode controls how active revisions are handled for the Container app: @@ -32,7 +31,7 @@ class ActiveRevisionsMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MULTIPLE = "Multiple" SINGLE = "Single" -class AppProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AppProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells Dapr which protocol your application is using. Valid options are http and grpc. Default is http """ @@ -40,14 +39,14 @@ class AppProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): HTTP = "http" GRPC = "grpc" -class BindingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Custom Domain binding type. """ DISABLED = "Disabled" SNI_ENABLED = "SniEnabled" -class CertificateProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CertificateProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the certificate. """ @@ -57,14 +56,14 @@ class CertificateProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, DELETE_FAILED = "DeleteFailed" PENDING = "Pending" -class CheckNameAvailabilityReason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CheckNameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The reason why the given name is not available. """ INVALID = "Invalid" ALREADY_EXISTS = "AlreadyExists" -class ContainerAppProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerAppProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the Container App. """ @@ -73,14 +72,14 @@ class ContainerAppProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, FAILED = "Failed" CANCELED = "Canceled" -class CookieExpirationConvention(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CookieExpirationConvention(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The convention used when determining the session cookie's expiration. """ FIXED_TIME = "FixedTime" IDENTITY_PROVIDER_DERIVED = "IdentityProviderDerived" -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -89,7 +88,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DnsVerificationTestResult(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DnsVerificationTestResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): """DNS verification test result. """ @@ -97,7 +96,7 @@ class DnsVerificationTestResult(with_metaclass(CaseInsensitiveEnumMeta, str, Enu FAILED = "Failed" SKIPPED = "Skipped" -class EnvironmentProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class EnvironmentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the Environment. """ @@ -112,7 +111,7 @@ class EnvironmentProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, UPGRADE_REQUESTED = "UpgradeRequested" UPGRADE_FAILED = "UpgradeFailed" -class ForwardProxyConvention(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ForwardProxyConvention(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The convention used to determine the url of the request made. """ @@ -120,7 +119,7 @@ class ForwardProxyConvention(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) STANDARD = "Standard" CUSTOM = "Custom" -class IngressTransportMethod(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IngressTransportMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Ingress transport protocol """ @@ -128,7 +127,7 @@ class IngressTransportMethod(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) HTTP = "http" HTTP2 = "http2" -class ManagedServiceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). """ @@ -138,7 +137,7 @@ class ManagedServiceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, En USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" -class RevisionHealthState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class RevisionHealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Current health State of the revision """ @@ -146,7 +145,7 @@ class RevisionHealthState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): UNHEALTHY = "Unhealthy" NONE = "None" -class RevisionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class RevisionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Current provisioning State of the revision """ @@ -156,14 +155,14 @@ class RevisionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enu DEPROVISIONING = "Deprovisioning" DEPROVISIONED = "Deprovisioned" -class Scheme(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Scheme(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Scheme to use for connecting to the host. Defaults to HTTP. """ HTTP = "HTTP" HTTPS = "HTTPS" -class SourceControlOperationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SourceControlOperationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Current provisioning State of the operation """ @@ -172,14 +171,14 @@ class SourceControlOperationState(with_metaclass(CaseInsensitiveEnumMeta, str, E FAILED = "Failed" CANCELED = "Canceled" -class StorageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage type for the volume. If not provided, use EmptyDir. """ AZURE_FILE = "AzureFile" EMPTY_DIR = "EmptyDir" -class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of probe. """ @@ -187,7 +186,7 @@ class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): READINESS = "Readiness" STARTUP = "Startup" -class UnauthenticatedClientActionV2(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UnauthenticatedClientActionV2(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The action to take when an unauthenticated client attempts to access the app. """ diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py index 0767b061c0d2..0519c4da95fb 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py @@ -7,12 +7,14 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._container_apps_api_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class AllowedAudiencesValidation(msrest.serialization.Model): @@ -96,8 +98,8 @@ def __init__( self, *, enabled: Optional[bool] = None, - registration: Optional["AppleRegistration"] = None, - login: Optional["LoginScopes"] = None, + registration: Optional["_models.AppleRegistration"] = None, + login: Optional["_models.LoginScopes"] = None, **kwargs ): """ @@ -166,7 +168,7 @@ def __init__( self, *, destination: Optional[str] = None, - log_analytics_configuration: Optional["LogAnalyticsConfiguration"] = None, + log_analytics_configuration: Optional["_models.LogAnalyticsConfiguration"] = None, **kwargs ): """ @@ -354,11 +356,11 @@ class AuthConfig(ProxyResource): def __init__( self, *, - platform: Optional["AuthPlatform"] = None, - global_validation: Optional["GlobalValidation"] = None, - identity_providers: Optional["IdentityProviders"] = None, - login: Optional["Login"] = None, - http_settings: Optional["HttpSettings"] = None, + platform: Optional["_models.AuthPlatform"] = None, + global_validation: Optional["_models.GlobalValidation"] = None, + identity_providers: Optional["_models.IdentityProviders"] = None, + login: Optional["_models.Login"] = None, + http_settings: Optional["_models.HttpSettings"] = None, **kwargs ): """ @@ -412,7 +414,7 @@ class AuthConfigCollection(msrest.serialization.Model): def __init__( self, *, - value: List["AuthConfig"], + value: List["_models.AuthConfig"], **kwargs ): """ @@ -482,7 +484,7 @@ class AvailableOperations(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["OperationDetail"]] = None, + value: Optional[List["_models.OperationDetail"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -531,9 +533,9 @@ def __init__( self, *, enabled: Optional[bool] = None, - registration: Optional["AzureActiveDirectoryRegistration"] = None, - login: Optional["AzureActiveDirectoryLogin"] = None, - validation: Optional["AzureActiveDirectoryValidation"] = None, + registration: Optional["_models.AzureActiveDirectoryRegistration"] = None, + login: Optional["_models.AzureActiveDirectoryLogin"] = None, + validation: Optional["_models.AzureActiveDirectoryValidation"] = None, is_auto_provisioned: Optional[bool] = None, **kwargs ): @@ -722,9 +724,9 @@ class AzureActiveDirectoryValidation(msrest.serialization.Model): def __init__( self, *, - jwt_claim_checks: Optional["JwtClaimChecks"] = None, + jwt_claim_checks: Optional["_models.JwtClaimChecks"] = None, allowed_audiences: Optional[List[str]] = None, - default_authorization_policy: Optional["DefaultAuthorizationPolicy"] = None, + default_authorization_policy: Optional["_models.DefaultAuthorizationPolicy"] = None, **kwargs ): """ @@ -798,7 +800,7 @@ class AzureFileProperties(msrest.serialization.Model): :vartype account_name: str :ivar account_key: Storage account key for azure file. :vartype account_key: str - :ivar access_mode: Access mode for storage. Possible values include: "ReadOnly", "ReadWrite". + :ivar access_mode: Access mode for storage. Known values are: "ReadOnly", "ReadWrite". :vartype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode :ivar share_name: Azure file share name. :vartype share_name: str @@ -816,7 +818,7 @@ def __init__( *, account_name: Optional[str] = None, account_key: Optional[str] = None, - access_mode: Optional[Union[str, "AccessMode"]] = None, + access_mode: Optional[Union[str, "_models.AccessMode"]] = None, share_name: Optional[str] = None, **kwargs ): @@ -825,8 +827,7 @@ def __init__( :paramtype account_name: str :keyword account_key: Storage account key for azure file. :paramtype account_key: str - :keyword access_mode: Access mode for storage. Possible values include: "ReadOnly", - "ReadWrite". + :keyword access_mode: Access mode for storage. Known values are: "ReadOnly", "ReadWrite". :paramtype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode :keyword share_name: Azure file share name. :paramtype share_name: str @@ -857,7 +858,7 @@ def __init__( self, *, enabled: Optional[bool] = None, - registration: Optional["AzureStaticWebAppsRegistration"] = None, + registration: Optional["_models.AzureStaticWebAppsRegistration"] = None, **kwargs ): """ @@ -1005,7 +1006,7 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - properties: Optional["CertificateProperties"] = None, + properties: Optional["_models.CertificateProperties"] = None, **kwargs ): """ @@ -1046,7 +1047,7 @@ class CertificateCollection(msrest.serialization.Model): def __init__( self, *, - value: List["Certificate"], + value: List["_models.Certificate"], **kwargs ): """ @@ -1088,8 +1089,8 @@ class CertificateProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Provisioning state of the certificate. Possible values include: - "Succeeded", "Failed", "Canceled", "DeleteFailed", "Pending". + :ivar provisioning_state: Provisioning state of the certificate. Known values are: "Succeeded", + "Failed", "Canceled", "DeleteFailed", "Pending". :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.CertificateProvisioningState :ivar password: Certificate password. @@ -1199,8 +1200,8 @@ class CheckNameAvailabilityResponse(msrest.serialization.Model): :ivar name_available: Indicates if the resource name is available. :vartype name_available: bool - :ivar reason: The reason why the given name is not available. Possible values include: - "Invalid", "AlreadyExists". + :ivar reason: The reason why the given name is not available. Known values are: "Invalid", + "AlreadyExists". :vartype reason: str or ~azure.mgmt.appcontainers.models.CheckNameAvailabilityReason :ivar message: Detailed reason why the given name is available. :vartype message: str @@ -1216,15 +1217,15 @@ def __init__( self, *, name_available: Optional[bool] = None, - reason: Optional[Union[str, "CheckNameAvailabilityReason"]] = None, + reason: Optional[Union[str, "_models.CheckNameAvailabilityReason"]] = None, message: Optional[str] = None, **kwargs ): """ :keyword name_available: Indicates if the resource name is available. :paramtype name_available: bool - :keyword reason: The reason why the given name is not available. Possible values include: - "Invalid", "AlreadyExists". + :keyword reason: The reason why the given name is not available. Known values are: "Invalid", + "AlreadyExists". :paramtype reason: str or ~azure.mgmt.appcontainers.models.CheckNameAvailabilityReason :keyword message: Detailed reason why the given name is available. :paramtype message: str @@ -1280,7 +1281,7 @@ class Configuration(msrest.serialization.Model): Multiple: multiple revisions can be active.Single: Only one revision can be active at a time. Revision weights can not be used in this mode. If no value if - provided, this is the default.. Possible values include: "Multiple", "Single". + provided, this is the default.. Known values are: "Multiple", "Single". :vartype active_revisions_mode: str or ~azure.mgmt.appcontainers.models.ActiveRevisionsMode :ivar ingress: Ingress configurations. :vartype ingress: ~azure.mgmt.appcontainers.models.Ingress @@ -1302,11 +1303,11 @@ class Configuration(msrest.serialization.Model): def __init__( self, *, - secrets: Optional[List["Secret"]] = None, - active_revisions_mode: Optional[Union[str, "ActiveRevisionsMode"]] = None, - ingress: Optional["Ingress"] = None, - registries: Optional[List["RegistryCredentials"]] = None, - dapr: Optional["Dapr"] = None, + secrets: Optional[List["_models.Secret"]] = None, + active_revisions_mode: Optional[Union[str, "_models.ActiveRevisionsMode"]] = None, + ingress: Optional["_models.Ingress"] = None, + registries: Optional[List["_models.RegistryCredentials"]] = None, + dapr: Optional["_models.Dapr"] = None, **kwargs ): """ @@ -1320,7 +1321,7 @@ def __init__( Multiple: multiple revisions can be active.Single: Only one revision can be active at a time. Revision weights can not be used in this mode. If no value if - provided, this is the default.. Possible values include: "Multiple", "Single". + provided, this is the default.. Known values are: "Multiple", "Single". :paramtype active_revisions_mode: str or ~azure.mgmt.appcontainers.models.ActiveRevisionsMode :keyword ingress: Ingress configurations. :paramtype ingress: ~azure.mgmt.appcontainers.models.Ingress @@ -1377,10 +1378,10 @@ def __init__( name: Optional[str] = None, command: Optional[List[str]] = None, args: Optional[List[str]] = None, - env: Optional[List["EnvironmentVar"]] = None, - resources: Optional["ContainerResources"] = None, - probes: Optional[List["ContainerAppProbe"]] = None, - volume_mounts: Optional[List["VolumeMount"]] = None, + env: Optional[List["_models.EnvironmentVar"]] = None, + resources: Optional["_models.ContainerResources"] = None, + probes: Optional[List["_models.ContainerAppProbe"]] = None, + volume_mounts: Optional[List["_models.VolumeMount"]] = None, **kwargs ): """ @@ -1437,7 +1438,7 @@ class ContainerApp(TrackedResource): :ivar identity: managed identities for the Container App to interact with other Azure services without maintaining any secrets or credentials in code. :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity - :ivar provisioning_state: Provisioning state of the Container App. Possible values include: + :ivar provisioning_state: Provisioning state of the Container App. Known values are: "InProgress", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.ContainerAppProvisioningState @@ -1494,10 +1495,10 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, managed_environment_id: Optional[str] = None, - configuration: Optional["Configuration"] = None, - template: Optional["Template"] = None, + configuration: Optional["_models.Configuration"] = None, + template: Optional["_models.Template"] = None, **kwargs ): """ @@ -1553,7 +1554,7 @@ class ContainerAppCollection(msrest.serialization.Model): def __init__( self, *, - value: List["ContainerApp"], + value: List["_models.ContainerApp"], **kwargs ): """ @@ -1599,7 +1600,7 @@ class ContainerAppProbe(msrest.serialization.Model): :ivar timeout_seconds: Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. Maximum value is 240. :vartype timeout_seconds: int - :ivar type: The type of probe. Possible values include: "Liveness", "Readiness", "Startup". + :ivar type: The type of probe. Known values are: "Liveness", "Readiness", "Startup". :vartype type: str or ~azure.mgmt.appcontainers.models.Type """ @@ -1619,14 +1620,14 @@ def __init__( self, *, failure_threshold: Optional[int] = None, - http_get: Optional["ContainerAppProbeHttpGet"] = None, + http_get: Optional["_models.ContainerAppProbeHttpGet"] = None, initial_delay_seconds: Optional[int] = None, period_seconds: Optional[int] = None, success_threshold: Optional[int] = None, - tcp_socket: Optional["ContainerAppProbeTcpSocket"] = None, + tcp_socket: Optional["_models.ContainerAppProbeTcpSocket"] = None, termination_grace_period_seconds: Optional[int] = None, timeout_seconds: Optional[int] = None, - type: Optional[Union[str, "Type"]] = None, + type: Optional[Union[str, "_models.Type"]] = None, **kwargs ): """ @@ -1661,7 +1662,7 @@ def __init__( :keyword timeout_seconds: Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. Maximum value is 240. :paramtype timeout_seconds: int - :keyword type: The type of probe. Possible values include: "Liveness", "Readiness", "Startup". + :keyword type: The type of probe. Known values are: "Liveness", "Readiness", "Startup". :paramtype type: str or ~azure.mgmt.appcontainers.models.Type """ super(ContainerAppProbe, self).__init__(**kwargs) @@ -1692,8 +1693,8 @@ class ContainerAppProbeHttpGet(msrest.serialization.Model): :ivar port: Required. Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. :vartype port: int - :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. Possible values - include: "HTTP", "HTTPS". + :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. Known values are: + "HTTP", "HTTPS". :vartype scheme: str or ~azure.mgmt.appcontainers.models.Scheme """ @@ -1714,9 +1715,9 @@ def __init__( *, port: int, host: Optional[str] = None, - http_headers: Optional[List["ContainerAppProbeHttpGetHttpHeadersItem"]] = None, + http_headers: Optional[List["_models.ContainerAppProbeHttpGetHttpHeadersItem"]] = None, path: Optional[str] = None, - scheme: Optional[Union[str, "Scheme"]] = None, + scheme: Optional[Union[str, "_models.Scheme"]] = None, **kwargs ): """ @@ -1731,8 +1732,8 @@ def __init__( :keyword port: Required. Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. :paramtype port: int - :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. Possible values - include: "HTTP", "HTTPS". + :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. Known values are: + "HTTP", "HTTPS". :paramtype scheme: str or ~azure.mgmt.appcontainers.models.Scheme """ super(ContainerAppProbeHttpGet, self).__init__(**kwargs) @@ -1899,8 +1900,8 @@ def __init__( class CookieExpiration(msrest.serialization.Model): """The configuration settings of the session cookie's expiration. - :ivar convention: The convention used when determining the session cookie's expiration. - Possible values include: "FixedTime", "IdentityProviderDerived". + :ivar convention: The convention used when determining the session cookie's expiration. Known + values are: "FixedTime", "IdentityProviderDerived". :vartype convention: str or ~azure.mgmt.appcontainers.models.CookieExpirationConvention :ivar time_to_expiration: The time after the request is made when the session cookie should expire. @@ -1915,13 +1916,13 @@ class CookieExpiration(msrest.serialization.Model): def __init__( self, *, - convention: Optional[Union[str, "CookieExpirationConvention"]] = None, + convention: Optional[Union[str, "_models.CookieExpirationConvention"]] = None, time_to_expiration: Optional[str] = None, **kwargs ): """ :keyword convention: The convention used when determining the session cookie's expiration. - Possible values include: "FixedTime", "IdentityProviderDerived". + Known values are: "FixedTime", "IdentityProviderDerived". :paramtype convention: str or ~azure.mgmt.appcontainers.models.CookieExpirationConvention :keyword time_to_expiration: The time after the request is made when the session cookie should expire. @@ -1939,8 +1940,7 @@ class CustomDomain(msrest.serialization.Model): :ivar name: Required. Hostname. :vartype name: str - :ivar binding_type: Custom Domain binding type. Possible values include: "Disabled", - "SniEnabled". + :ivar binding_type: Custom Domain binding type. Known values are: "Disabled", "SniEnabled". :vartype binding_type: str or ~azure.mgmt.appcontainers.models.BindingType :ivar certificate_id: Required. Resource Id of the Certificate to be bound to this hostname. Must exist in the Managed Environment. @@ -1963,14 +1963,13 @@ def __init__( *, name: str, certificate_id: str, - binding_type: Optional[Union[str, "BindingType"]] = None, + binding_type: Optional[Union[str, "_models.BindingType"]] = None, **kwargs ): """ :keyword name: Required. Hostname. :paramtype name: str - :keyword binding_type: Custom Domain binding type. Possible values include: "Disabled", - "SniEnabled". + :keyword binding_type: Custom Domain binding type. Known values are: "Disabled", "SniEnabled". :paramtype binding_type: str or ~azure.mgmt.appcontainers.models.BindingType :keyword certificate_id: Required. Resource Id of the Certificate to be bound to this hostname. Must exist in the Managed Environment. @@ -1982,28 +1981,17 @@ def __init__( self.certificate_id = certificate_id -class CustomHostnameAnalysisResult(ProxyResource): +class CustomHostnameAnalysisResult(msrest.serialization.Model): """Custom domain analysis. 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}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData :ivar host_name: Host name that was analyzed. :vartype host_name: str :ivar is_hostname_already_verified: :code:`true` if hostname is already verified; otherwise, :code:`false`. :vartype is_hostname_already_verified: bool - :ivar custom_domain_verification_test: DNS verification test result. Possible values include: + :ivar custom_domain_verification_test: DNS verification test result. Known values are: "Passed", "Failed", "Skipped". :vartype custom_domain_verification_test: str or ~azure.mgmt.appcontainers.models.DnsVerificationTestResult @@ -2030,10 +2018,6 @@ class CustomHostnameAnalysisResult(ProxyResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, 'host_name': {'readonly': True}, 'is_hostname_already_verified': {'readonly': True}, 'custom_domain_verification_test': {'readonly': True}, @@ -2043,21 +2027,17 @@ class CustomHostnameAnalysisResult(ProxyResource): } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'host_name': {'key': 'properties.hostName', 'type': 'str'}, - 'is_hostname_already_verified': {'key': 'properties.isHostnameAlreadyVerified', 'type': 'bool'}, - 'custom_domain_verification_test': {'key': 'properties.customDomainVerificationTest', 'type': 'str'}, - 'custom_domain_verification_failure_info': {'key': 'properties.customDomainVerificationFailureInfo', 'type': 'DefaultErrorResponse'}, - 'has_conflict_on_managed_environment': {'key': 'properties.hasConflictOnManagedEnvironment', 'type': 'bool'}, - 'conflicting_container_app_resource_id': {'key': 'properties.conflictingContainerAppResourceId', 'type': 'str'}, - 'c_name_records': {'key': 'properties.cNameRecords', 'type': '[str]'}, - 'txt_records': {'key': 'properties.txtRecords', 'type': '[str]'}, - 'a_records': {'key': 'properties.aRecords', 'type': '[str]'}, - 'alternate_c_name_records': {'key': 'properties.alternateCNameRecords', 'type': '[str]'}, - 'alternate_txt_records': {'key': 'properties.alternateTxtRecords', 'type': '[str]'}, + 'host_name': {'key': 'hostName', 'type': 'str'}, + 'is_hostname_already_verified': {'key': 'isHostnameAlreadyVerified', 'type': 'bool'}, + 'custom_domain_verification_test': {'key': 'customDomainVerificationTest', 'type': 'str'}, + 'custom_domain_verification_failure_info': {'key': 'customDomainVerificationFailureInfo', 'type': 'DefaultErrorResponse'}, + 'has_conflict_on_managed_environment': {'key': 'hasConflictOnManagedEnvironment', 'type': 'bool'}, + 'conflicting_container_app_resource_id': {'key': 'conflictingContainerAppResourceId', 'type': 'str'}, + 'c_name_records': {'key': 'cNameRecords', 'type': '[str]'}, + 'txt_records': {'key': 'txtRecords', 'type': '[str]'}, + 'a_records': {'key': 'aRecords', 'type': '[str]'}, + 'alternate_c_name_records': {'key': 'alternateCNameRecords', 'type': '[str]'}, + 'alternate_txt_records': {'key': 'alternateTxtRecords', 'type': '[str]'}, } def __init__( @@ -2120,8 +2100,8 @@ def __init__( self, *, enabled: Optional[bool] = None, - registration: Optional["OpenIdConnectRegistration"] = None, - login: Optional["OpenIdConnectLogin"] = None, + registration: Optional["_models.OpenIdConnectRegistration"] = None, + login: Optional["_models.OpenIdConnectLogin"] = None, **kwargs ): """ @@ -2164,7 +2144,7 @@ def __init__( *, type: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["ScaleRuleAuth"]] = None, + auth: Optional[List["_models.ScaleRuleAuth"]] = None, **kwargs ): """ @@ -2190,7 +2170,7 @@ class Dapr(msrest.serialization.Model): :ivar app_id: Dapr application identifier. :vartype app_id: str :ivar app_protocol: Tells Dapr which protocol your application is using. Valid options are http - and grpc. Default is http. Possible values include: "http", "grpc". + and grpc. Default is http. Known values are: "http", "grpc". :vartype app_protocol: str or ~azure.mgmt.appcontainers.models.AppProtocol :ivar app_port: Tells Dapr which port your application is listening on. :vartype app_port: int @@ -2208,7 +2188,7 @@ def __init__( *, enabled: Optional[bool] = None, app_id: Optional[str] = None, - app_protocol: Optional[Union[str, "AppProtocol"]] = None, + app_protocol: Optional[Union[str, "_models.AppProtocol"]] = None, app_port: Optional[int] = None, **kwargs ): @@ -2218,7 +2198,7 @@ def __init__( :keyword app_id: Dapr application identifier. :paramtype app_id: str :keyword app_protocol: Tells Dapr which protocol your application is using. Valid options are - http and grpc. Default is http. Possible values include: "http", "grpc". + http and grpc. Default is http. Known values are: "http", "grpc". :paramtype app_protocol: str or ~azure.mgmt.appcontainers.models.AppProtocol :keyword app_port: Tells Dapr which port your application is listening on. :paramtype app_port: int @@ -2290,8 +2270,8 @@ def __init__( version: Optional[str] = None, ignore_errors: Optional[bool] = None, init_timeout: Optional[str] = None, - secrets: Optional[List["Secret"]] = None, - metadata: Optional[List["DaprMetadata"]] = None, + secrets: Optional[List["_models.Secret"]] = None, + metadata: Optional[List["_models.DaprMetadata"]] = None, scopes: Optional[List[str]] = None, **kwargs ): @@ -2347,7 +2327,7 @@ class DaprComponentsCollection(msrest.serialization.Model): def __init__( self, *, - value: List["DaprComponent"], + value: List["_models.DaprComponent"], **kwargs ): """ @@ -2420,7 +2400,7 @@ class DaprSecretsCollection(msrest.serialization.Model): def __init__( self, *, - value: List["Secret"], + value: List["_models.Secret"], **kwargs ): """ @@ -2450,7 +2430,7 @@ class DefaultAuthorizationPolicy(msrest.serialization.Model): def __init__( self, *, - allowed_principals: Optional["AllowedPrincipals"] = None, + allowed_principals: Optional["_models.AllowedPrincipals"] = None, allowed_applications: Optional[List[str]] = None, **kwargs ): @@ -2529,7 +2509,7 @@ class DefaultErrorResponseError(msrest.serialization.Model): def __init__( self, *, - details: Optional[List["DefaultErrorResponseErrorDetailsItem"]] = None, + details: Optional[List["_models.DefaultErrorResponseErrorDetailsItem"]] = None, **kwargs ): """ @@ -2648,9 +2628,9 @@ def __init__( self, *, enabled: Optional[bool] = None, - registration: Optional["AppRegistration"] = None, + registration: Optional["_models.AppRegistration"] = None, graph_api_version: Optional[str] = None, - login: Optional["LoginScopes"] = None, + login: Optional["_models.LoginScopes"] = None, **kwargs ): """ @@ -2675,8 +2655,8 @@ def __init__( class ForwardProxy(msrest.serialization.Model): """The configuration settings of a forward proxy used to make the requests. - :ivar convention: The convention used to determine the url of the request made. Possible values - include: "NoProxy", "Standard", "Custom". + :ivar convention: The convention used to determine the url of the request made. Known values + are: "NoProxy", "Standard", "Custom". :vartype convention: str or ~azure.mgmt.appcontainers.models.ForwardProxyConvention :ivar custom_host_header_name: The name of the header containing the host of the request. :vartype custom_host_header_name: str @@ -2693,14 +2673,14 @@ class ForwardProxy(msrest.serialization.Model): def __init__( self, *, - convention: Optional[Union[str, "ForwardProxyConvention"]] = None, + convention: Optional[Union[str, "_models.ForwardProxyConvention"]] = None, custom_host_header_name: Optional[str] = None, custom_proto_header_name: Optional[str] = None, **kwargs ): """ - :keyword convention: The convention used to determine the url of the request made. Possible - values include: "NoProxy", "Standard", "Custom". + :keyword convention: The convention used to determine the url of the request made. Known values + are: "NoProxy", "Standard", "Custom". :paramtype convention: str or ~azure.mgmt.appcontainers.models.ForwardProxyConvention :keyword custom_host_header_name: The name of the header containing the host of the request. :paramtype custom_host_header_name: str @@ -2735,8 +2715,8 @@ def __init__( self, *, enabled: Optional[bool] = None, - registration: Optional["ClientRegistration"] = None, - login: Optional["LoginScopes"] = None, + registration: Optional["_models.ClientRegistration"] = None, + login: Optional["_models.LoginScopes"] = None, **kwargs ): """ @@ -2790,8 +2770,8 @@ class GithubActionConfiguration(msrest.serialization.Model): def __init__( self, *, - registry_info: Optional["RegistryInfo"] = None, - azure_credentials: Optional["AzureCredentials"] = None, + registry_info: Optional["_models.RegistryInfo"] = None, + azure_credentials: Optional["_models.AzureCredentials"] = None, context_path: Optional[str] = None, image: Optional[str] = None, publish_type: Optional[str] = None, @@ -2833,8 +2813,8 @@ class GlobalValidation(msrest.serialization.Model): """The configuration settings that determines the validation flow of users using ContainerApp Service Authentication/Authorization. :ivar unauthenticated_client_action: The action to take when an unauthenticated client attempts - to access the app. Possible values include: "RedirectToLoginPage", "AllowAnonymous", - "Return401", "Return403". + to access the app. Known values are: "RedirectToLoginPage", "AllowAnonymous", "Return401", + "Return403". :vartype unauthenticated_client_action: str or ~azure.mgmt.appcontainers.models.UnauthenticatedClientActionV2 :ivar redirect_to_provider: The default authentication provider to use when multiple providers @@ -2857,14 +2837,14 @@ class GlobalValidation(msrest.serialization.Model): def __init__( self, *, - unauthenticated_client_action: Optional[Union[str, "UnauthenticatedClientActionV2"]] = None, + unauthenticated_client_action: Optional[Union[str, "_models.UnauthenticatedClientActionV2"]] = None, redirect_to_provider: Optional[str] = None, excluded_paths: Optional[List[str]] = None, **kwargs ): """ :keyword unauthenticated_client_action: The action to take when an unauthenticated client - attempts to access the app. Possible values include: "RedirectToLoginPage", "AllowAnonymous", + attempts to access the app. Known values are: "RedirectToLoginPage", "AllowAnonymous", "Return401", "Return403". :paramtype unauthenticated_client_action: str or ~azure.mgmt.appcontainers.models.UnauthenticatedClientActionV2 @@ -2910,9 +2890,9 @@ def __init__( self, *, enabled: Optional[bool] = None, - registration: Optional["ClientRegistration"] = None, - login: Optional["LoginScopes"] = None, - validation: Optional["AllowedAudiencesValidation"] = None, + registration: Optional["_models.ClientRegistration"] = None, + login: Optional["_models.LoginScopes"] = None, + validation: Optional["_models.AllowedAudiencesValidation"] = None, **kwargs ): """ @@ -2953,7 +2933,7 @@ def __init__( self, *, metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["ScaleRuleAuth"]] = None, + auth: Optional[List["_models.ScaleRuleAuth"]] = None, **kwargs ): """ @@ -2989,8 +2969,8 @@ def __init__( self, *, require_https: Optional[bool] = None, - routes: Optional["HttpSettingsRoutes"] = None, - forward_proxy: Optional["ForwardProxy"] = None, + routes: Optional["_models.HttpSettingsRoutes"] = None, + forward_proxy: Optional["_models.ForwardProxy"] = None, **kwargs ): """ @@ -3073,14 +3053,14 @@ class IdentityProviders(msrest.serialization.Model): def __init__( self, *, - azure_active_directory: Optional["AzureActiveDirectory"] = None, - facebook: Optional["Facebook"] = None, - git_hub: Optional["GitHub"] = None, - google: Optional["Google"] = None, - twitter: Optional["Twitter"] = None, - apple: Optional["Apple"] = None, - azure_static_web_apps: Optional["AzureStaticWebApps"] = None, - custom_open_id_connect_providers: Optional[Dict[str, "CustomOpenIdConnectProvider"]] = None, + azure_active_directory: Optional["_models.AzureActiveDirectory"] = None, + facebook: Optional["_models.Facebook"] = None, + git_hub: Optional["_models.GitHub"] = None, + google: Optional["_models.Google"] = None, + twitter: Optional["_models.Twitter"] = None, + apple: Optional["_models.Apple"] = None, + azure_static_web_apps: Optional["_models.AzureStaticWebApps"] = None, + custom_open_id_connect_providers: Optional[Dict[str, "_models.CustomOpenIdConnectProvider"]] = None, **kwargs ): """ @@ -3128,7 +3108,7 @@ class Ingress(msrest.serialization.Model): :vartype external: bool :ivar target_port: Target Port in containers for traffic from ingress. :vartype target_port: int - :ivar transport: Ingress transport protocol. Possible values include: "auto", "http", "http2". + :ivar transport: Ingress transport protocol. Known values are: "auto", "http", "http2". :vartype transport: str or ~azure.mgmt.appcontainers.models.IngressTransportMethod :ivar traffic: Traffic weights for app's revisions. :vartype traffic: list[~azure.mgmt.appcontainers.models.TrafficWeight] @@ -3158,9 +3138,9 @@ def __init__( *, external: Optional[bool] = False, target_port: Optional[int] = None, - transport: Optional[Union[str, "IngressTransportMethod"]] = None, - traffic: Optional[List["TrafficWeight"]] = None, - custom_domains: Optional[List["CustomDomain"]] = None, + transport: Optional[Union[str, "_models.IngressTransportMethod"]] = None, + traffic: Optional[List["_models.TrafficWeight"]] = None, + custom_domains: Optional[List["_models.CustomDomain"]] = None, allow_insecure: Optional[bool] = None, **kwargs ): @@ -3169,8 +3149,7 @@ def __init__( :paramtype external: bool :keyword target_port: Target Port in containers for traffic from ingress. :paramtype target_port: int - :keyword transport: Ingress transport protocol. Possible values include: "auto", "http", - "http2". + :keyword transport: Ingress transport protocol. Known values are: "auto", "http", "http2". :paramtype transport: str or ~azure.mgmt.appcontainers.models.IngressTransportMethod :keyword traffic: Traffic weights for app's revisions. :paramtype traffic: list[~azure.mgmt.appcontainers.models.TrafficWeight] @@ -3284,11 +3263,11 @@ class Login(msrest.serialization.Model): def __init__( self, *, - routes: Optional["LoginRoutes"] = None, + routes: Optional["_models.LoginRoutes"] = None, preserve_url_fragments_for_logins: Optional[bool] = None, allowed_external_redirect_urls: Optional[List[str]] = None, - cookie_expiration: Optional["CookieExpiration"] = None, - nonce: Optional["Nonce"] = None, + cookie_expiration: Optional["_models.CookieExpiration"] = None, + nonce: Optional["_models.Nonce"] = None, **kwargs ): """ @@ -3387,10 +3366,9 @@ class ManagedEnvironment(TrackedResource): :vartype tags: dict[str, str] :ivar location: Required. The geo-location where the resource lives. :vartype location: str - :ivar provisioning_state: Provisioning state of the Environment. Possible values include: - "Succeeded", "Failed", "Canceled", "Waiting", "InitializationInProgress", - "InfrastructureSetupInProgress", "InfrastructureSetupComplete", "ScheduledForDelete", - "UpgradeRequested", "UpgradeFailed". + :ivar provisioning_state: Provisioning state of the Environment. Known values are: "Succeeded", + "Failed", "Canceled", "Waiting", "InitializationInProgress", "InfrastructureSetupInProgress", + "InfrastructureSetupComplete", "ScheduledForDelete", "UpgradeRequested", "UpgradeFailed". :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.EnvironmentProvisioningState :ivar dapr_ai_instrumentation_key: Azure Monitor instrumentation key used by Dapr to export @@ -3452,8 +3430,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, dapr_ai_instrumentation_key: Optional[str] = None, dapr_ai_connection_string: Optional[str] = None, - vnet_configuration: Optional["VnetConfiguration"] = None, - app_logs_configuration: Optional["AppLogsConfiguration"] = None, + vnet_configuration: Optional["_models.VnetConfiguration"] = None, + app_logs_configuration: Optional["_models.AppLogsConfiguration"] = None, zone_redundant: Optional[bool] = None, **kwargs ): @@ -3515,7 +3493,7 @@ class ManagedEnvironmentsCollection(msrest.serialization.Model): def __init__( self, *, - value: List["ManagedEnvironment"], + value: List["_models.ManagedEnvironment"], **kwargs ): """ @@ -3565,7 +3543,7 @@ class ManagedEnvironmentStorage(ProxyResource): def __init__( self, *, - properties: Optional["ManagedEnvironmentStorageProperties"] = None, + properties: Optional["_models.ManagedEnvironmentStorageProperties"] = None, **kwargs ): """ @@ -3590,7 +3568,7 @@ class ManagedEnvironmentStorageProperties(msrest.serialization.Model): def __init__( self, *, - azure_file: Optional["AzureFileProperties"] = None, + azure_file: Optional["_models.AzureFileProperties"] = None, **kwargs ): """ @@ -3621,7 +3599,7 @@ class ManagedEnvironmentStoragesCollection(msrest.serialization.Model): def __init__( self, *, - value: List["ManagedEnvironmentStorage"], + value: List["_models.ManagedEnvironmentStorage"], **kwargs ): """ @@ -3646,8 +3624,8 @@ class ManagedServiceIdentity(msrest.serialization.Model): provided for a system assigned identity. :vartype tenant_id: str :ivar type: Required. Type of managed service identity (where both SystemAssigned and - UserAssigned types are allowed). Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned". + UserAssigned types are allowed). Known values are: "None", "SystemAssigned", "UserAssigned", + "SystemAssigned,UserAssigned". :vartype type: str or ~azure.mgmt.appcontainers.models.ManagedServiceIdentityType :ivar user_assigned_identities: The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: @@ -3673,14 +3651,14 @@ class ManagedServiceIdentity(msrest.serialization.Model): def __init__( self, *, - type: Union[str, "ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, **kwargs ): """ :keyword type: Required. Type of managed service identity (where both SystemAssigned and - UserAssigned types are allowed). Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned". + UserAssigned types are allowed). Known values are: "None", "SystemAssigned", "UserAssigned", + "SystemAssigned,UserAssigned". :paramtype type: str or ~azure.mgmt.appcontainers.models.ManagedServiceIdentityType :keyword user_assigned_identities: The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: @@ -3878,8 +3856,8 @@ def __init__( self, *, client_id: Optional[str] = None, - client_credential: Optional["OpenIdConnectClientCredential"] = None, - open_id_connect_configuration: Optional["OpenIdConnectConfig"] = None, + client_credential: Optional["_models.OpenIdConnectClientCredential"] = None, + open_id_connect_configuration: Optional["_models.OpenIdConnectConfig"] = None, **kwargs ): """ @@ -3923,7 +3901,7 @@ def __init__( *, name: Optional[str] = None, is_data_action: Optional[bool] = None, - display: Optional["OperationDisplay"] = None, + display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, **kwargs ): @@ -4012,7 +3990,7 @@ def __init__( *, queue_name: Optional[str] = None, queue_length: Optional[int] = None, - auth: Optional[List["ScaleRuleAuth"]] = None, + auth: Optional[List["_models.ScaleRuleAuth"]] = None, **kwargs ): """ @@ -4160,7 +4138,7 @@ class Replica(ProxyResource): def __init__( self, *, - containers: Optional[List["ReplicaContainer"]] = None, + containers: Optional[List["_models.ReplicaContainer"]] = None, **kwargs ): """ @@ -4192,7 +4170,7 @@ class ReplicaCollection(msrest.serialization.Model): def __init__( self, *, - value: List["Replica"], + value: List["_models.Replica"], **kwargs ): """ @@ -4289,10 +4267,10 @@ class Revision(ProxyResource): :vartype traffic_weight: int :ivar provisioning_error: Optional Field - Platform Error Message. :vartype provisioning_error: str - :ivar health_state: Current health State of the revision. Possible values include: "Healthy", + :ivar health_state: Current health State of the revision. Known values are: "Healthy", "Unhealthy", "None". :vartype health_state: str or ~azure.mgmt.appcontainers.models.RevisionHealthState - :ivar provisioning_state: Current provisioning State of the revision. Possible values include: + :ivar provisioning_state: Current provisioning State of the revision. Known values are: "Provisioning", "Provisioned", "Failed", "Deprovisioning", "Deprovisioned". :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.RevisionProvisioningState """ @@ -4373,7 +4351,7 @@ class RevisionCollection(msrest.serialization.Model): def __init__( self, *, - value: List["Revision"], + value: List["_models.Revision"], **kwargs ): """ @@ -4407,7 +4385,7 @@ def __init__( *, min_replicas: Optional[int] = None, max_replicas: Optional[int] = None, - rules: Optional[List["ScaleRule"]] = None, + rules: Optional[List["_models.ScaleRule"]] = None, **kwargs ): """ @@ -4449,9 +4427,9 @@ def __init__( self, *, name: Optional[str] = None, - azure_queue: Optional["QueueScaleRule"] = None, - custom: Optional["CustomScaleRule"] = None, - http: Optional["HttpScaleRule"] = None, + azure_queue: Optional["_models.QueueScaleRule"] = None, + custom: Optional["_models.CustomScaleRule"] = None, + http: Optional["_models.HttpScaleRule"] = None, **kwargs ): """ @@ -4555,7 +4533,7 @@ class SecretsCollection(msrest.serialization.Model): def __init__( self, *, - value: List["ContainerAppSecret"], + value: List["_models.ContainerAppSecret"], **kwargs ): """ @@ -4582,7 +4560,7 @@ class SourceControl(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar operation_state: Current provisioning State of the operation. Possible values include: + :ivar operation_state: Current provisioning State of the operation. Known values are: "InProgress", "Succeeded", "Failed", "Canceled". :vartype operation_state: str or ~azure.mgmt.appcontainers.models.SourceControlOperationState :ivar repo_url: The repo url which will be integrated to ContainerApp. @@ -4621,7 +4599,7 @@ def __init__( *, repo_url: Optional[str] = None, branch: Optional[str] = None, - github_action_configuration: Optional["GithubActionConfiguration"] = None, + github_action_configuration: Optional["_models.GithubActionConfiguration"] = None, **kwargs ): """ @@ -4669,7 +4647,7 @@ class SourceControlCollection(msrest.serialization.Model): def __init__( self, *, - value: List["SourceControl"], + value: List["_models.SourceControl"], **kwargs ): """ @@ -4686,15 +4664,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.appcontainers.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.appcontainers.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). :vartype last_modified_at: ~datetime.datetime @@ -4713,25 +4691,25 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.appcontainers.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.appcontainers.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime @@ -4771,9 +4749,9 @@ def __init__( self, *, revision_suffix: Optional[str] = None, - containers: Optional[List["Container"]] = None, - scale: Optional["Scale"] = None, - volumes: Optional[List["Volume"]] = None, + containers: Optional[List["_models.Container"]] = None, + scale: Optional["_models.Scale"] = None, + volumes: Optional[List["_models.Volume"]] = None, **kwargs ): """ @@ -4860,7 +4838,7 @@ def __init__( self, *, enabled: Optional[bool] = None, - registration: Optional["TwitterRegistration"] = None, + registration: Optional["_models.TwitterRegistration"] = None, **kwargs ): """ @@ -4952,8 +4930,8 @@ class VnetConfiguration(msrest.serialization.Model): """Configuration properties for apps environment to join a Virtual Network. :ivar internal: Boolean indicating the environment only has an internal load balancer. These - environments do not have a public static IP resource, must provide ControlPlaneSubnetResourceId - and AppSubnetResourceId if enabling this property. + environments do not have a public static IP resource. They must provide runtimeSubnetId and + infrastructureSubnetId if enabling this property. :vartype internal: bool :ivar infrastructure_subnet_id: Resource ID of a subnet for infrastructure components. This subnet must be in the same VNET as the subnet defined in runtimeSubnetId. Must not overlap with @@ -4996,8 +4974,8 @@ def __init__( ): """ :keyword internal: Boolean indicating the environment only has an internal load balancer. These - environments do not have a public static IP resource, must provide ControlPlaneSubnetResourceId - and AppSubnetResourceId if enabling this property. + environments do not have a public static IP resource. They must provide runtimeSubnetId and + infrastructureSubnetId if enabling this property. :paramtype internal: bool :keyword infrastructure_subnet_id: Resource ID of a subnet for infrastructure components. This subnet must be in the same VNET as the subnet defined in runtimeSubnetId. Must not overlap with @@ -5031,8 +5009,8 @@ class Volume(msrest.serialization.Model): :ivar name: Volume name. :vartype name: str - :ivar storage_type: Storage type for the volume. If not provided, use EmptyDir. Possible values - include: "AzureFile", "EmptyDir". + :ivar storage_type: Storage type for the volume. If not provided, use EmptyDir. Known values + are: "AzureFile", "EmptyDir". :vartype storage_type: str or ~azure.mgmt.appcontainers.models.StorageType :ivar storage_name: Name of storage resource. No need to provide for EmptyDir. :vartype storage_name: str @@ -5048,15 +5026,15 @@ def __init__( self, *, name: Optional[str] = None, - storage_type: Optional[Union[str, "StorageType"]] = None, + storage_type: Optional[Union[str, "_models.StorageType"]] = None, storage_name: Optional[str] = None, **kwargs ): """ :keyword name: Volume name. :paramtype name: str - :keyword storage_type: Storage type for the volume. If not provided, use EmptyDir. Possible - values include: "AzureFile", "EmptyDir". + :keyword storage_type: Storage type for the volume. If not provided, use EmptyDir. Known values + are: "AzureFile", "EmptyDir". :paramtype storage_type: str or ~azure.mgmt.appcontainers.models.StorageType :keyword storage_name: Name of storage resource. No need to provide for EmptyDir. :paramtype storage_name: str diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py index 505be253220b..30d9a2b2a7a3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py @@ -18,6 +18,9 @@ from ._managed_environments_storages_operations import ManagedEnvironmentsStoragesOperations from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'ContainerAppsAuthConfigsOperations', 'ContainerAppsOperations', @@ -31,3 +34,5 @@ 'ManagedEnvironmentsStoragesOperations', 'ContainerAppsSourceControlsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py index cb582da44c7d..c03c6df160ef 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py @@ -16,12 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( environment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( certificate_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( environment_name: str, certificate_name: str, *, - json: JSONType = None, + json: Optional[_models.Certificate] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( certificate_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,18 +175,16 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -191,14 +195,17 @@ def build_update_request( environment_name: str, certificate_name: str, *, - json: JSONType = None, + json: Optional[_models.CertificatePatch] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}") # pylint: disable=line-too-long path_format_arguments = { @@ -211,46 +218,42 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class CertificatesOperations(object): - """CertificatesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class CertificatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`certificates` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( @@ -258,7 +261,7 @@ def list( resource_group_name: str, environment_name: str, **kwargs: Any - ) -> Iterable["_models.CertificateCollection"]: + ) -> Iterable[_models.CertificateCollection]: """Get the Certificates in a given managed environment. Get the Certificates in a given managed environment. @@ -273,13 +276,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.CertificateCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CertificateCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -289,9 +295,11 @@ def prepare_request(next_link=None): environment_name=environment_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -301,9 +309,11 @@ def prepare_request(next_link=None): environment_name=environment_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -344,7 +354,7 @@ def get( environment_name: str, certificate_name: str, **kwargs: Any - ) -> "_models.Certificate": + ) -> _models.Certificate: """Get the specified Certificate. Get the specified Certificate. @@ -360,13 +370,16 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Certificate"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Certificate] request = build_get_request( @@ -376,11 +389,13 @@ def get( certificate_name=certificate_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -408,9 +423,9 @@ def create_or_update( resource_group_name: str, environment_name: str, certificate_name: str, - certificate_envelope: Optional["_models.Certificate"] = None, + certificate_envelope: Optional[_models.Certificate] = None, **kwargs: Any - ) -> "_models.Certificate": + ) -> _models.Certificate: """Create or Update a Certificate. Create or Update a Certificate. @@ -428,14 +443,17 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Certificate"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Certificate] if certificate_envelope is not None: _json = self._serialize.body(certificate_envelope, 'Certificate') @@ -451,11 +469,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -500,13 +520,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -516,11 +539,13 @@ def delete( # pylint: disable=inconsistent-return-statements certificate_name=certificate_name, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -544,9 +569,9 @@ def update( resource_group_name: str, environment_name: str, certificate_name: str, - certificate_envelope: "_models.CertificatePatch", + certificate_envelope: _models.CertificatePatch, **kwargs: Any - ) -> "_models.Certificate": + ) -> _models.Certificate: """Update properties of a certificate. Patches a certificate. Currently only patching of tags is supported. @@ -564,14 +589,17 @@ def update( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Certificate"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Certificate] _json = self._serialize.body(certificate_envelope, 'CertificatePatch') @@ -584,11 +612,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py index b781f9a33621..ff38a8382525 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py @@ -16,12 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_container_app_request( container_app_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_by_container_app_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( auth_config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( container_app_name: str, auth_config_name: str, *, - json: JSONType = None, + json: Optional[_models.AuthConfig] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( auth_config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ContainerAppsAuthConfigsOperations(object): - """ContainerAppsAuthConfigsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ContainerAppsAuthConfigsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_auth_configs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_container_app( @@ -212,7 +214,7 @@ def list_by_container_app( resource_group_name: str, container_app_name: str, **kwargs: Any - ) -> Iterable["_models.AuthConfigCollection"]: + ) -> Iterable[_models.AuthConfigCollection]: """Get the Container App AuthConfigs in a given resource group. Get the Container App AuthConfigs in a given resource group. @@ -227,13 +229,16 @@ def list_by_container_app( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.AuthConfigCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AuthConfigCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthConfigCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -243,9 +248,11 @@ def prepare_request(next_link=None): container_app_name=container_app_name, api_version=api_version, template_url=self.list_by_container_app.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -255,9 +262,11 @@ def prepare_request(next_link=None): container_app_name=container_app_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -298,7 +307,7 @@ def get( container_app_name: str, auth_config_name: str, **kwargs: Any - ) -> "_models.AuthConfig": + ) -> _models.AuthConfig: """Get a AuthConfig of a Container App. Get a AuthConfig of a Container App. @@ -314,13 +323,16 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.AuthConfig :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthConfig"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AuthConfig] request = build_get_request( @@ -330,11 +342,13 @@ def get( auth_config_name=auth_config_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -362,12 +376,12 @@ def create_or_update( resource_group_name: str, container_app_name: str, auth_config_name: str, - auth_config_envelope: "_models.AuthConfig", + auth_config_envelope: _models.AuthConfig, **kwargs: Any - ) -> "_models.AuthConfig": + ) -> _models.AuthConfig: """Create or update the AuthConfig for a Container App. - Description for Create or update the AuthConfig for a Container App. + Create or update the AuthConfig for a Container App. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str @@ -382,14 +396,17 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.AuthConfig :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthConfig"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AuthConfig] _json = self._serialize.body(auth_config_envelope, 'AuthConfig') @@ -402,11 +419,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -438,7 +457,7 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete a Container App AuthConfig. - Description for Delete a Container App AuthConfig. + Delete a Container App AuthConfig. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str @@ -451,13 +470,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -467,11 +489,13 @@ def delete( # pylint: disable=inconsistent-return-statements auth_config_name=auth_config_name, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py index 23362edb8dd9..ecfb40f3b7fe 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_by_subscription_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_request( container_app_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -136,14 +139,17 @@ def build_create_or_update_request_initial( resource_group_name: str, container_app_name: str, *, - json: JSONType = None, + json: Optional[_models.ContainerApp] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}") # pylint: disable=line-too-long path_format_arguments = { @@ -155,20 +161,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -181,9 +185,12 @@ def build_delete_request_initial( container_app_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}") # pylint: disable=line-too-long path_format_arguments = { @@ -195,18 +202,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -216,14 +221,17 @@ def build_update_request_initial( resource_group_name: str, container_app_name: str, *, - json: JSONType = None, + json: Optional[_models.ContainerApp] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}") # pylint: disable=line-too-long path_format_arguments = { @@ -235,20 +243,18 @@ def build_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -263,9 +269,12 @@ def build_list_custom_host_name_analysis_request( custom_hostname: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listCustomHostNameAnalysis") # pylint: disable=line-too-long path_format_arguments = { @@ -277,20 +286,18 @@ def build_list_custom_host_name_analysis_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if custom_hostname is not None: - _query_parameters['customHostname'] = _SERIALIZER.query("custom_hostname", custom_hostname, 'str') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['customHostname'] = _SERIALIZER.query("custom_hostname", custom_hostname, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -301,9 +308,12 @@ def build_list_secrets_request( container_app_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listSecrets") # pylint: disable=line-too-long path_format_arguments = { @@ -315,48 +325,44 @@ def build_list_secrets_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ContainerAppsOperations(object): - """ContainerAppsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ContainerAppsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_subscription( self, **kwargs: Any - ) -> Iterable["_models.ContainerAppCollection"]: + ) -> Iterable[_models.ContainerAppCollection]: """Get the Container Apps in a given subscription. Get the Container Apps in a given subscription. @@ -367,13 +373,16 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ContainerAppCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerAppCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerAppCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -381,9 +390,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -391,9 +402,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -432,7 +445,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ContainerAppCollection"]: + ) -> Iterable[_models.ContainerAppCollection]: """Get the Container Apps in a given resource group. Get the Container Apps in a given resource group. @@ -445,13 +458,16 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ContainerAppCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerAppCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerAppCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -460,9 +476,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -471,9 +489,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -513,7 +533,7 @@ def get( resource_group_name: str, container_app_name: str, **kwargs: Any - ) -> "_models.ContainerApp": + ) -> _models.ContainerApp: """Get the properties of a Container App. Get the properties of a Container App. @@ -527,13 +547,16 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.ContainerApp :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerApp"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerApp] request = build_get_request( @@ -542,11 +565,13 @@ def get( container_app_name=container_app_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -572,17 +597,20 @@ def _create_or_update_initial( self, resource_group_name: str, container_app_name: str, - container_app_envelope: "_models.ContainerApp", + container_app_envelope: _models.ContainerApp, **kwargs: Any - ) -> "_models.ContainerApp": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerApp"] + ) -> _models.ContainerApp: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerApp] _json = self._serialize.body(container_app_envelope, 'ContainerApp') @@ -594,11 +622,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -628,12 +658,12 @@ def begin_create_or_update( self, resource_group_name: str, container_app_name: str, - container_app_envelope: "_models.ContainerApp", + container_app_envelope: _models.ContainerApp, **kwargs: Any - ) -> LROPoller["_models.ContainerApp"]: + ) -> LROPoller[_models.ContainerApp]: """Create or update a Container App. - Description for Create or update a Container App. + Create or update a Container App. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str @@ -654,37 +684,47 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ContainerApp] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerApp] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerApp"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, container_app_name=container_app_name, container_app_envelope=container_app_envelope, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ContainerApp', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -703,13 +743,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements container_app_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -718,11 +761,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements container_app_name=container_app_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -748,7 +793,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements ) -> LROPoller[None]: """Delete a Container App. - Description for Delete a Container App. + Delete a Container App. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str @@ -766,20 +811,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, container_app_name=container_app_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -789,8 +839,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -807,17 +863,20 @@ def _update_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, container_app_name: str, - container_app_envelope: "_models.ContainerApp", + container_app_envelope: _models.ContainerApp, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(container_app_envelope, 'ContainerApp') @@ -829,11 +888,13 @@ def _update_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -855,7 +916,7 @@ def begin_update( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, container_app_name: str, - container_app_envelope: "_models.ContainerApp", + container_app_envelope: _models.ContainerApp, **kwargs: Any ) -> LROPoller[None]: """Update properties of a Container App. @@ -880,23 +941,28 @@ def begin_update( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, container_app_name=container_app_name, container_app_envelope=container_app_envelope, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -906,8 +972,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -927,7 +999,7 @@ def list_custom_host_name_analysis( container_app_name: str, custom_hostname: Optional[str] = None, **kwargs: Any - ) -> "_models.CustomHostnameAnalysisResult": + ) -> _models.CustomHostnameAnalysisResult: """Analyzes a custom hostname for a Container App. Analyzes a custom hostname for a Container App. @@ -943,13 +1015,16 @@ def list_custom_host_name_analysis( :rtype: ~azure.mgmt.appcontainers.models.CustomHostnameAnalysisResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomHostnameAnalysisResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CustomHostnameAnalysisResult] request = build_list_custom_host_name_analysis_request( @@ -959,11 +1034,13 @@ def list_custom_host_name_analysis( api_version=api_version, custom_hostname=custom_hostname, template_url=self.list_custom_host_name_analysis.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -991,7 +1068,7 @@ def list_secrets( resource_group_name: str, container_app_name: str, **kwargs: Any - ) -> "_models.SecretsCollection": + ) -> _models.SecretsCollection: """List secrets for a container app. List secrets for a container app. @@ -1005,13 +1082,16 @@ def list_secrets( :rtype: ~azure.mgmt.appcontainers.models.SecretsCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretsCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SecretsCollection] request = build_list_secrets_request( @@ -1020,11 +1100,13 @@ def list_secrets( container_app_name=container_app_name, api_version=api_version, template_url=self.list_secrets.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py index ea265a1598bf..63852e6b6dff 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py @@ -15,6 +15,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -33,9 +34,12 @@ def build_get_replica_request( replica_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{replicaName}") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +53,16 @@ def build_get_replica_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +74,12 @@ def build_list_replicas_request( revision_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas") # pylint: disable=line-too-long path_format_arguments = { @@ -87,42 +92,38 @@ def build_list_replicas_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ContainerAppsRevisionReplicasOperations(object): - """ContainerAppsRevisionReplicasOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ContainerAppsRevisionReplicasOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_revision_replicas` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def get_replica( @@ -132,7 +133,7 @@ def get_replica( revision_name: str, replica_name: str, **kwargs: Any - ) -> "_models.Replica": + ) -> _models.Replica: """Get a replica for a Container App Revision. Get a replica for a Container App Revision. @@ -150,13 +151,16 @@ def get_replica( :rtype: ~azure.mgmt.appcontainers.models.Replica :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Replica"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Replica] request = build_get_replica_request( @@ -167,11 +171,13 @@ def get_replica( replica_name=replica_name, api_version=api_version, template_url=self.get_replica.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,7 +206,7 @@ def list_replicas( container_app_name: str, revision_name: str, **kwargs: Any - ) -> "_models.ReplicaCollection": + ) -> _models.ReplicaCollection: """List replicas for a Container App Revision. List replicas for a Container App Revision. @@ -216,13 +222,16 @@ def list_replicas( :rtype: ~azure.mgmt.appcontainers.models.ReplicaCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicaCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ReplicaCollection] request = build_list_replicas_request( @@ -232,11 +241,13 @@ def list_replicas( revision_name=revision_name, api_version=api_version, template_url=self.list_replicas.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py index 680c301f55cd..dbf7cd1597a1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -34,9 +35,12 @@ def build_list_revisions_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions") # pylint: disable=line-too-long path_format_arguments = { @@ -48,20 +52,18 @@ def build_list_revisions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -73,9 +75,12 @@ def build_get_revision_request( revision_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -88,18 +93,16 @@ def build_get_revision_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -111,9 +114,12 @@ def build_activate_revision_request( revision_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/activate") # pylint: disable=line-too-long path_format_arguments = { @@ -126,18 +132,16 @@ def build_activate_revision_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -149,9 +153,12 @@ def build_deactivate_revision_request( revision_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/deactivate") # pylint: disable=line-too-long path_format_arguments = { @@ -164,18 +171,16 @@ def build_deactivate_revision_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -187,9 +192,12 @@ def build_restart_revision_request( revision_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/restart") # pylint: disable=line-too-long path_format_arguments = { @@ -202,42 +210,38 @@ def build_restart_revision_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ContainerAppsRevisionsOperations(object): - """ContainerAppsRevisionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ContainerAppsRevisionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_revisions` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_revisions( @@ -246,7 +250,7 @@ def list_revisions( container_app_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.RevisionCollection"]: + ) -> Iterable[_models.RevisionCollection]: """Get the Revisions for a given Container App. Get the Revisions for a given Container App. @@ -262,13 +266,16 @@ def list_revisions( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.RevisionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RevisionCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RevisionCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -279,9 +286,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=self.list_revisions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -292,9 +301,11 @@ def prepare_request(next_link=None): api_version=api_version, filter=filter, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -335,7 +346,7 @@ def get_revision( container_app_name: str, revision_name: str, **kwargs: Any - ) -> "_models.Revision": + ) -> _models.Revision: """Get a revision of a Container App. Get a revision of a Container App. @@ -351,13 +362,16 @@ def get_revision( :rtype: ~azure.mgmt.appcontainers.models.Revision :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Revision"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Revision] request = build_get_revision_request( @@ -367,11 +381,13 @@ def get_revision( revision_name=revision_name, api_version=api_version, template_url=self.get_revision.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -416,13 +432,16 @@ def activate_revision( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_activate_revision_request( @@ -432,11 +451,13 @@ def activate_revision( # pylint: disable=inconsistent-return-statements revision_name=revision_name, api_version=api_version, template_url=self.activate_revision.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -477,13 +498,16 @@ def deactivate_revision( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_deactivate_revision_request( @@ -493,11 +517,13 @@ def deactivate_revision( # pylint: disable=inconsistent-return-statements revision_name=revision_name, api_version=api_version, template_url=self.deactivate_revision.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -538,13 +564,16 @@ def restart_revision( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_restart_revision_request( @@ -554,11 +583,13 @@ def restart_revision( # pylint: disable=inconsistent-return-statements revision_name=revision_name, api_version=api_version, template_url=self.restart_revision.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py index 8e54fbb9d51b..046fd78b0cf8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_by_container_app_request( container_app_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_by_container_app_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( source_control_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( container_app_name: str, source_control_name: str, *, - json: JSONType = None, + json: Optional[_models.SourceControl] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( source_control_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,42 +177,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ContainerAppsSourceControlsOperations(object): - """ContainerAppsSourceControlsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ContainerAppsSourceControlsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_source_controls` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_container_app( @@ -214,7 +216,7 @@ def list_by_container_app( resource_group_name: str, container_app_name: str, **kwargs: Any - ) -> Iterable["_models.SourceControlCollection"]: + ) -> Iterable[_models.SourceControlCollection]: """Get the Container App SourceControls in a given resource group. Get the Container App SourceControls in a given resource group. @@ -229,13 +231,16 @@ def list_by_container_app( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.SourceControlCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControlCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -245,9 +250,11 @@ def prepare_request(next_link=None): container_app_name=container_app_name, api_version=api_version, template_url=self.list_by_container_app.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -257,9 +264,11 @@ def prepare_request(next_link=None): container_app_name=container_app_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -300,7 +309,7 @@ def get( container_app_name: str, source_control_name: str, **kwargs: Any - ) -> "_models.SourceControl": + ) -> _models.SourceControl: """Get a SourceControl of a Container App. Get a SourceControl of a Container App. @@ -316,13 +325,16 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.SourceControl :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControl"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControl] request = build_get_request( @@ -332,11 +344,13 @@ def get( source_control_name=source_control_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -363,17 +377,20 @@ def _create_or_update_initial( resource_group_name: str, container_app_name: str, source_control_name: str, - source_control_envelope: "_models.SourceControl", + source_control_envelope: _models.SourceControl, **kwargs: Any - ) -> "_models.SourceControl": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControl"] + ) -> _models.SourceControl: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControl] _json = self._serialize.body(source_control_envelope, 'SourceControl') @@ -386,25 +403,27 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('SourceControl', pipeline_response) - if response.status_code == 202: + if response.status_code == 201: deserialized = self._deserialize('SourceControl', pipeline_response) if cls: @@ -421,12 +440,12 @@ def begin_create_or_update( resource_group_name: str, container_app_name: str, source_control_name: str, - source_control_envelope: "_models.SourceControl", + source_control_envelope: _models.SourceControl, **kwargs: Any - ) -> LROPoller["_models.SourceControl"]: + ) -> LROPoller[_models.SourceControl]: """Create or update the SourceControl for a Container App. - Description for Create or update the SourceControl for a Container App. + Create or update the SourceControl for a Container App. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str @@ -449,17 +468,20 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SourceControl] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControl] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControl"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, @@ -467,20 +489,27 @@ def begin_create_or_update( api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('SourceControl', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -500,13 +529,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements source_control_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -516,11 +548,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements source_control_name=source_control_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -547,7 +581,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements ) -> LROPoller[None]: """Delete a Container App SourceControl. - Description for Delete a Container App SourceControl. + Delete a Container App SourceControl. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str @@ -567,21 +601,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -591,8 +630,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py index 3e466039fbfb..439e08542f77 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py @@ -16,12 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( environment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( component_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( environment_name: str, component_name: str, *, - json: JSONType = None, + json: Optional[_models.DaprComponent] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( component_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,18 +175,16 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -192,9 +196,12 @@ def build_list_secrets_request( component_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/listSecrets") # pylint: disable=line-too-long path_format_arguments = { @@ -207,42 +214,38 @@ def build_list_secrets_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class DaprComponentsOperations(object): - """DaprComponentsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class DaprComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`dapr_components` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( @@ -250,7 +253,7 @@ def list( resource_group_name: str, environment_name: str, **kwargs: Any - ) -> Iterable["_models.DaprComponentsCollection"]: + ) -> Iterable[_models.DaprComponentsCollection]: """Get the Dapr Components for a managed environment. Get the Dapr Components for a managed environment. @@ -265,13 +268,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DaprComponentsCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DaprComponentsCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DaprComponentsCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -281,9 +287,11 @@ def prepare_request(next_link=None): environment_name=environment_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -293,9 +301,11 @@ def prepare_request(next_link=None): environment_name=environment_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -336,7 +346,7 @@ def get( environment_name: str, component_name: str, **kwargs: Any - ) -> "_models.DaprComponent": + ) -> _models.DaprComponent: """Get a dapr component. Get a dapr component. @@ -352,13 +362,16 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DaprComponent"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DaprComponent] request = build_get_request( @@ -368,11 +381,13 @@ def get( component_name=component_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -400,9 +415,9 @@ def create_or_update( resource_group_name: str, environment_name: str, component_name: str, - dapr_component_envelope: "_models.DaprComponent", + dapr_component_envelope: _models.DaprComponent, **kwargs: Any - ) -> "_models.DaprComponent": + ) -> _models.DaprComponent: """Creates or updates a Dapr Component. Creates or updates a Dapr Component in a Managed Environment. @@ -420,14 +435,17 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DaprComponent"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DaprComponent] _json = self._serialize.body(dapr_component_envelope, 'DaprComponent') @@ -440,11 +458,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -489,13 +509,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -505,11 +528,13 @@ def delete( # pylint: disable=inconsistent-return-statements component_name=component_name, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -534,7 +559,7 @@ def list_secrets( environment_name: str, component_name: str, **kwargs: Any - ) -> "_models.DaprSecretsCollection": + ) -> _models.DaprSecretsCollection: """List secrets for a dapr component. List secrets for a dapr component. @@ -550,13 +575,16 @@ def list_secrets( :rtype: ~azure.mgmt.appcontainers.models.DaprSecretsCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DaprSecretsCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DaprSecretsCollection] request = build_list_secrets_request( @@ -566,11 +594,13 @@ def list_secrets( component_name=component_name, api_version=api_version, template_url=self.list_secrets.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py index ff89f77a6929..b660764fe578 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_by_subscription_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_request( environment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -136,14 +139,17 @@ def build_create_or_update_request_initial( resource_group_name: str, environment_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedEnvironment] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}") # pylint: disable=line-too-long path_format_arguments = { @@ -155,20 +161,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -181,9 +185,12 @@ def build_delete_request_initial( environment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}") # pylint: disable=line-too-long path_format_arguments = { @@ -195,18 +202,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -216,14 +221,17 @@ def build_update_request_initial( resource_group_name: str, environment_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedEnvironment] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}") # pylint: disable=line-too-long path_format_arguments = { @@ -235,52 +243,48 @@ def build_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ManagedEnvironmentsOperations(object): - """ManagedEnvironmentsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedEnvironmentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`managed_environments` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_subscription( self, **kwargs: Any - ) -> Iterable["_models.ManagedEnvironmentsCollection"]: + ) -> Iterable[_models.ManagedEnvironmentsCollection]: """Get all Environments for a subscription. Get all Managed Environments for a subscription. @@ -292,13 +296,16 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ManagedEnvironmentsCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironmentsCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentsCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -306,9 +313,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -316,9 +325,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -357,7 +368,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedEnvironmentsCollection"]: + ) -> Iterable[_models.ManagedEnvironmentsCollection]: """Get all the Environments in a resource group. Get all the Managed Environments in a resource group. @@ -371,13 +382,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ManagedEnvironmentsCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironmentsCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentsCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -386,9 +400,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -397,9 +413,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -439,7 +457,7 @@ def get( resource_group_name: str, environment_name: str, **kwargs: Any - ) -> "_models.ManagedEnvironment": + ) -> _models.ManagedEnvironment: """Get the properties of a Managed Environment. Get the properties of a Managed Environment used to host container apps. @@ -453,13 +471,16 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironment] request = build_get_request( @@ -468,11 +489,13 @@ def get( environment_name=environment_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -498,17 +521,20 @@ def _create_or_update_initial( self, resource_group_name: str, environment_name: str, - environment_envelope: "_models.ManagedEnvironment", + environment_envelope: _models.ManagedEnvironment, **kwargs: Any - ) -> "_models.ManagedEnvironment": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironment"] + ) -> _models.ManagedEnvironment: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironment] _json = self._serialize.body(environment_envelope, 'ManagedEnvironment') @@ -520,11 +546,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -554,9 +582,9 @@ def begin_create_or_update( self, resource_group_name: str, environment_name: str, - environment_envelope: "_models.ManagedEnvironment", + environment_envelope: _models.ManagedEnvironment, **kwargs: Any - ) -> LROPoller["_models.ManagedEnvironment"]: + ) -> LROPoller[_models.ManagedEnvironment]: """Creates or updates a Managed Environment. Creates or updates a Managed Environment used to host container apps. @@ -580,37 +608,47 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ManagedEnvironment] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironment] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironment"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, environment_name=environment_name, environment_envelope=environment_envelope, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedEnvironment', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -629,13 +667,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements environment_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -644,11 +685,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements environment_name=environment_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -692,20 +735,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, environment_name=environment_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -715,8 +763,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -733,17 +787,20 @@ def _update_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, environment_name: str, - environment_envelope: "_models.ManagedEnvironment", + environment_envelope: _models.ManagedEnvironment, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(environment_envelope, 'ManagedEnvironment') @@ -755,11 +812,13 @@ def _update_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -781,7 +840,7 @@ def begin_update( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, environment_name: str, - environment_envelope: "_models.ManagedEnvironment", + environment_envelope: _models.ManagedEnvironment, **kwargs: Any ) -> LROPoller[None]: """Update Managed Environment's properties. @@ -806,23 +865,28 @@ def begin_update( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, environment_name=environment_name, environment_envelope=environment_envelope, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -832,8 +896,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py index 89642445aa0b..a4452ef93efc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py @@ -15,12 +15,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -32,9 +32,12 @@ def build_list_request( environment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages") # pylint: disable=line-too-long path_format_arguments = { @@ -46,18 +49,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -69,9 +70,12 @@ def build_get_request( storage_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}") # pylint: disable=line-too-long path_format_arguments = { @@ -84,18 +88,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -106,14 +108,17 @@ def build_create_or_update_request( environment_name: str, storage_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedEnvironmentStorage] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}") # pylint: disable=line-too-long path_format_arguments = { @@ -126,20 +131,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -153,9 +156,12 @@ def build_delete_request( storage_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}") # pylint: disable=line-too-long path_format_arguments = { @@ -168,42 +174,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedEnvironmentsStoragesOperations(object): - """ManagedEnvironmentsStoragesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedEnvironmentsStoragesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`managed_environments_storages` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( @@ -211,7 +213,7 @@ def list( resource_group_name: str, environment_name: str, **kwargs: Any - ) -> "_models.ManagedEnvironmentStoragesCollection": + ) -> _models.ManagedEnvironmentStoragesCollection: """Get all storages for a managedEnvironment. Get all storages for a managedEnvironment. @@ -225,13 +227,16 @@ def list( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStoragesCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentStoragesCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironmentStoragesCollection] request = build_list_request( @@ -240,11 +245,13 @@ def list( environment_name=environment_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -273,7 +280,7 @@ def get( environment_name: str, storage_name: str, **kwargs: Any - ) -> "_models.ManagedEnvironmentStorage": + ) -> _models.ManagedEnvironmentStorage: """Get storage for a managedEnvironment. Get storage for a managedEnvironment. @@ -289,13 +296,16 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentStorage"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironmentStorage] request = build_get_request( @@ -305,11 +315,13 @@ def get( storage_name=storage_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -337,9 +349,9 @@ def create_or_update( resource_group_name: str, environment_name: str, storage_name: str, - storage_envelope: "_models.ManagedEnvironmentStorage", + storage_envelope: _models.ManagedEnvironmentStorage, **kwargs: Any - ) -> "_models.ManagedEnvironmentStorage": + ) -> _models.ManagedEnvironmentStorage: """Create or update storage for a managedEnvironment. Create or update storage for a managedEnvironment. @@ -357,14 +369,17 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentStorage"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironmentStorage] _json = self._serialize.body(storage_envelope, 'ManagedEnvironmentStorage') @@ -377,11 +392,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -426,13 +443,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -442,11 +462,13 @@ def delete( # pylint: disable=inconsistent-return-statements storage_name=storage_name, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py index 59f158efe0d7..fd046ede2610 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py @@ -15,12 +15,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_check_name_availability_request( resource_group_name: str, environment_name: str, *, - json: JSONType = None, + json: Optional[_models.CheckNameAvailabilityRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/checkNameAvailability") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_check_name_availability_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class NamespacesOperations(object): - """NamespacesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class NamespacesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`namespaces` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def check_name_availability( self, resource_group_name: str, environment_name: str, - check_name_availability_request: "_models.CheckNameAvailabilityRequest", + check_name_availability_request: _models.CheckNameAvailabilityRequest, **kwargs: Any - ) -> "_models.CheckNameAvailabilityResponse": + ) -> _models.CheckNameAvailabilityResponse: """Checks the resource name availability. Checks if resource name is available. @@ -115,14 +114,17 @@ def check_name_availability( :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResponse] _json = self._serialize.body(check_name_availability_request, 'CheckNameAvailabilityRequest') @@ -134,11 +136,13 @@ def check_name_availability( content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py index d134b642c4d1..3e8711cd4049 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.App/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appcontainers.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.AvailableOperations"]: + ) -> Iterable[_models.AvailableOperations]: """Lists all of the available RP operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -85,31 +85,38 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AvailableOperations] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """