From 7b4f3b0c4c23eddcc720b257b7477e2512db250c Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 29 Jul 2022 03:24:40 +0000 Subject: [PATCH] CodeGen from PR 19974 in Azure/azure-rest-api-specs Merge e675f5c7512b6c4eb501cb45937a361a863ad85f into ec34aa3de995aea2d7c29bb22d85e8dc08d32018 --- sdk/app/azure-mgmt-app/_meta.json | 6 +- .../azure-mgmt-app/azure/mgmt/app/__init__.py | 13 +- .../azure/mgmt/app/_configuration.py | 9 +- .../mgmt/app/_container_apps_api_client.py | 138 +- .../azure/mgmt/app/_metadata.json | 111 - .../azure-mgmt-app/azure/mgmt/app/_version.py | 2 +- .../azure/mgmt/app/aio/__init__.py | 13 +- .../azure/mgmt/app/aio/_configuration.py | 9 +- .../app/aio/_container_apps_api_client.py | 135 +- .../azure/mgmt/app/aio/operations/__init__.py | 37 +- .../operations/_certificates_operations.py | 254 +- ...ed_environments_certificates_operations.py | 430 ++++ ...environments_dapr_components_operations.py | 421 +++ .../_connected_environments_operations.py | 684 +++++ ...nected_environments_storages_operations.py | 322 +++ ..._container_apps_auth_configs_operations.py | 171 +- .../_container_apps_diagnostics_operations.py | 439 ++++ .../operations/_container_apps_operations.py | 483 ++-- ...ainer_apps_revision_replicas_operations.py | 94 +- .../_container_apps_revisions_operations.py | 201 +- ...ntainer_apps_source_controls_operations.py | 242 +- .../operations/_dapr_components_operations.py | 242 +- ...aged_environment_diagnostics_operations.py | 179 ++ ...ged_environments_diagnostics_operations.py | 109 + .../_managed_environments_operations.py | 420 ++- ...anaged_environments_storages_operations.py | 197 +- .../aio/operations/_namespaces_operations.py | 116 + .../mgmt/app/aio/operations/_operations.py | 67 +- .../azure/mgmt/app/aio/operations/_patch.py | 19 + .../azure/mgmt/app/models/__init__.py | 66 +- .../_container_apps_api_client_enums.py | 88 +- .../azure/mgmt/app/models/_models_py3.py | 2262 ++++++++++++----- .../azure/mgmt/app/models/_patch.py | 19 + .../azure/mgmt/app/operations/__init__.py | 37 +- .../operations/_certificates_operations.py | 425 ++-- ...ed_environments_certificates_operations.py | 641 +++++ ...environments_dapr_components_operations.py | 623 +++++ .../_connected_environments_operations.py | 953 +++++++ ...nected_environments_storages_operations.py | 487 ++++ ..._container_apps_auth_configs_operations.py | 289 ++- .../_container_apps_diagnostics_operations.py | 634 +++++ .../operations/_container_apps_operations.py | 711 ++++-- ...ainer_apps_revision_replicas_operations.py | 151 +- .../_container_apps_revisions_operations.py | 345 ++- ...ntainer_apps_source_controls_operations.py | 360 ++- .../operations/_dapr_components_operations.py | 397 ++- ...aged_environment_diagnostics_operations.py | 258 ++ ...ged_environments_diagnostics_operations.py | 149 ++ .../_managed_environments_operations.py | 597 +++-- ...anaged_environments_storages_operations.py | 332 ++- .../app/operations/_namespaces_operations.py | 164 ++ .../azure/mgmt/app/operations/_operations.py | 92 +- .../azure/mgmt/app/operations/_patch.py | 19 + 53 files changed, 12571 insertions(+), 3091 deletions(-) delete mode 100644 sdk/app/azure-mgmt-app/azure/mgmt/app/_metadata.json create mode 100644 sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_connected_environments_certificates_operations.py create mode 100644 sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_connected_environments_dapr_components_operations.py create mode 100644 sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_connected_environments_operations.py create mode 100644 sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_connected_environments_storages_operations.py create mode 100644 sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_diagnostics_operations.py create mode 100644 sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_managed_environment_diagnostics_operations.py create mode 100644 sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_managed_environments_diagnostics_operations.py create mode 100644 sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_namespaces_operations.py create mode 100644 sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_patch.py create mode 100644 sdk/app/azure-mgmt-app/azure/mgmt/app/models/_patch.py create mode 100644 sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_connected_environments_certificates_operations.py create mode 100644 sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_connected_environments_dapr_components_operations.py create mode 100644 sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_connected_environments_operations.py create mode 100644 sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_connected_environments_storages_operations.py create mode 100644 sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_diagnostics_operations.py create mode 100644 sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_managed_environment_diagnostics_operations.py create mode 100644 sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_managed_environments_diagnostics_operations.py create mode 100644 sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_namespaces_operations.py create mode 100644 sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_patch.py diff --git a/sdk/app/azure-mgmt-app/_meta.json b/sdk/app/azure-mgmt-app/_meta.json index b635d5601ca5..fc0371cce8f7 100644 --- a/sdk/app/azure-mgmt-app/_meta.json +++ b/sdk/app/azure-mgmt-app/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.12.0", + "@autorest/python@5.16.0", "@autorest/modelerfour@4.19.3" ], - "commit": "4ac6be1b22f88bfbb6ca3e294e73538bcac90b49", + "commit": "2ecdfff6bd32a81803a641417eecaf40ca8f39c6", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/app/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.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/app/azure-mgmt-app/azure/mgmt/app/__init__.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/__init__.py index 962b4a502e4f..8e7c30acf5ac 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/__init__.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/__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/app/azure-mgmt-app/azure/mgmt/app/_configuration.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/_configuration.py index 90b7231faf5c..e8f870b79769 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/_configuration.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class ContainerAppsAPIClientConfiguration(Configuration): +class ContainerAppsAPIClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerAppsAPIClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class ContainerAppsAPIClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-06-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(ContainerAppsAPIClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-06-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2022-01-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-app/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/_container_apps_api_client.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/_container_apps_api_client.py index 714c5d778be9..2f45eb1d1a7d 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/_container_apps_api_client.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/_container_apps_api_client.py @@ -7,55 +7,81 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ContainerAppsAPIClientConfiguration -from .operations import CertificatesOperations, ContainerAppsAuthConfigsOperations, ContainerAppsOperations, ContainerAppsRevisionReplicasOperations, ContainerAppsRevisionsOperations, ContainerAppsSourceControlsOperations, DaprComponentsOperations, ManagedEnvironmentsOperations, ManagedEnvironmentsStoragesOperations, Operations +from .operations import CertificatesOperations, ConnectedEnvironmentsCertificatesOperations, ConnectedEnvironmentsDaprComponentsOperations, ConnectedEnvironmentsOperations, ConnectedEnvironmentsStoragesOperations, ContainerAppsAuthConfigsOperations, ContainerAppsDiagnosticsOperations, ContainerAppsOperations, ContainerAppsRevisionReplicasOperations, ContainerAppsRevisionsOperations, ContainerAppsSourceControlsOperations, DaprComponentsOperations, ManagedEnvironmentDiagnosticsOperations, ManagedEnvironmentsDiagnosticsOperations, ManagedEnvironmentsOperations, ManagedEnvironmentsStoragesOperations, NamespacesOperations, Operations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerAppsAPIClient: +class ContainerAppsAPIClient: # pylint: disable=too-many-instance-attributes """ContainerAppsAPIClient. + :ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations + :vartype container_apps_auth_configs: + azure.mgmt.app.operations.ContainerAppsAuthConfigsOperations :ivar container_apps: ContainerAppsOperations operations - :vartype container_apps: container_apps_api_client.operations.ContainerAppsOperations + :vartype container_apps: azure.mgmt.app.operations.ContainerAppsOperations :ivar container_apps_revisions: ContainerAppsRevisionsOperations operations - :vartype container_apps_revisions: - container_apps_api_client.operations.ContainerAppsRevisionsOperations + :vartype container_apps_revisions: azure.mgmt.app.operations.ContainerAppsRevisionsOperations :ivar container_apps_revision_replicas: ContainerAppsRevisionReplicasOperations operations :vartype container_apps_revision_replicas: - container_apps_api_client.operations.ContainerAppsRevisionReplicasOperations + azure.mgmt.app.operations.ContainerAppsRevisionReplicasOperations + :ivar dapr_components: DaprComponentsOperations operations + :vartype dapr_components: azure.mgmt.app.operations.DaprComponentsOperations + :ivar container_apps_diagnostics: ContainerAppsDiagnosticsOperations operations + :vartype container_apps_diagnostics: + azure.mgmt.app.operations.ContainerAppsDiagnosticsOperations + :ivar managed_environment_diagnostics: ManagedEnvironmentDiagnosticsOperations operations + :vartype managed_environment_diagnostics: + azure.mgmt.app.operations.ManagedEnvironmentDiagnosticsOperations + :ivar managed_environments_diagnostics: ManagedEnvironmentsDiagnosticsOperations operations + :vartype managed_environments_diagnostics: + azure.mgmt.app.operations.ManagedEnvironmentsDiagnosticsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.app.operations.Operations :ivar managed_environments: ManagedEnvironmentsOperations operations - :vartype managed_environments: - container_apps_api_client.operations.ManagedEnvironmentsOperations + :vartype managed_environments: azure.mgmt.app.operations.ManagedEnvironmentsOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: container_apps_api_client.operations.CertificatesOperations - :ivar operations: Operations operations - :vartype operations: container_apps_api_client.operations.Operations - :ivar container_apps_source_controls: ContainerAppsSourceControlsOperations operations - :vartype container_apps_source_controls: - container_apps_api_client.operations.ContainerAppsSourceControlsOperations - :ivar dapr_components: DaprComponentsOperations operations - :vartype dapr_components: container_apps_api_client.operations.DaprComponentsOperations - :ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations - :vartype container_apps_auth_configs: - container_apps_api_client.operations.ContainerAppsAuthConfigsOperations + :vartype certificates: azure.mgmt.app.operations.CertificatesOperations + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.app.operations.NamespacesOperations :ivar managed_environments_storages: ManagedEnvironmentsStoragesOperations operations :vartype managed_environments_storages: - container_apps_api_client.operations.ManagedEnvironmentsStoragesOperations + azure.mgmt.app.operations.ManagedEnvironmentsStoragesOperations + :ivar container_apps_source_controls: ContainerAppsSourceControlsOperations operations + :vartype container_apps_source_controls: + azure.mgmt.app.operations.ContainerAppsSourceControlsOperations + :ivar connected_environments: ConnectedEnvironmentsOperations operations + :vartype connected_environments: azure.mgmt.app.operations.ConnectedEnvironmentsOperations + :ivar connected_environments_certificates: ConnectedEnvironmentsCertificatesOperations + operations + :vartype connected_environments_certificates: + azure.mgmt.app.operations.ConnectedEnvironmentsCertificatesOperations + :ivar connected_environments_dapr_components: ConnectedEnvironmentsDaprComponentsOperations + operations + :vartype connected_environments_dapr_components: + azure.mgmt.app.operations.ConnectedEnvironmentsDaprComponentsOperations + :ivar connected_environments_storages: ConnectedEnvironmentsStoragesOperations operations + :vartype connected_environments_storages: + azure.mgmt.app.operations.ConnectedEnvironmentsStoragesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2022-06-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -74,21 +100,65 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - 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.managed_environments = ManagedEnvironmentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.container_apps_source_controls = ContainerAppsSourceControlsOperations(self._client, self._config, self._serialize, self._deserialize) - self.dapr_components = DaprComponentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.container_apps_auth_configs = ContainerAppsAuthConfigsOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_environments_storages = ManagedEnvironmentsStoragesOperations(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.container_apps_diagnostics = ContainerAppsDiagnosticsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_environment_diagnostics = ManagedEnvironmentDiagnosticsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_environments_diagnostics = ManagedEnvironmentsDiagnosticsOperations( + 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.connected_environments = ConnectedEnvironmentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.connected_environments_certificates = ConnectedEnvironmentsCertificatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.connected_environments_dapr_components = ConnectedEnvironmentsDaprComponentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.connected_environments_storages = ConnectedEnvironmentsStoragesOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/_metadata.json b/sdk/app/azure-mgmt-app/azure/mgmt/app/_metadata.json deleted file mode 100644 index eeb87a80b677..000000000000 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/_metadata.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "chosen_version": "2022-01-01-preview", - "total_api_version_list": ["2022-01-01-preview"], - "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\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerAppsAPIClientConfiguration\"]}}, \"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\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerAppsAPIClientConfiguration\"]}}, \"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": "ContainerAppsOperations", - "container_apps_revisions": "ContainerAppsRevisionsOperations", - "container_apps_revision_replicas": "ContainerAppsRevisionReplicasOperations", - "managed_environments": "ManagedEnvironmentsOperations", - "certificates": "CertificatesOperations", - "operations": "Operations", - "container_apps_source_controls": "ContainerAppsSourceControlsOperations", - "dapr_components": "DaprComponentsOperations", - "container_apps_auth_configs": "ContainerAppsAuthConfigsOperations", - "managed_environments_storages": "ManagedEnvironmentsStoragesOperations" - } -} \ No newline at end of file diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/_version.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/_version.py index dfa6ee022f15..e5754a47ce68 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/_version.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/__init__.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/__init__.py index cb4bbcce8e12..b642e4a85d62 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/__init__.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/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/app/azure-mgmt-app/azure/mgmt/app/aio/_configuration.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/_configuration.py index ed19909a70d5..5b8dac03e1d5 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/_configuration.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class ContainerAppsAPIClientConfiguration(Configuration): +class ContainerAppsAPIClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerAppsAPIClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class ContainerAppsAPIClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-06-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(ContainerAppsAPIClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-06-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2022-01-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-app/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/_container_apps_api_client.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/_container_apps_api_client.py index f49b67610af1..97e9771015c6 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/_container_apps_api_client.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/_container_apps_api_client.py @@ -7,55 +7,82 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ContainerAppsAPIClientConfiguration -from .operations import CertificatesOperations, ContainerAppsAuthConfigsOperations, ContainerAppsOperations, ContainerAppsRevisionReplicasOperations, ContainerAppsRevisionsOperations, ContainerAppsSourceControlsOperations, DaprComponentsOperations, ManagedEnvironmentsOperations, ManagedEnvironmentsStoragesOperations, Operations +from .operations import CertificatesOperations, ConnectedEnvironmentsCertificatesOperations, ConnectedEnvironmentsDaprComponentsOperations, ConnectedEnvironmentsOperations, ConnectedEnvironmentsStoragesOperations, ContainerAppsAuthConfigsOperations, ContainerAppsDiagnosticsOperations, ContainerAppsOperations, ContainerAppsRevisionReplicasOperations, ContainerAppsRevisionsOperations, ContainerAppsSourceControlsOperations, DaprComponentsOperations, ManagedEnvironmentDiagnosticsOperations, ManagedEnvironmentsDiagnosticsOperations, ManagedEnvironmentsOperations, ManagedEnvironmentsStoragesOperations, NamespacesOperations, Operations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerAppsAPIClient: +class ContainerAppsAPIClient: # pylint: disable=too-many-instance-attributes """ContainerAppsAPIClient. + :ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations + :vartype container_apps_auth_configs: + azure.mgmt.app.aio.operations.ContainerAppsAuthConfigsOperations :ivar container_apps: ContainerAppsOperations operations - :vartype container_apps: container_apps_api_client.aio.operations.ContainerAppsOperations + :vartype container_apps: azure.mgmt.app.aio.operations.ContainerAppsOperations :ivar container_apps_revisions: ContainerAppsRevisionsOperations operations :vartype container_apps_revisions: - container_apps_api_client.aio.operations.ContainerAppsRevisionsOperations + azure.mgmt.app.aio.operations.ContainerAppsRevisionsOperations :ivar container_apps_revision_replicas: ContainerAppsRevisionReplicasOperations operations :vartype container_apps_revision_replicas: - container_apps_api_client.aio.operations.ContainerAppsRevisionReplicasOperations + azure.mgmt.app.aio.operations.ContainerAppsRevisionReplicasOperations + :ivar dapr_components: DaprComponentsOperations operations + :vartype dapr_components: azure.mgmt.app.aio.operations.DaprComponentsOperations + :ivar container_apps_diagnostics: ContainerAppsDiagnosticsOperations operations + :vartype container_apps_diagnostics: + azure.mgmt.app.aio.operations.ContainerAppsDiagnosticsOperations + :ivar managed_environment_diagnostics: ManagedEnvironmentDiagnosticsOperations operations + :vartype managed_environment_diagnostics: + azure.mgmt.app.aio.operations.ManagedEnvironmentDiagnosticsOperations + :ivar managed_environments_diagnostics: ManagedEnvironmentsDiagnosticsOperations operations + :vartype managed_environments_diagnostics: + azure.mgmt.app.aio.operations.ManagedEnvironmentsDiagnosticsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.app.aio.operations.Operations :ivar managed_environments: ManagedEnvironmentsOperations operations - :vartype managed_environments: - container_apps_api_client.aio.operations.ManagedEnvironmentsOperations + :vartype managed_environments: azure.mgmt.app.aio.operations.ManagedEnvironmentsOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: container_apps_api_client.aio.operations.CertificatesOperations - :ivar operations: Operations operations - :vartype operations: container_apps_api_client.aio.operations.Operations - :ivar container_apps_source_controls: ContainerAppsSourceControlsOperations operations - :vartype container_apps_source_controls: - container_apps_api_client.aio.operations.ContainerAppsSourceControlsOperations - :ivar dapr_components: DaprComponentsOperations operations - :vartype dapr_components: container_apps_api_client.aio.operations.DaprComponentsOperations - :ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations - :vartype container_apps_auth_configs: - container_apps_api_client.aio.operations.ContainerAppsAuthConfigsOperations + :vartype certificates: azure.mgmt.app.aio.operations.CertificatesOperations + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.app.aio.operations.NamespacesOperations :ivar managed_environments_storages: ManagedEnvironmentsStoragesOperations operations :vartype managed_environments_storages: - container_apps_api_client.aio.operations.ManagedEnvironmentsStoragesOperations + azure.mgmt.app.aio.operations.ManagedEnvironmentsStoragesOperations + :ivar container_apps_source_controls: ContainerAppsSourceControlsOperations operations + :vartype container_apps_source_controls: + azure.mgmt.app.aio.operations.ContainerAppsSourceControlsOperations + :ivar connected_environments: ConnectedEnvironmentsOperations operations + :vartype connected_environments: azure.mgmt.app.aio.operations.ConnectedEnvironmentsOperations + :ivar connected_environments_certificates: ConnectedEnvironmentsCertificatesOperations + operations + :vartype connected_environments_certificates: + azure.mgmt.app.aio.operations.ConnectedEnvironmentsCertificatesOperations + :ivar connected_environments_dapr_components: ConnectedEnvironmentsDaprComponentsOperations + operations + :vartype connected_environments_dapr_components: + azure.mgmt.app.aio.operations.ConnectedEnvironmentsDaprComponentsOperations + :ivar connected_environments_storages: ConnectedEnvironmentsStoragesOperations operations + :vartype connected_environments_storages: + azure.mgmt.app.aio.operations.ConnectedEnvironmentsStoragesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2022-06-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -74,16 +101,60 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - 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.managed_environments = ManagedEnvironmentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.container_apps_source_controls = ContainerAppsSourceControlsOperations(self._client, self._config, self._serialize, self._deserialize) - self.dapr_components = DaprComponentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.container_apps_auth_configs = ContainerAppsAuthConfigsOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_environments_storages = ManagedEnvironmentsStoragesOperations(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.container_apps_diagnostics = ContainerAppsDiagnosticsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_environment_diagnostics = ManagedEnvironmentDiagnosticsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_environments_diagnostics = ManagedEnvironmentsDiagnosticsOperations( + 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.connected_environments = ConnectedEnvironmentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.connected_environments_certificates = ConnectedEnvironmentsCertificatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.connected_environments_dapr_components = ConnectedEnvironmentsDaprComponentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.connected_environments_storages = ConnectedEnvironmentsStoragesOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/__init__.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/__init__.py index 021cee48b4be..f60dd7271574 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/__init__.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/__init__.py @@ -6,26 +6,47 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._container_apps_auth_configs_operations import ContainerAppsAuthConfigsOperations from ._container_apps_operations import ContainerAppsOperations from ._container_apps_revisions_operations import ContainerAppsRevisionsOperations from ._container_apps_revision_replicas_operations import ContainerAppsRevisionReplicasOperations +from ._dapr_components_operations import DaprComponentsOperations +from ._container_apps_diagnostics_operations import ContainerAppsDiagnosticsOperations +from ._managed_environment_diagnostics_operations import ManagedEnvironmentDiagnosticsOperations +from ._managed_environments_diagnostics_operations import ManagedEnvironmentsDiagnosticsOperations +from ._operations import Operations from ._managed_environments_operations import ManagedEnvironmentsOperations from ._certificates_operations import CertificatesOperations -from ._operations import Operations -from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations -from ._dapr_components_operations import DaprComponentsOperations -from ._container_apps_auth_configs_operations import ContainerAppsAuthConfigsOperations +from ._namespaces_operations import NamespacesOperations from ._managed_environments_storages_operations import ManagedEnvironmentsStoragesOperations +from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations +from ._connected_environments_operations import ConnectedEnvironmentsOperations +from ._connected_environments_certificates_operations import ConnectedEnvironmentsCertificatesOperations +from ._connected_environments_dapr_components_operations import ConnectedEnvironmentsDaprComponentsOperations +from ._connected_environments_storages_operations import ConnectedEnvironmentsStoragesOperations +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', 'ContainerAppsRevisionsOperations', 'ContainerAppsRevisionReplicasOperations', + 'DaprComponentsOperations', + 'ContainerAppsDiagnosticsOperations', + 'ManagedEnvironmentDiagnosticsOperations', + 'ManagedEnvironmentsDiagnosticsOperations', + 'Operations', 'ManagedEnvironmentsOperations', 'CertificatesOperations', - 'Operations', - 'ContainerAppsSourceControlsOperations', - 'DaprComponentsOperations', - 'ContainerAppsAuthConfigsOperations', + 'NamespacesOperations', 'ManagedEnvironmentsStoragesOperations', + 'ContainerAppsSourceControlsOperations', + 'ConnectedEnvironmentsOperations', + 'ConnectedEnvironmentsCertificatesOperations', + 'ConnectedEnvironmentsDaprComponentsOperations', + 'ConnectedEnvironmentsStoragesOperations', ] +__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/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_certificates_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_certificates_operations.py index b261b386cb07..0e1caf81eab3 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_certificates_operations.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_certificates_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,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 @@ -25,76 +25,84 @@ 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: ~container_apps_api_client.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.app.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( self, resource_group_name: str, - managed_environment_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. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param managed_environment_name: Name of the Managed Environment. - :type managed_environment_name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CertificateCollection or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~container_apps_api_client.models.CertificateCollection] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.app.models.CertificateCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateCollection"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + 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: request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - managed_environment_name=managed_environment_name, + 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: request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - managed_environment_name=managed_environment_name, + 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 @@ -108,7 +116,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -122,49 +134,61 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates"} # type: ignore @distributed_trace_async async def get( self, resource_group_name: str, - managed_environment_name: str, - name: str, + environment_name: str, + certificate_name: str, **kwargs: Any - ) -> "_models.Certificate": + ) -> _models.Certificate: """Get the specified Certificate. Get the specified Certificate. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param managed_environment_name: Name of the Managed Environment. - :type managed_environment_name: str - :param name: Name of the Certificate. - :type name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :param certificate_name: Name of the Certificate. + :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate, or the result of cls(response) - :rtype: ~container_apps_api_client.models.Certificate + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Certificate] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - managed_environment_name=managed_environment_name, - name=name, + environment_name=environment_name, + 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(request, stream=False, **kwargs) + 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]: @@ -179,42 +203,46 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}"} # type: ignore @distributed_trace_async async def create_or_update( self, resource_group_name: str, - managed_environment_name: str, - name: str, - certificate_envelope: Optional["_models.Certificate"] = None, + environment_name: str, + certificate_name: str, + certificate_envelope: Optional[_models.Certificate] = None, **kwargs: Any - ) -> "_models.Certificate": + ) -> _models.Certificate: """Create or Update a Certificate. Create or Update a Certificate. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param managed_environment_name: Name of the Managed Environment. - :type managed_environment_name: str - :param name: Name of the Certificate. - :type name: str - :param certificate_envelope: Certificate to be created or updated. - :type certificate_envelope: ~container_apps_api_client.models.Certificate + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :param certificate_name: Name of the Certificate. + :type certificate_name: str + :param certificate_envelope: Certificate to be created or updated. Default value is None. + :type certificate_envelope: ~azure.mgmt.app.models.Certificate :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate, or the result of cls(response) - :rtype: ~container_apps_api_client.models.Certificate + :rtype: ~azure.mgmt.app.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 {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # 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') @@ -224,16 +252,23 @@ async def create_or_update( request = build_create_or_update_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - managed_environment_name=managed_environment_name, - name=name, + environment_name=environment_name, + certificate_name=certificate_name, + api_version=api_version, 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(request, stream=False, **kwargs) + 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]: @@ -248,15 +283,15 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, - managed_environment_name: str, - name: str, + environment_name: str, + certificate_name: str, **kwargs: Any ) -> None: """Deletes the specified Certificate. @@ -265,33 +300,45 @@ async def delete( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param managed_environment_name: Name of the Managed Environment. - :type managed_environment_name: str - :param name: Name of the Certificate. - :type name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :param certificate_name: Name of the Certificate. + :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - managed_environment_name=managed_environment_name, - name=name, + environment_name=environment_name, + 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(request, stream=False, **kwargs) + 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, 204]: @@ -302,58 +349,69 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}"} # type: ignore @distributed_trace_async async def update( self, resource_group_name: str, - managed_environment_name: str, - name: str, - certificate_envelope: "_models.CertificatePatch", + environment_name: str, + certificate_name: str, + 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. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param managed_environment_name: Name of the Managed Environment. - :type managed_environment_name: str - :param name: Name of the Certificate. - :type name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :param certificate_name: Name of the Certificate. + :type certificate_name: str :param certificate_envelope: Properties of a certificate that need to be updated. - :type certificate_envelope: ~container_apps_api_client.models.CertificatePatch + :type certificate_envelope: ~azure.mgmt.app.models.CertificatePatch :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate, or the result of cls(response) - :rtype: ~container_apps_api_client.models.Certificate + :rtype: ~azure.mgmt.app.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 {}) - 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-06-01-preview")) # 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') request = build_update_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - managed_environment_name=managed_environment_name, - name=name, + environment_name=environment_name, + certificate_name=certificate_name, + api_version=api_version, 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(request, stream=False, **kwargs) + 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]: @@ -368,5 +426,5 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}"} # type: ignore diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_connected_environments_certificates_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_connected_environments_certificates_operations.py new file mode 100644 index 000000000000..1914f345cda2 --- /dev/null +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_connected_environments_certificates_operations.py @@ -0,0 +1,430 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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 + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._connected_environments_certificates_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConnectedEnvironmentsCertificatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.app.aio.ContainerAppsAPIClient`'s + :attr:`connected_environments_certificates` attribute. + """ + + models = _models + + 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, + resource_group_name: str, + connected_environment_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.CertificateCollection]: + """Get the Certificates in a given connected environment. + + Get the Certificates in a given connected environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the Connected Environment. + :type connected_environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateCollection or the result of + cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.app.models.CertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CertificateCollection] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_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) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_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) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CertificateCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + connected_environment_name: str, + certificate_name: str, + **kwargs: Any + ) -> _models.Certificate: + """Get the specified Certificate. + + Get the specified Certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the Connected Environment. + :type connected_environment_name: str + :param certificate_name: Name of the Certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Certificate] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + connected_environment_name: str, + certificate_name: str, + certificate_envelope: Optional[_models.Certificate] = None, + **kwargs: Any + ) -> _models.Certificate: + """Create or Update a Certificate. + + Create or Update a Certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the Connected Environment. + :type connected_environment_name: str + :param certificate_name: Name of the Certificate. + :type certificate_name: str + :param certificate_envelope: Certificate to be created or updated. Default value is None. + :type certificate_envelope: ~azure.mgmt.app.models.Certificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # 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') + else: + _json = None + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + certificate_name=certificate_name, + api_version=api_version, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + connected_environment_name: str, + certificate_name: str, + **kwargs: Any + ) -> None: + """Deletes the specified Certificate. + + Deletes the specified Certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the Connected Environment. + :type connected_environment_name: str + :param certificate_name: Name of the Certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + 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) # type: ignore + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + connected_environment_name: str, + certificate_name: str, + certificate_envelope: _models.CertificatePatch, + **kwargs: Any + ) -> _models.Certificate: + """Update properties of a certificate. + + Patches a certificate. Currently only patching of tags is supported. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the Connected Environment. + :type connected_environment_name: str + :param certificate_name: Name of the Certificate. + :type certificate_name: str + :param certificate_envelope: Properties of a certificate that need to be updated. + :type certificate_envelope: ~azure.mgmt.app.models.CertificatePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # 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') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + certificate_name=certificate_name, + api_version=api_version, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}"} # type: ignore + diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_connected_environments_dapr_components_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_connected_environments_dapr_components_operations.py new file mode 100644 index 000000000000..0a4877a8c52b --- /dev/null +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_connected_environments_dapr_components_operations.py @@ -0,0 +1,421 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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 + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._connected_environments_dapr_components_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request, build_list_secrets_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConnectedEnvironmentsDaprComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.app.aio.ContainerAppsAPIClient`'s + :attr:`connected_environments_dapr_components` attribute. + """ + + models = _models + + 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, + resource_group_name: str, + connected_environment_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.DaprComponentsCollection]: + """Get the Dapr Components for a connected environment. + + Get the Dapr Components for a connected environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the connected environment. + :type connected_environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DaprComponentsCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.app.models.DaprComponentsCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DaprComponentsCollection] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_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) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_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) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DaprComponentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + connected_environment_name: str, + component_name: str, + **kwargs: Any + ) -> _models.DaprComponent: + """Get a dapr component. + + Get a dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the connected environment. + :type connected_environment_name: str + :param component_name: Name of the Dapr Component. + :type component_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprComponent, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.DaprComponent + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DaprComponent] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DaprComponent', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}"} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + connected_environment_name: str, + component_name: str, + dapr_component_envelope: _models.DaprComponent, + **kwargs: Any + ) -> _models.DaprComponent: + """Creates or updates a Dapr Component. + + Creates or updates a Dapr Component in a connected environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the connected environment. + :type connected_environment_name: str + :param component_name: Name of the Dapr Component. + :type component_name: str + :param dapr_component_envelope: Configuration details of the Dapr Component. + :type dapr_component_envelope: ~azure.mgmt.app.models.DaprComponent + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprComponent, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.DaprComponent + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # 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') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + component_name=component_name, + api_version=api_version, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DaprComponent', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + connected_environment_name: str, + component_name: str, + **kwargs: Any + ) -> None: + """Delete a Dapr Component. + + Delete a Dapr Component from a connected environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the connected environment. + :type connected_environment_name: str + :param component_name: Name of the Dapr Component. + :type component_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + 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) # type: ignore + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}"} # type: ignore + + + @distributed_trace_async + async def list_secrets( + self, + resource_group_name: str, + connected_environment_name: str, + component_name: str, + **kwargs: Any + ) -> _models.DaprSecretsCollection: + """List secrets for a dapr component. + + List secrets for a dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the connected environment. + :type connected_environment_name: str + :param component_name: Name of the Dapr Component. + :type component_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprSecretsCollection, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.DaprSecretsCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DaprSecretsCollection] + + + request = build_list_secrets_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DaprSecretsCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_secrets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}/listSecrets"} # type: ignore + diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_connected_environments_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_connected_environments_operations.py new file mode 100644 index 000000000000..f08da2e09327 --- /dev/null +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_connected_environments_operations.py @@ -0,0 +1,684 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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, cast + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._connected_environments_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConnectedEnvironmentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.app.aio.ContainerAppsAPIClient`'s + :attr:`connected_environments` attribute. + """ + + models = _models + + 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.ConnectedEnvironmentCollection]: + """Get all connectedEnvironments for a subscription. + + Description for Get all connectedEnvironments for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConnectedEnvironmentCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.app.models.ConnectedEnvironmentCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectedEnvironmentCollection] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + 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) # type: ignore + + else: + + request = build_list_by_subscription_request( + 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) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ConnectedEnvironmentCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.App/connectedEnvironments"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.ConnectedEnvironmentCollection]: + """Get all connectedEnvironments in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConnectedEnvironmentCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.app.models.ConnectedEnvironmentCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectedEnvironmentCollection] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + 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) # type: ignore + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + 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) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ConnectedEnvironmentCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + connected_environment_name: str, + **kwargs: Any + ) -> _models.ConnectedEnvironment: + """Get the properties of an connectedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the connectedEnvironment. + :type connected_environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectedEnvironment, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.ConnectedEnvironment + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectedEnvironment] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectedEnvironment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + connected_environment_name: str, + environment_envelope: _models.ConnectedEnvironment, + **kwargs: Any + ) -> _models.ConnectedEnvironment: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # 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.ConnectedEnvironment] + + _json = self._serialize.body(environment_envelope, 'ConnectedEnvironment') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + api_version=api_version, + 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) # type: ignore + + 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, 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('ConnectedEnvironment', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConnectedEnvironment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + connected_environment_name: str, + environment_envelope: _models.ConnectedEnvironment, + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectedEnvironment]: + """Creates or updates an connectedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the connectedEnvironment. + :type connected_environment_name: str + :param environment_envelope: Configuration details of the connectedEnvironment. + :type environment_envelope: ~azure.mgmt.app.models.ConnectedEnvironment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConnectedEnvironment or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.app.models.ConnectedEnvironment] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _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-06-01-preview")) # 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.ConnectedEnvironment] + 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._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + connected_environment_name=connected_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): + deserialized = self._deserialize('ConnectedEnvironment', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + 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( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + connected_environment_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_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) # type: ignore + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + connected_environment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete an connectedEnvironment. + + Description for Delete an connectedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the connectedEnvironment. + :type connected_environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # 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( # type: ignore + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + 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( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}"} # type: ignore + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + connected_environment_name: str, + **kwargs: Any + ) -> _models.ConnectedEnvironment: + """Update connected Environment's properties. + + Patches a Managed Environment. Only patching of tags is supported currently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the connectedEnvironment. + :type connected_environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectedEnvironment, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.ConnectedEnvironment + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectedEnvironment] + + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + api_version=api_version, + template_url=self.update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectedEnvironment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}"} # type: ignore + + + @distributed_trace_async + async def check_name_availability( + self, + resource_group_name: str, + connected_environment_name: str, + check_name_availability_request: _models.CheckNameAvailabilityRequest, + **kwargs: Any + ) -> _models.CheckNameAvailabilityResponse: + """Checks the resource connectedEnvironmentName availability. + + Checks if resource connectedEnvironmentName is available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the Managed Environment. + :type connected_environment_name: str + :param check_name_availability_request: The check connectedEnvironmentName availability + request. + :type check_name_availability_request: ~azure.mgmt.app.models.CheckNameAvailabilityRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResponse, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.CheckNameAvailabilityResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # 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') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + api_version=api_version, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/checkNameAvailability"} # type: ignore + diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_connected_environments_storages_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_connected_environments_storages_operations.py new file mode 100644 index 000000000000..972b68509050 --- /dev/null +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_connected_environments_storages_operations.py @@ -0,0 +1,322 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._connected_environments_storages_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConnectedEnvironmentsStoragesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.app.aio.ContainerAppsAPIClient`'s + :attr:`connected_environments_storages` attribute. + """ + + models = _models + + 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( + self, + resource_group_name: str, + connected_environment_name: str, + **kwargs: Any + ) -> _models.ConnectedEnvironmentStoragesCollection: + """Get all storages for a connectedEnvironment. + + Get all storages for a connectedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the Environment. + :type connected_environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectedEnvironmentStoragesCollection, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.ConnectedEnvironmentStoragesCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectedEnvironmentStoragesCollection] + + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectedEnvironmentStoragesCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages"} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + connected_environment_name: str, + storage_name: str, + **kwargs: Any + ) -> _models.ConnectedEnvironmentStorage: + """Get storage for a connectedEnvironment. + + Get storage for a connectedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the Environment. + :type connected_environment_name: str + :param storage_name: Name of the storage. + :type storage_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectedEnvironmentStorage, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.ConnectedEnvironmentStorage + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectedEnvironmentStorage] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectedEnvironmentStorage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}"} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + connected_environment_name: str, + storage_name: str, + storage_envelope: _models.ConnectedEnvironmentStorage, + **kwargs: Any + ) -> _models.ConnectedEnvironmentStorage: + """Create or update storage for a connectedEnvironment. + + Create or update storage for a connectedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the Environment. + :type connected_environment_name: str + :param storage_name: Name of the storage. + :type storage_name: str + :param storage_envelope: Configuration details of storage. + :type storage_envelope: ~azure.mgmt.app.models.ConnectedEnvironmentStorage + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectedEnvironmentStorage, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.ConnectedEnvironmentStorage + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # 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.ConnectedEnvironmentStorage] + + _json = self._serialize.body(storage_envelope, 'ConnectedEnvironmentStorage') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + storage_name=storage_name, + api_version=api_version, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectedEnvironmentStorage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + connected_environment_name: str, + storage_name: str, + **kwargs: Any + ) -> None: + """Delete storage for a connectedEnvironment. + + Delete storage for a connectedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the Environment. + :type connected_environment_name: str + :param storage_name: Name of the storage. + :type storage_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + 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) # type: ignore + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}"} # type: ignore + diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_auth_configs_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_auth_configs_operations.py index e8fdce3d7522..b996b0443f0a 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_auth_configs_operations.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_auth_configs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,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 @@ -25,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: ~container_apps_api_client.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.app.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( @@ -52,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. @@ -64,15 +62,19 @@ def list_by_container_app( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AuthConfigCollection or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~container_apps_api_client.models.AuthConfigCollection] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.app.models.AuthConfigCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthConfigCollection"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + 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: @@ -80,10 +82,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, 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: @@ -91,10 +96,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, 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 @@ -108,7 +116,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -122,16 +134,16 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_container_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs'} # type: ignore + list_by_container_app.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs"} # type: ignore @distributed_trace_async async def get( self, resource_group_name: str, container_app_name: str, - 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. @@ -140,31 +152,43 @@ async def get( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param name: Name of the Container App AuthConfig. - :type name: str + :param auth_config_name: Name of the Container App AuthConfig. + :type auth_config_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthConfig, or the result of cls(response) - :rtype: ~container_apps_api_client.models.AuthConfig + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AuthConfig] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -179,7 +203,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}"} # type: ignore @distributed_trace_async @@ -187,10 +211,10 @@ async def create_or_update( self, resource_group_name: str, container_app_name: str, - name: str, - auth_config_envelope: "_models.AuthConfig", + auth_config_name: str, + 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. @@ -199,22 +223,26 @@ async def create_or_update( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param name: Name of the Container App AuthConfig. - :type name: str + :param auth_config_name: Name of the Container App AuthConfig. + :type auth_config_name: str :param auth_config_envelope: Properties used to create a Container App AuthConfig. - :type auth_config_envelope: ~container_apps_api_client.models.AuthConfig + :type auth_config_envelope: ~azure.mgmt.app.models.AuthConfig :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthConfig, or the result of cls(response) - :rtype: ~container_apps_api_client.models.AuthConfig + :rtype: ~azure.mgmt.app.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 {}) - 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-06-01-preview")) # 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') @@ -222,15 +250,22 @@ async def create_or_update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, - name=name, + auth_config_name=auth_config_name, + api_version=api_version, 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(request, stream=False, **kwargs) + 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]: @@ -245,15 +280,15 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, container_app_name: str, - name: str, + auth_config_name: str, **kwargs: Any ) -> None: """Delete a Container App AuthConfig. @@ -264,31 +299,43 @@ async def delete( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param name: Name of the Container App AuthConfig. - :type name: str + :param auth_config_name: Name of the Container App AuthConfig. + :type auth_config_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, - name=name, + 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(request, stream=False, **kwargs) + 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, 204]: @@ -299,5 +346,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}"} # type: ignore diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_diagnostics_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_diagnostics_operations.py new file mode 100644 index 000000000000..b5f1a55db796 --- /dev/null +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_diagnostics_operations.py @@ -0,0 +1,439 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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 + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._container_apps_diagnostics_operations import build_get_detector_request, build_get_revision_request, build_get_root_request, build_list_detectors_request, build_list_revisions_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ContainerAppsDiagnosticsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.app.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_diagnostics` attribute. + """ + + models = _models + + 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_detectors( + self, + resource_group_name: str, + container_app_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.DiagnosticsCollection]: + """Get the list of diagnostics for a given Container App. + + Get the list of diagnostics for a given Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App for which detector info is needed. + :type container_app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticsCollection or the result of + cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.app.models.DiagnosticsCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DiagnosticsCollection] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_detectors_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + template_url=self.list_detectors.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_detectors_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + 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) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DiagnosticsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_detectors.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors"} # type: ignore + + @distributed_trace_async + async def get_detector( + self, + resource_group_name: str, + container_app_name: str, + detector_name: str, + **kwargs: Any + ) -> _models.Diagnostics: + """Get a diagnostics result of a Container App. + + Get a diagnostics result of a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param detector_name: Name of the Container App Detector. + :type detector_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Diagnostics, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.Diagnostics + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Diagnostics] + + + request = build_get_detector_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + detector_name=detector_name, + api_version=api_version, + template_url=self.get_detector.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Diagnostics', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_detector.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors/{detectorName}"} # type: ignore + + + @distributed_trace + def list_revisions( + self, + resource_group_name: str, + container_app_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable[_models.RevisionCollection]: + """Get the Revisions for a given Container App. + + Get the Revisions for a given Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App for which Revisions are needed. + :type container_app_name: str + :param filter: The filter to apply on the operation. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RevisionCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.app.models.RevisionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RevisionCollection] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_revisions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + 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) # type: ignore + + else: + + request = build_list_revisions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + 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) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RevisionCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_revisions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorproperties/revisionsApi/revisions/"} # type: ignore + + @distributed_trace_async + async def get_revision( + self, + resource_group_name: str, + container_app_name: str, + revision_name: str, + **kwargs: Any + ) -> _models.Revision: + """Get a revision of a Container App. + + Get a revision of a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param revision_name: Name of the Container App Revision. + :type revision_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Revision, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.Revision + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Revision] + + + request = build_get_revision_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Revision', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_revision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorproperties/revisionsApi/revisions/{revisionName}"} # type: ignore + + + @distributed_trace_async + async def get_root( + self, + resource_group_name: str, + container_app_name: str, + **kwargs: Any + ) -> _models.ContainerApp: + """Get the properties of a Container App. + + Get the properties of a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContainerApp, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.ContainerApp + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerApp] + + + request = build_get_root_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + template_url=self.get_root.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ContainerApp', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_root.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorproperties/rootApi/"} # type: ignore + diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_operations.py index abea0c93db47..5168e4a4467a 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_operations.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +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 @@ -17,42 +16,41 @@ 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 from ... import models as _models from ..._vendor import _convert_request -from ...operations._container_apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_custom_host_name_analysis_request, build_list_secrets_request, build_update_request +from ...operations._container_apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_custom_host_name_analysis_request, build_list_secrets_request, build_update_request_initial T = TypeVar('T') 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: ~container_apps_api_client.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.app.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. @@ -60,33 +58,43 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContainerAppCollection or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~container_apps_api_client.models.ContainerAppCollection] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.app.models.ContainerAppCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerAppCollection"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + 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: request = build_list_by_subscription_request( 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: request = build_list_by_subscription_request( 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 @@ -100,7 +108,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -114,14 +126,14 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps"} # type: ignore @distributed_trace 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. @@ -131,35 +143,45 @@ def list_by_resource_group( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContainerAppCollection or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~container_apps_api_client.models.ContainerAppCollection] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.app.models.ContainerAppCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerAppCollection"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + 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: request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, 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: request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, 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 @@ -173,7 +195,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -187,45 +213,57 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps"} # type: ignore @distributed_trace_async async def get( self, resource_group_name: str, - 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. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param name: Name of the Container App. - :type name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ContainerApp, or the result of cls(response) - :rtype: ~container_apps_api_client.models.ContainerApp + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerApp] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -240,38 +278,49 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, - name: str, - container_app_envelope: "_models.ContainerApp", + container_app_name: str, + 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 {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # 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') request = build_create_or_update_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - name=name, + container_app_name=container_app_name, + api_version=api_version, 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(request, stream=False, **kwargs) + 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, 201]: @@ -289,27 +338,27 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}"} # type: ignore @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, - name: str, - container_app_envelope: "_models.ContainerApp", + container_app_name: str, + 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. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param name: Name of the Container App. - :type name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str :param container_app_envelope: Properties used to create a container app. - :type container_app_envelope: ~container_apps_api_client.models.ContainerApp + :type container_app_envelope: ~azure.mgmt.app.models.ContainerApp :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -320,38 +369,50 @@ async def begin_create_or_update( Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ContainerApp or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~container_apps_api_client.models.ContainerApp] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.app.models.ContainerApp] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerApp"] + _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-06-01-preview")) # 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] 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, - name=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( @@ -360,34 +421,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, - name: str, + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - name=name, + 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(request, stream=False, **kwargs) + 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, 204]: @@ -397,14 +469,14 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, - name: str, + container_app_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Delete a Container App. @@ -413,8 +485,8 @@ async def begin_delete( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param name: Name of the Container App. - :type name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -427,18 +499,25 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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-06-01-preview")) # 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, - name=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) @@ -448,8 +527,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( @@ -458,72 +543,142 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}"} # type: ignore - @distributed_trace_async - async def update( + async def _update_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, - name: str, - container_app_envelope: "_models.ContainerAppPatch", + container_app_name: str, + container_app_envelope: _models.ContainerApp, **kwargs: Any - ) -> "_models.ContainerApp": - """Update properties of a Container App. - - Patches a Container App. Currently only patching of tags is supported. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param name: Name of the Container App. - :type name: str - :param container_app_envelope: Properties of a container app that need to be updated. - :type container_app_envelope: ~container_apps_api_client.models.ContainerAppPatch - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ContainerApp, or the result of cls(response) - :rtype: ~container_apps_api_client.models.ContainerApp - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerApp"] + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - 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 {}) - _json = self._serialize.body(container_app_envelope, 'ContainerAppPatch') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # 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] - request = build_update_request( + _json = self._serialize.body(container_app_envelope, 'ContainerApp') + + request = build_update_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - name=name, + container_app_name=container_app_name, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + 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(request, stream=False, **kwargs) + 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]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ContainerApp', pipeline_response) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, {}) + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}"} # type: ignore - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}'} # type: ignore + @distributed_trace_async + async def begin_update( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + container_app_envelope: _models.ContainerApp, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update properties of a Container App. + Patches a Container App using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param container_app_envelope: Properties of a Container App that need to be updated. + :type container_app_envelope: ~azure.mgmt.app.models.ContainerApp + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = 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-06-01-preview")) # 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( # 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): + if cls: + return cls(pipeline_response, None, {}) + + + 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( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}"} # type: ignore @distributed_trace_async async def list_custom_host_name_analysis( @@ -532,7 +687,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. @@ -541,31 +696,43 @@ async def list_custom_host_name_analysis( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param custom_hostname: Custom hostname. + :param custom_hostname: Custom hostname. Default value is None. :type custom_hostname: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomHostnameAnalysisResult, or the result of cls(response) - :rtype: ~container_apps_api_client.models.CustomHostnameAnalysisResult + :rtype: ~azure.mgmt.app.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 {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CustomHostnameAnalysisResult] request = build_list_custom_host_name_analysis_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, + 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(request, stream=False, **kwargs) + 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]: @@ -580,46 +747,58 @@ async def list_custom_host_name_analysis( return deserialized - list_custom_host_name_analysis.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listCustomHostNameAnalysis'} # type: ignore + list_custom_host_name_analysis.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listCustomHostNameAnalysis"} # type: ignore @distributed_trace_async async def list_secrets( self, resource_group_name: str, - name: str, + container_app_name: str, **kwargs: Any - ) -> "_models.SecretsCollection": + ) -> _models.SecretsCollection: """List secrets for a container app. List secrets for a container app. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param name: Name of the Container App. - :type name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SecretsCollection, or the result of cls(response) - :rtype: ~container_apps_api_client.models.SecretsCollection + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SecretsCollection] request = build_list_secrets_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -634,5 +813,5 @@ async def list_secrets( return deserialized - list_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}/listSecrets'} # type: ignore + list_secrets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listSecrets"} # type: ignore diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_revision_replicas_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_revision_replicas_operations.py index 7b64ea72d645..7c7ebb7bed34 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_revision_replicas_operations.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_revision_replicas_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,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: ~container_apps_api_client.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.app.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( @@ -50,9 +48,9 @@ async def get_replica( resource_group_name: str, container_app_name: str, revision_name: str, - 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. @@ -63,18 +61,23 @@ async def get_replica( :type container_app_name: str :param revision_name: Name of the Container App Revision. :type revision_name: str - :param name: Name of the Container App Revision Replica. - :type name: str + :param replica_name: Name of the Container App Revision Replica. + :type replica_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Replica, or the result of cls(response) - :rtype: ~container_apps_api_client.models.Replica + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Replica] request = build_get_replica_request( @@ -82,13 +85,20 @@ async def get_replica( resource_group_name=resource_group_name, container_app_name=container_app_name, revision_name=revision_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -103,7 +113,7 @@ async def get_replica( return deserialized - get_replica.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{name}'} # type: ignore + get_replica.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{replicaName}"} # type: ignore @distributed_trace_async @@ -113,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. @@ -126,14 +136,19 @@ async def list_replicas( :type revision_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ReplicaCollection, or the result of cls(response) - :rtype: ~container_apps_api_client.models.ReplicaCollection + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ReplicaCollection] request = build_list_replicas_request( @@ -141,12 +156,19 @@ async def list_replicas( resource_group_name=resource_group_name, container_app_name=container_app_name, 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(request, stream=False, **kwargs) + 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]: @@ -161,5 +183,5 @@ async def list_replicas( return deserialized - list_replicas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas'} # type: ignore + list_replicas.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas"} # type: ignore diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_revisions_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_revisions_operations.py index 5cd9f2e3fd2d..a3c3c0edefb9 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_revisions_operations.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_revisions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,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 @@ -25,34 +25,33 @@ 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: ~container_apps_api_client.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.app.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( self, resource_group_name: str, 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. @@ -61,17 +60,23 @@ def list_revisions( :type resource_group_name: str :param container_app_name: Name of the Container App for which Revisions are needed. :type container_app_name: str + :param filter: The filter to apply on the operation. Default value is None. + :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RevisionCollection or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~container_apps_api_client.models.RevisionCollection] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.app.models.RevisionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RevisionCollection"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + 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: @@ -79,10 +84,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, + 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: @@ -90,10 +99,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, + 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 @@ -107,7 +120,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -121,16 +138,16 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_revisions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions'} # type: ignore + list_revisions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions"} # type: ignore @distributed_trace_async async def get_revision( self, resource_group_name: str, container_app_name: str, - 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. @@ -139,31 +156,43 @@ async def get_revision( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param name: Name of the Container App Revision. - :type name: str + :param revision_name: Name of the Container App Revision. + :type revision_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Revision, or the result of cls(response) - :rtype: ~container_apps_api_client.models.Revision + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Revision] request = build_get_revision_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -178,15 +207,15 @@ async def get_revision( return deserialized - get_revision.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}'} # type: ignore + get_revision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}"} # type: ignore @distributed_trace_async - async def activate_revision( + async def activate_revision( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, container_app_name: str, - name: str, + revision_name: str, **kwargs: Any ) -> None: """Activates a revision for a Container App. @@ -197,31 +226,43 @@ async def activate_revision( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param name: Name of the Container App Revision. - :type name: str + :param revision_name: Name of the Container App Revision. + :type revision_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_activate_revision_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -232,15 +273,15 @@ async def activate_revision( if cls: return cls(pipeline_response, None, {}) - activate_revision.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/activate'} # type: ignore + activate_revision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/activate"} # type: ignore @distributed_trace_async - async def deactivate_revision( + async def deactivate_revision( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, container_app_name: str, - name: str, + revision_name: str, **kwargs: Any ) -> None: """Deactivates a revision for a Container App. @@ -251,31 +292,43 @@ async def deactivate_revision( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param name: Name of the Container App Revision. - :type name: str + :param revision_name: Name of the Container App Revision. + :type revision_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_deactivate_revision_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -286,15 +339,15 @@ async def deactivate_revision( if cls: return cls(pipeline_response, None, {}) - deactivate_revision.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/deactivate'} # type: ignore + deactivate_revision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/deactivate"} # type: ignore @distributed_trace_async - async def restart_revision( + async def restart_revision( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, container_app_name: str, - name: str, + revision_name: str, **kwargs: Any ) -> None: """Restarts a revision for a Container App. @@ -305,31 +358,43 @@ async def restart_revision( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param name: Name of the Container App Revision. - :type name: str + :param revision_name: Name of the Container App Revision. + :type revision_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_restart_revision_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -340,5 +405,5 @@ async def restart_revision( if cls: return cls(pipeline_response, None, {}) - restart_revision.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/restart'} # type: ignore + restart_revision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/restart"} # type: ignore diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_source_controls_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_source_controls_operations.py index f3b24eef4db3..8a425641a6db 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_source_controls_operations.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_container_apps_source_controls_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +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 @@ -17,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 @@ -27,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: ~container_apps_api_client.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.app.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( @@ -54,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. @@ -66,15 +64,19 @@ def list_by_container_app( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SourceControlCollection or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~container_apps_api_client.models.SourceControlCollection] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.app.models.SourceControlCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlCollection"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + 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: @@ -82,10 +84,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, 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: @@ -93,10 +98,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, 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 @@ -110,7 +118,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -124,16 +136,16 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_container_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols'} # type: ignore + list_by_container_app.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols"} # type: ignore @distributed_trace_async async def get( self, resource_group_name: str, container_app_name: str, - 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. @@ -142,31 +154,43 @@ async def get( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param name: Name of the Container App SourceControl. - :type name: str + :param source_control_name: Name of the Container App SourceControl. + :type source_control_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControl, or the result of cls(response) - :rtype: ~container_apps_api_client.models.SourceControl + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControl] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -181,24 +205,28 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, container_app_name: str, - name: str, - source_control_envelope: "_models.SourceControl", + source_control_name: str, + 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 {}) - 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-06-01-preview")) # 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') @@ -206,15 +234,22 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, - name=name, + source_control_name=source_control_name, + api_version=api_version, 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(request, stream=False, **kwargs) + 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]: @@ -232,7 +267,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}"} # type: ignore @distributed_trace_async @@ -240,10 +275,10 @@ async def begin_create_or_update( self, resource_group_name: str, container_app_name: str, - name: str, - source_control_envelope: "_models.SourceControl", + source_control_name: str, + 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. @@ -252,10 +287,10 @@ async def begin_create_or_update( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param name: Name of the Container App SourceControl. - :type name: str + :param source_control_name: Name of the Container App SourceControl. + :type source_control_name: str :param source_control_envelope: Properties used to create a Container App SourceControl. - :type source_control_envelope: ~container_apps_api_client.models.SourceControl + :type source_control_envelope: ~azure.mgmt.app.models.SourceControl :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -266,39 +301,51 @@ async def begin_create_or_update( Retry-After header is present. :return: An instance of AsyncLROPoller that returns either SourceControl or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~container_apps_api_client.models.SourceControl] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.app.models.SourceControl] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControl"] + _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-06-01-preview")) # 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] 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, - name=name, + source_control_name=source_control_name, source_control_envelope=source_control_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('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( @@ -307,36 +354,47 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, container_app_name: str, - name: str, + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, - name=name, + 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(request, stream=False, **kwargs) + 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, 204]: @@ -346,15 +404,15 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, container_app_name: str, - name: str, + source_control_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Delete a Container App SourceControl. @@ -365,8 +423,8 @@ async def begin_delete( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param name: Name of the Container App SourceControl. - :type name: str + :param source_control_name: Name of the Container App SourceControl. + :type source_control_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -379,19 +437,26 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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-06-01-preview")) # 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, - name=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) @@ -401,8 +466,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( @@ -411,7 +482,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}"} # type: ignore diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_dapr_components_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_dapr_components_operations.py index fa4d365e7441..c966df6d4930 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_dapr_components_operations.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_dapr_components_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,35 +15,34 @@ 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 from ..._vendor import _convert_request -from ...operations._dapr_components_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request +from ...operations._dapr_components_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request, build_list_secrets_request T = TypeVar('T') 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: ~container_apps_api_client.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.app.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( @@ -52,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. @@ -65,14 +63,19 @@ def list( :return: An iterator like instance of either DaprComponentsCollection or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~container_apps_api_client.models.DaprComponentsCollection] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.app.models.DaprComponentsCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DaprComponentsCollection"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + 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: @@ -80,10 +83,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, 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: @@ -91,10 +97,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, 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 @@ -108,7 +117,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -122,16 +135,16 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents"} # type: ignore @distributed_trace_async async def get( self, resource_group_name: str, environment_name: str, - name: str, + component_name: str, **kwargs: Any - ) -> "_models.DaprComponent": + ) -> _models.DaprComponent: """Get a dapr component. Get a dapr component. @@ -140,31 +153,43 @@ async def get( :type resource_group_name: str :param environment_name: Name of the Managed Environment. :type environment_name: str - :param name: Name of the Dapr Component. - :type name: str + :param component_name: Name of the Dapr Component. + :type component_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DaprComponent, or the result of cls(response) - :rtype: ~container_apps_api_client.models.DaprComponent + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DaprComponent] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, environment_name=environment_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -179,7 +204,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}"} # type: ignore @distributed_trace_async @@ -187,10 +212,10 @@ async def create_or_update( self, resource_group_name: str, environment_name: str, - name: str, - dapr_component_envelope: "_models.DaprComponent", + component_name: str, + 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. @@ -199,22 +224,26 @@ async def create_or_update( :type resource_group_name: str :param environment_name: Name of the Managed Environment. :type environment_name: str - :param name: Name of the Dapr Component. - :type name: str + :param component_name: Name of the Dapr Component. + :type component_name: str :param dapr_component_envelope: Configuration details of the Dapr Component. - :type dapr_component_envelope: ~container_apps_api_client.models.DaprComponent + :type dapr_component_envelope: ~azure.mgmt.app.models.DaprComponent :keyword callable cls: A custom type or function that will be passed the direct response :return: DaprComponent, or the result of cls(response) - :rtype: ~container_apps_api_client.models.DaprComponent + :rtype: ~azure.mgmt.app.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 {}) - 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-06-01-preview")) # 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') @@ -222,15 +251,22 @@ async def create_or_update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, environment_name=environment_name, - name=name, + component_name=component_name, + api_version=api_version, 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(request, stream=False, **kwargs) + 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]: @@ -245,15 +281,15 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, environment_name: str, - name: str, + component_name: str, **kwargs: Any ) -> None: """Delete a Dapr Component. @@ -264,31 +300,43 @@ async def delete( :type resource_group_name: str :param environment_name: Name of the Managed Environment. :type environment_name: str - :param name: Name of the Dapr Component. - :type name: str + :param component_name: Name of the Dapr Component. + :type component_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, environment_name=environment_name, - name=name, + 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(request, stream=False, **kwargs) + 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, 204]: @@ -299,5 +347,75 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}"} # type: ignore + + + @distributed_trace_async + async def list_secrets( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + **kwargs: Any + ) -> _models.DaprSecretsCollection: + """List secrets for a dapr component. + + List secrets for a dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :param component_name: Name of the Dapr Component. + :type component_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprSecretsCollection, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.DaprSecretsCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DaprSecretsCollection] + + + request = build_list_secrets_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DaprSecretsCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_secrets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/listSecrets"} # type: ignore diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_managed_environment_diagnostics_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_managed_environment_diagnostics_operations.py new file mode 100644 index 000000000000..0f141968e5ad --- /dev/null +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_managed_environment_diagnostics_operations.py @@ -0,0 +1,179 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._managed_environment_diagnostics_operations import build_get_detector_request, build_list_detectors_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagedEnvironmentDiagnosticsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.app.aio.ContainerAppsAPIClient`'s + :attr:`managed_environment_diagnostics` attribute. + """ + + models = _models + + 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_detectors( + self, + resource_group_name: str, + environment_name: str, + **kwargs: Any + ) -> _models.DiagnosticsCollection: + """Get the list of diagnostics for a given Managed Environment. + + Get the list of diagnostics for a Managed Environment used to host container apps. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Environment. + :type environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticsCollection, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.DiagnosticsCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DiagnosticsCollection] + + + request = build_list_detectors_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + api_version=api_version, + template_url=self.list_detectors.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticsCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_detectors.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors"} # type: ignore + + + @distributed_trace_async + async def get_detector( + self, + resource_group_name: str, + environment_name: str, + detector_name: str, + **kwargs: Any + ) -> _models.Diagnostics: + """Get the diagnostics data for a given Managed Environment. + + Get the diagnostics data for a Managed Environment used to host container apps. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Environment. + :type environment_name: str + :param detector_name: Name of the Managed Environment detector. + :type detector_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Diagnostics, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.Diagnostics + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Diagnostics] + + + request = build_get_detector_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + detector_name=detector_name, + api_version=api_version, + template_url=self.get_detector.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Diagnostics', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_detector.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors/{detectorName}"} # type: ignore + diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_managed_environments_diagnostics_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_managed_environments_diagnostics_operations.py new file mode 100644 index 000000000000..415d2886ffad --- /dev/null +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_managed_environments_diagnostics_operations.py @@ -0,0 +1,109 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._managed_environments_diagnostics_operations import build_get_root_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagedEnvironmentsDiagnosticsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.app.aio.ContainerAppsAPIClient`'s + :attr:`managed_environments_diagnostics` attribute. + """ + + models = _models + + 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_root( + self, + resource_group_name: str, + environment_name: str, + **kwargs: Any + ) -> _models.ManagedEnvironment: + """Get the properties of a Managed Environment. + + Get the properties of a Managed Environment used to host container apps. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Environment. + :type environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedEnvironment, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.ManagedEnvironment + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironment] + + + request = build_get_root_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + api_version=api_version, + template_url=self.get_root.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedEnvironment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_root.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectorproperties/rootApi/"} # type: ignore + diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_managed_environments_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_managed_environments_operations.py index a7cc217cfe3f..4879e6015b0b 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_managed_environments_operations.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_managed_environments_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +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 @@ -17,42 +16,41 @@ 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 from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_environments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request +from ...operations._managed_environments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request_initial T = TypeVar('T') 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: ~container_apps_api_client.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.app.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. @@ -61,32 +59,43 @@ def list_by_subscription( :return: An iterator like instance of either ManagedEnvironmentsCollection or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~container_apps_api_client.models.ManagedEnvironmentsCollection] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.app.models.ManagedEnvironmentsCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentsCollection"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + 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: request = build_list_by_subscription_request( 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: request = build_list_by_subscription_request( 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 @@ -100,7 +109,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -114,14 +127,14 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments"} # type: ignore @distributed_trace 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. @@ -132,34 +145,45 @@ def list_by_resource_group( :return: An iterator like instance of either ManagedEnvironmentsCollection or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~container_apps_api_client.models.ManagedEnvironmentsCollection] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.app.models.ManagedEnvironmentsCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentsCollection"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + 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: request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, 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: request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, 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 @@ -173,7 +197,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -187,45 +215,57 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments"} # type: ignore @distributed_trace_async async def get( self, resource_group_name: str, - 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. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param name: Name of the Environment. - :type name: str + :param environment_name: Name of the Environment. + :type environment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedEnvironment, or the result of cls(response) - :rtype: ~container_apps_api_client.models.ManagedEnvironment + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironment] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -240,38 +280,49 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, - name: str, - environment_envelope: "_models.ManagedEnvironment", + environment_name: str, + 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 {}) - 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-06-01-preview")) # 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') request = build_create_or_update_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - name=name, + environment_name=environment_name, + api_version=api_version, 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(request, stream=False, **kwargs) + 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, 201]: @@ -289,27 +340,27 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}"} # type: ignore @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, - name: str, - environment_envelope: "_models.ManagedEnvironment", + environment_name: str, + 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. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param name: Name of the Environment. - :type name: str + :param environment_name: Name of the Environment. + :type environment_name: str :param environment_envelope: Configuration details of the Environment. - :type environment_envelope: ~container_apps_api_client.models.ManagedEnvironment + :type environment_envelope: ~azure.mgmt.app.models.ManagedEnvironment :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -320,39 +371,50 @@ async def begin_create_or_update( Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ManagedEnvironment or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~container_apps_api_client.models.ManagedEnvironment] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.app.models.ManagedEnvironment] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironment"] + _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-06-01-preview")) # 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] 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, - name=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( @@ -361,34 +423,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, - name: str, + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - name=name, + 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(request, stream=False, **kwargs) + 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, 204]: @@ -398,14 +471,14 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, - name: str, + environment_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Delete a Managed Environment. @@ -414,8 +487,8 @@ async def begin_delete( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param name: Name of the Environment. - :type name: str + :param environment_name: Name of the Environment. + :type environment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -428,18 +501,25 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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-06-01-preview")) # 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, - name=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) @@ -449,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( @@ -459,69 +545,139 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}"} # type: ignore - @distributed_trace_async - async def update( + async def _update_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, - name: str, - environment_envelope: "_models.ManagedEnvironmentPatch", + environment_name: str, + environment_envelope: _models.ManagedEnvironment, **kwargs: Any - ) -> "_models.ManagedEnvironment": - """Update Managed Environment's properties. - - Patches a Managed Environment. Only patching of tags is supported currently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param name: Name of the Environment. - :type name: str - :param environment_envelope: Configuration details of the Environment. - :type environment_envelope: ~container_apps_api_client.models.ManagedEnvironmentPatch - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedEnvironment, or the result of cls(response) - :rtype: ~container_apps_api_client.models.ManagedEnvironment - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironment"] + ) -> 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 {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # 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, 'ManagedEnvironmentPatch') + _json = self._serialize.body(environment_envelope, 'ManagedEnvironment') - request = build_update_request( + request = build_update_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - name=name, + environment_name=environment_name, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + 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(request, stream=False, **kwargs) + 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]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ManagedEnvironment', pipeline_response) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, {}) - return deserialized + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}"} # type: ignore - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}'} # type: ignore + @distributed_trace_async + async def begin_update( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + environment_name: str, + environment_envelope: _models.ManagedEnvironment, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update Managed Environment's properties. + + Patches a Managed Environment using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Environment. + :type environment_name: str + :param environment_envelope: Configuration details of the Environment. + :type environment_envelope: ~azure.mgmt.app.models.ManagedEnvironment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = 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-06-01-preview")) # 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( # 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): + if cls: + return cls(pipeline_response, None, {}) + + + 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( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}"} # type: ignore diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_managed_environments_storages_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_managed_environments_storages_operations.py index a9db1bf2ac83..9622231e2037 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_managed_environments_storages_operations.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_managed_environments_storages_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,64 +23,74 @@ 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: ~container_apps_api_client.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.app.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( self, resource_group_name: str, - env_name: str, + environment_name: str, **kwargs: Any - ) -> "_models.ManagedEnvironmentStoragesCollection": + ) -> _models.ManagedEnvironmentStoragesCollection: """Get all storages for a managedEnvironment. Get all storages for a managedEnvironment. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param env_name: Name of the Environment. - :type env_name: str + :param environment_name: Name of the Environment. + :type environment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedEnvironmentStoragesCollection, or the result of cls(response) - :rtype: ~container_apps_api_client.models.ManagedEnvironmentStoragesCollection + :rtype: ~azure.mgmt.app.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 {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironmentStoragesCollection] request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - env_name=env_name, + 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(request, stream=False, **kwargs) + 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]: @@ -95,50 +105,62 @@ async def list( return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages"} # type: ignore @distributed_trace_async async def get( self, resource_group_name: str, - env_name: str, - name: str, + environment_name: str, + storage_name: str, **kwargs: Any - ) -> "_models.ManagedEnvironmentStorage": + ) -> _models.ManagedEnvironmentStorage: """Get storage for a managedEnvironment. Get storage for a managedEnvironment. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param env_name: Name of the Environment. - :type env_name: str - :param name: Name of the storage. - :type name: str + :param environment_name: Name of the Environment. + :type environment_name: str + :param storage_name: Name of the storage. + :type storage_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedEnvironmentStorage, or the result of cls(response) - :rtype: ~container_apps_api_client.models.ManagedEnvironmentStorage + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironmentStorage] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - env_name=env_name, - name=name, + environment_name=environment_name, + 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(request, stream=False, **kwargs) + 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]: @@ -153,58 +175,69 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}"} # type: ignore @distributed_trace_async async def create_or_update( self, resource_group_name: str, - env_name: str, - name: str, - storage_envelope: "_models.ManagedEnvironmentStorage", + environment_name: str, + storage_name: str, + storage_envelope: _models.ManagedEnvironmentStorage, **kwargs: Any - ) -> "_models.ManagedEnvironmentStorage": + ) -> _models.ManagedEnvironmentStorage: """Create or update storage for a managedEnvironment. Create or update storage for a managedEnvironment. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param env_name: Name of the Environment. - :type env_name: str - :param name: Name of the storage. - :type name: str + :param environment_name: Name of the Environment. + :type environment_name: str + :param storage_name: Name of the storage. + :type storage_name: str :param storage_envelope: Configuration details of storage. - :type storage_envelope: ~container_apps_api_client.models.ManagedEnvironmentStorage + :type storage_envelope: ~azure.mgmt.app.models.ManagedEnvironmentStorage :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedEnvironmentStorage, or the result of cls(response) - :rtype: ~container_apps_api_client.models.ManagedEnvironmentStorage + :rtype: ~azure.mgmt.app.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 {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # 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') request = build_create_or_update_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - env_name=env_name, - name=name, + environment_name=environment_name, + storage_name=storage_name, + api_version=api_version, 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(request, stream=False, **kwargs) + 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]: @@ -219,15 +252,15 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, - env_name: str, - name: str, + environment_name: str, + storage_name: str, **kwargs: Any ) -> None: """Delete storage for a managedEnvironment. @@ -236,33 +269,45 @@ async def delete( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param env_name: Name of the Environment. - :type env_name: str - :param name: Name of the storage. - :type name: str + :param environment_name: Name of the Environment. + :type environment_name: str + :param storage_name: Name of the storage. + :type storage_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - env_name=env_name, - name=name, + environment_name=environment_name, + 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(request, stream=False, **kwargs) + 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, 204]: @@ -273,5 +318,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}"} # type: ignore diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_namespaces_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_namespaces_operations.py new file mode 100644 index 000000000000..1d16566174f2 --- /dev/null +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_namespaces_operations.py @@ -0,0 +1,116 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._namespaces_operations import build_check_name_availability_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NamespacesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.app.aio.ContainerAppsAPIClient`'s + :attr:`namespaces` attribute. + """ + + models = _models + + 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, + **kwargs: Any + ) -> _models.CheckNameAvailabilityResponse: + """Checks the resource name availability. + + Checks if resource name is available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :param check_name_availability_request: The check name availability request. + :type check_name_availability_request: ~azure.mgmt.app.models.CheckNameAvailabilityRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResponse, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.CheckNameAvailabilityResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # 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') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + api_version=api_version, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/checkNameAvailability"} # type: ignore + diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_operations.py index 7280e090ac90..cc0fd92be724 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_operations.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +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.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 @@ -25,61 +24,69 @@ 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: ~container_apps_api_client.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.app.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 :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~container_apps_api_client.models.AvailableOperations] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.app.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + 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 @@ -93,7 +100,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,4 +118,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.App/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.App/operations"} # type: ignore diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_patch.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/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/app/azure-mgmt-app/azure/mgmt/app/models/__init__.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/models/__init__.py index 97ddbb90753e..aa06788f234b 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/models/__init__.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/models/__init__.py @@ -28,12 +28,18 @@ from ._models_py3 import CertificateCollection from ._models_py3 import CertificatePatch from ._models_py3 import CertificateProperties +from ._models_py3 import CheckNameAvailabilityRequest +from ._models_py3 import CheckNameAvailabilityResponse from ._models_py3 import ClientRegistration from ._models_py3 import Configuration +from ._models_py3 import ConnectedEnvironment +from ._models_py3 import ConnectedEnvironmentCollection +from ._models_py3 import ConnectedEnvironmentStorage +from ._models_py3 import ConnectedEnvironmentStorageProperties +from ._models_py3 import ConnectedEnvironmentStoragesCollection from ._models_py3 import Container from ._models_py3 import ContainerApp from ._models_py3 import ContainerAppCollection -from ._models_py3 import ContainerAppPatch from ._models_py3 import ContainerAppProbe from ._models_py3 import ContainerAppProbeHttpGet from ._models_py3 import ContainerAppProbeHttpGetHttpHeadersItem @@ -43,17 +49,33 @@ from ._models_py3 import CookieExpiration from ._models_py3 import CustomDomain from ._models_py3 import CustomHostnameAnalysisResult +from ._models_py3 import CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo +from ._models_py3 import CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem from ._models_py3 import CustomOpenIdConnectProvider from ._models_py3 import CustomScaleRule from ._models_py3 import Dapr from ._models_py3 import DaprComponent from ._models_py3 import DaprComponentsCollection from ._models_py3 import DaprMetadata +from ._models_py3 import DaprSecretsCollection from ._models_py3 import DefaultAuthorizationPolicy from ._models_py3 import DefaultErrorResponse from ._models_py3 import DefaultErrorResponseError from ._models_py3 import DefaultErrorResponseErrorDetailsItem +from ._models_py3 import DiagnosticDataProviderMetadata +from ._models_py3 import DiagnosticDataProviderMetadataPropertyBagItem +from ._models_py3 import DiagnosticDataTableResponseColumn +from ._models_py3 import DiagnosticDataTableResponseObject +from ._models_py3 import DiagnosticRendering +from ._models_py3 import DiagnosticSupportTopic +from ._models_py3 import Diagnostics +from ._models_py3 import DiagnosticsCollection +from ._models_py3 import DiagnosticsDataApiResponse +from ._models_py3 import DiagnosticsDefinition +from ._models_py3 import DiagnosticsProperties +from ._models_py3 import DiagnosticsStatus from ._models_py3 import EnvironmentVar +from ._models_py3 import ExtendedLocation from ._models_py3 import Facebook from ._models_py3 import ForwardProxy from ._models_py3 import GitHub @@ -71,7 +93,6 @@ from ._models_py3 import LoginRoutes from ._models_py3 import LoginScopes from ._models_py3 import ManagedEnvironment -from ._models_py3 import ManagedEnvironmentPatch from ._models_py3 import ManagedEnvironmentStorage from ._models_py3 import ManagedEnvironmentStorageProperties from ._models_py3 import ManagedEnvironmentStoragesCollection @@ -104,6 +125,7 @@ from ._models_py3 import SystemData from ._models_py3 import Template from ._models_py3 import TrackedResource +from ._models_py3 import TrafficLabel from ._models_py3 import TrafficWeight from ._models_py3 import Twitter from ._models_py3 import TwitterRegistration @@ -119,22 +141,28 @@ AppProtocol, BindingType, CertificateProvisioningState, + CheckNameAvailabilityReason, + ConnectedEnvironmentProvisioningState, ContainerAppProvisioningState, CookieExpirationConvention, CreatedByType, DnsVerificationTestResult, EnvironmentProvisioningState, + ExtendedLocationTypes, ForwardProxyConvention, IngressTransportMethod, ManagedServiceIdentityType, RevisionHealthState, RevisionProvisioningState, + Scheme, SourceControlOperationState, StorageType, 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', @@ -158,12 +186,18 @@ 'CertificateCollection', 'CertificatePatch', 'CertificateProperties', + 'CheckNameAvailabilityRequest', + 'CheckNameAvailabilityResponse', 'ClientRegistration', 'Configuration', + 'ConnectedEnvironment', + 'ConnectedEnvironmentCollection', + 'ConnectedEnvironmentStorage', + 'ConnectedEnvironmentStorageProperties', + 'ConnectedEnvironmentStoragesCollection', 'Container', 'ContainerApp', 'ContainerAppCollection', - 'ContainerAppPatch', 'ContainerAppProbe', 'ContainerAppProbeHttpGet', 'ContainerAppProbeHttpGetHttpHeadersItem', @@ -173,17 +207,33 @@ 'CookieExpiration', 'CustomDomain', 'CustomHostnameAnalysisResult', + 'CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo', + 'CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem', 'CustomOpenIdConnectProvider', 'CustomScaleRule', 'Dapr', 'DaprComponent', 'DaprComponentsCollection', 'DaprMetadata', + 'DaprSecretsCollection', 'DefaultAuthorizationPolicy', 'DefaultErrorResponse', 'DefaultErrorResponseError', 'DefaultErrorResponseErrorDetailsItem', + 'DiagnosticDataProviderMetadata', + 'DiagnosticDataProviderMetadataPropertyBagItem', + 'DiagnosticDataTableResponseColumn', + 'DiagnosticDataTableResponseObject', + 'DiagnosticRendering', + 'DiagnosticSupportTopic', + 'Diagnostics', + 'DiagnosticsCollection', + 'DiagnosticsDataApiResponse', + 'DiagnosticsDefinition', + 'DiagnosticsProperties', + 'DiagnosticsStatus', 'EnvironmentVar', + 'ExtendedLocation', 'Facebook', 'ForwardProxy', 'GitHub', @@ -201,7 +251,6 @@ 'LoginRoutes', 'LoginScopes', 'ManagedEnvironment', - 'ManagedEnvironmentPatch', 'ManagedEnvironmentStorage', 'ManagedEnvironmentStorageProperties', 'ManagedEnvironmentStoragesCollection', @@ -234,6 +283,7 @@ 'SystemData', 'Template', 'TrackedResource', + 'TrafficLabel', 'TrafficWeight', 'Twitter', 'TwitterRegistration', @@ -246,18 +296,24 @@ 'AppProtocol', 'BindingType', 'CertificateProvisioningState', + 'CheckNameAvailabilityReason', + 'ConnectedEnvironmentProvisioningState', 'ContainerAppProvisioningState', 'CookieExpirationConvention', 'CreatedByType', 'DnsVerificationTestResult', 'EnvironmentProvisioningState', + 'ExtendedLocationTypes', 'ForwardProxyConvention', 'IngressTransportMethod', 'ManagedServiceIdentityType', 'RevisionHealthState', 'RevisionProvisioningState', + 'Scheme', 'SourceControlOperationState', 'StorageType', '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/app/azure-mgmt-app/azure/mgmt/app/models/_container_apps_api_client_enums.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/models/_container_apps_api_client_enums.py index dfd7bb186bd7..e622921bb58e 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/models/_container_apps_api_client_enums.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/models/_container_apps_api_client_enums.py @@ -7,32 +7,31 @@ # -------------------------------------------------------------------------- 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: .. raw:: html - Multiple: multiple revisions can be active. If no value if provided, this is the - defaultSingle: Only one revision can be active at a time. Revision weights can not - be used in this mode + 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. """ - MULTIPLE = "multiple" - SINGLE = "single" + 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,7 +56,27 @@ class CertificateProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, DELETE_FAILED = "DeleteFailed" PENDING = "Pending" -class ContainerAppProvisioningState(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 ConnectedEnvironmentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the Kubernetes Environment. + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + WAITING = "Waiting" + INITIALIZATION_IN_PROGRESS = "InitializationInProgress" + INFRASTRUCTURE_SETUP_IN_PROGRESS = "InfrastructureSetupInProgress" + INFRASTRUCTURE_SETUP_COMPLETE = "InfrastructureSetupComplete" + SCHEDULED_FOR_DELETE = "ScheduledForDelete" + +class ContainerAppProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the Container App. """ @@ -66,14 +85,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. """ @@ -82,7 +101,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. """ @@ -90,7 +109,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. """ @@ -105,7 +124,13 @@ class EnvironmentProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, UPGRADE_REQUESTED = "UpgradeRequested" UPGRADE_FAILED = "UpgradeFailed" -class ForwardProxyConvention(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of extendedLocation. + """ + + CUSTOM_LOCATION = "CustomLocation" + +class ForwardProxyConvention(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The convention used to determine the url of the request made. """ @@ -113,7 +138,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 """ @@ -121,7 +146,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). """ @@ -131,7 +156,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 """ @@ -139,7 +164,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 """ @@ -149,7 +174,14 @@ class RevisionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enu DEPROVISIONING = "Deprovisioning" DEPROVISIONED = "Deprovisioned" -class SourceControlOperationState(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(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Current provisioning State of the operation """ @@ -158,22 +190,22 @@ 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. """ - LIVENESS = "liveness" - READINESS = "readiness" - STARTUP = "startup" + LIVENESS = "Liveness" + 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/app/azure-mgmt-app/azure/mgmt/app/models/_models_py3.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/models/_models_py3.py index 56167390e75d..ce170b2e3fbe 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/models/_models_py3.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/models/_models_py3.py @@ -7,12 +7,14 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Any, 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): @@ -81,9 +83,9 @@ class Apple(msrest.serialization.Model): the set registration; otherwise, :code:`true`. :vartype enabled: bool :ivar registration: The configuration settings of the Apple registration. - :vartype registration: ~container_apps_api_client.models.AppleRegistration + :vartype registration: ~azure.mgmt.app.models.AppleRegistration :ivar login: The configuration settings of the login flow. - :vartype login: ~container_apps_api_client.models.LoginScopes + :vartype login: ~azure.mgmt.app.models.LoginScopes """ _attribute_map = { @@ -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 ): """ @@ -105,9 +107,9 @@ def __init__( despite the set registration; otherwise, :code:`true`. :paramtype enabled: bool :keyword registration: The configuration settings of the Apple registration. - :paramtype registration: ~container_apps_api_client.models.AppleRegistration + :paramtype registration: ~azure.mgmt.app.models.AppleRegistration :keyword login: The configuration settings of the login flow. - :paramtype login: ~container_apps_api_client.models.LoginScopes + :paramtype login: ~azure.mgmt.app.models.LoginScopes """ super(Apple, self).__init__(**kwargs) self.enabled = enabled @@ -153,8 +155,7 @@ class AppLogsConfiguration(msrest.serialization.Model): :ivar destination: Logs destination. :vartype destination: str :ivar log_analytics_configuration: Log Analytics configuration. - :vartype log_analytics_configuration: - ~container_apps_api_client.models.LogAnalyticsConfiguration + :vartype log_analytics_configuration: ~azure.mgmt.app.models.LogAnalyticsConfiguration """ _attribute_map = { @@ -166,15 +167,14 @@ def __init__( self, *, destination: Optional[str] = None, - log_analytics_configuration: Optional["LogAnalyticsConfiguration"] = None, + log_analytics_configuration: Optional["_models.LogAnalyticsConfiguration"] = None, **kwargs ): """ :keyword destination: Logs destination. :paramtype destination: str :keyword log_analytics_configuration: Log Analytics configuration. - :paramtype log_analytics_configuration: - ~container_apps_api_client.models.LogAnalyticsConfiguration + :paramtype log_analytics_configuration: ~azure.mgmt.app.models.LogAnalyticsConfiguration """ super(AppLogsConfiguration, self).__init__(**kwargs) self.destination = destination @@ -228,7 +228,7 @@ class Resource(msrest.serialization.Model): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~container_apps_api_client.models.SystemData + :vartype system_data: ~azure.mgmt.app.models.SystemData """ _validation = { @@ -273,7 +273,7 @@ class ProxyResource(Resource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~container_apps_api_client.models.SystemData + :vartype system_data: ~azure.mgmt.app.models.SystemData """ _validation = { @@ -314,22 +314,22 @@ class AuthConfig(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~container_apps_api_client.models.SystemData + :vartype system_data: ~azure.mgmt.app.models.SystemData :ivar platform: The configuration settings of the platform of ContainerApp Service Authentication/Authorization. - :vartype platform: ~container_apps_api_client.models.AuthPlatform + :vartype platform: ~azure.mgmt.app.models.AuthPlatform :ivar global_validation: The configuration settings that determines the validation flow of users using Service Authentication/Authorization. - :vartype global_validation: ~container_apps_api_client.models.GlobalValidation + :vartype global_validation: ~azure.mgmt.app.models.GlobalValidation :ivar identity_providers: The configuration settings of each of the identity providers used to configure ContainerApp Service Authentication/Authorization. - :vartype identity_providers: ~container_apps_api_client.models.IdentityProviders + :vartype identity_providers: ~azure.mgmt.app.models.IdentityProviders :ivar login: The configuration settings of the login flow of users using ContainerApp Service Authentication/Authorization. - :vartype login: ~container_apps_api_client.models.Login + :vartype login: ~azure.mgmt.app.models.Login :ivar http_settings: The configuration settings of the HTTP requests for authentication and authorization requests made against ContainerApp Service Authentication/Authorization. - :vartype http_settings: ~container_apps_api_client.models.HttpSettings + :vartype http_settings: ~azure.mgmt.app.models.HttpSettings """ _validation = { @@ -354,29 +354,29 @@ 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 ): """ :keyword platform: The configuration settings of the platform of ContainerApp Service Authentication/Authorization. - :paramtype platform: ~container_apps_api_client.models.AuthPlatform + :paramtype platform: ~azure.mgmt.app.models.AuthPlatform :keyword global_validation: The configuration settings that determines the validation flow of users using Service Authentication/Authorization. - :paramtype global_validation: ~container_apps_api_client.models.GlobalValidation + :paramtype global_validation: ~azure.mgmt.app.models.GlobalValidation :keyword identity_providers: The configuration settings of each of the identity providers used to configure ContainerApp Service Authentication/Authorization. - :paramtype identity_providers: ~container_apps_api_client.models.IdentityProviders + :paramtype identity_providers: ~azure.mgmt.app.models.IdentityProviders :keyword login: The configuration settings of the login flow of users using ContainerApp Service Authentication/Authorization. - :paramtype login: ~container_apps_api_client.models.Login + :paramtype login: ~azure.mgmt.app.models.Login :keyword http_settings: The configuration settings of the HTTP requests for authentication and authorization requests made against ContainerApp Service Authentication/Authorization. - :paramtype http_settings: ~container_apps_api_client.models.HttpSettings + :paramtype http_settings: ~azure.mgmt.app.models.HttpSettings """ super(AuthConfig, self).__init__(**kwargs) self.platform = platform @@ -394,7 +394,7 @@ class AuthConfigCollection(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar value: Required. Collection of resources. - :vartype value: list[~container_apps_api_client.models.AuthConfig] + :vartype value: list[~azure.mgmt.app.models.AuthConfig] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -412,12 +412,12 @@ class AuthConfigCollection(msrest.serialization.Model): def __init__( self, *, - value: List["AuthConfig"], + value: List["_models.AuthConfig"], **kwargs ): """ :keyword value: Required. Collection of resources. - :paramtype value: list[~container_apps_api_client.models.AuthConfig] + :paramtype value: list[~azure.mgmt.app.models.AuthConfig] """ super(AuthConfigCollection, self).__init__(**kwargs) self.value = value @@ -468,7 +468,7 @@ class AvailableOperations(msrest.serialization.Model): """Available operations of the service. :ivar value: Collection of available operation details. - :vartype value: list[~container_apps_api_client.models.OperationDetail] + :vartype value: list[~azure.mgmt.app.models.OperationDetail] :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. :vartype next_link: str @@ -482,13 +482,13 @@ 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 ): """ :keyword value: Collection of available operation details. - :paramtype value: list[~container_apps_api_client.models.OperationDetail] + :paramtype value: list[~azure.mgmt.app.models.OperationDetail] :keyword next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. :paramtype next_link: str @@ -505,12 +505,12 @@ class AzureActiveDirectory(msrest.serialization.Model): enabled despite the set registration; otherwise, :code:`true`. :vartype enabled: bool :ivar registration: The configuration settings of the Azure Active Directory app registration. - :vartype registration: ~container_apps_api_client.models.AzureActiveDirectoryRegistration + :vartype registration: ~azure.mgmt.app.models.AzureActiveDirectoryRegistration :ivar login: The configuration settings of the Azure Active Directory login flow. - :vartype login: ~container_apps_api_client.models.AzureActiveDirectoryLogin + :vartype login: ~azure.mgmt.app.models.AzureActiveDirectoryLogin :ivar validation: The configuration settings of the Azure Active Directory token validation flow. - :vartype validation: ~container_apps_api_client.models.AzureActiveDirectoryValidation + :vartype validation: ~azure.mgmt.app.models.AzureActiveDirectoryValidation :ivar is_auto_provisioned: Gets a value indicating whether the Azure AD configuration was auto-provisioned using 1st party tooling. This is an internal flag primarily intended to support the Azure Management Portal. Users @@ -531,9 +531,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 ): @@ -543,12 +543,12 @@ def __init__( :paramtype enabled: bool :keyword registration: The configuration settings of the Azure Active Directory app registration. - :paramtype registration: ~container_apps_api_client.models.AzureActiveDirectoryRegistration + :paramtype registration: ~azure.mgmt.app.models.AzureActiveDirectoryRegistration :keyword login: The configuration settings of the Azure Active Directory login flow. - :paramtype login: ~container_apps_api_client.models.AzureActiveDirectoryLogin + :paramtype login: ~azure.mgmt.app.models.AzureActiveDirectoryLogin :keyword validation: The configuration settings of the Azure Active Directory token validation flow. - :paramtype validation: ~container_apps_api_client.models.AzureActiveDirectoryValidation + :paramtype validation: ~azure.mgmt.app.models.AzureActiveDirectoryValidation :keyword is_auto_provisioned: Gets a value indicating whether the Azure AD configuration was auto-provisioned using 1st party tooling. This is an internal flag primarily intended to support the Azure Management Portal. Users @@ -703,14 +703,13 @@ class AzureActiveDirectoryValidation(msrest.serialization.Model): :ivar jwt_claim_checks: The configuration settings of the checks that should be made while validating the JWT Claims. - :vartype jwt_claim_checks: ~container_apps_api_client.models.JwtClaimChecks + :vartype jwt_claim_checks: ~azure.mgmt.app.models.JwtClaimChecks :ivar allowed_audiences: The list of audiences that can make successful authentication/authorization requests. :vartype allowed_audiences: list[str] :ivar default_authorization_policy: The configuration settings of the default authorization policy. - :vartype default_authorization_policy: - ~container_apps_api_client.models.DefaultAuthorizationPolicy + :vartype default_authorization_policy: ~azure.mgmt.app.models.DefaultAuthorizationPolicy """ _attribute_map = { @@ -722,22 +721,21 @@ 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 ): """ :keyword jwt_claim_checks: The configuration settings of the checks that should be made while validating the JWT Claims. - :paramtype jwt_claim_checks: ~container_apps_api_client.models.JwtClaimChecks + :paramtype jwt_claim_checks: ~azure.mgmt.app.models.JwtClaimChecks :keyword allowed_audiences: The list of audiences that can make successful authentication/authorization requests. :paramtype allowed_audiences: list[str] :keyword default_authorization_policy: The configuration settings of the default authorization policy. - :paramtype default_authorization_policy: - ~container_apps_api_client.models.DefaultAuthorizationPolicy + :paramtype default_authorization_policy: ~azure.mgmt.app.models.DefaultAuthorizationPolicy """ super(AzureActiveDirectoryValidation, self).__init__(**kwargs) self.jwt_claim_checks = jwt_claim_checks @@ -798,8 +796,8 @@ 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". - :vartype access_mode: str or ~container_apps_api_client.models.AccessMode + :ivar access_mode: Access mode for storage. Known values are: "ReadOnly", "ReadWrite". + :vartype access_mode: str or ~azure.mgmt.app.models.AccessMode :ivar share_name: Azure file share name. :vartype share_name: str """ @@ -816,7 +814,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,9 +823,8 @@ 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". - :paramtype access_mode: str or ~container_apps_api_client.models.AccessMode + :keyword access_mode: Access mode for storage. Known values are: "ReadOnly", "ReadWrite". + :paramtype access_mode: str or ~azure.mgmt.app.models.AccessMode :keyword share_name: Azure file share name. :paramtype share_name: str """ @@ -845,7 +842,7 @@ class AzureStaticWebApps(msrest.serialization.Model): enabled despite the set registration; otherwise, :code:`true`. :vartype enabled: bool :ivar registration: The configuration settings of the Azure Static Web Apps registration. - :vartype registration: ~container_apps_api_client.models.AzureStaticWebAppsRegistration + :vartype registration: ~azure.mgmt.app.models.AzureStaticWebAppsRegistration """ _attribute_map = { @@ -857,7 +854,7 @@ def __init__( self, *, enabled: Optional[bool] = None, - registration: Optional["AzureStaticWebAppsRegistration"] = None, + registration: Optional["_models.AzureStaticWebAppsRegistration"] = None, **kwargs ): """ @@ -865,7 +862,7 @@ def __init__( be enabled despite the set registration; otherwise, :code:`true`. :paramtype enabled: bool :keyword registration: The configuration settings of the Azure Static Web Apps registration. - :paramtype registration: ~container_apps_api_client.models.AzureStaticWebAppsRegistration + :paramtype registration: ~azure.mgmt.app.models.AzureStaticWebAppsRegistration """ super(AzureStaticWebApps, self).__init__(**kwargs) self.enabled = enabled @@ -914,7 +911,7 @@ class TrackedResource(Resource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~container_apps_api_client.models.SystemData + :vartype system_data: ~azure.mgmt.app.models.SystemData :ivar tags: A set of tags. Resource tags. :vartype tags: dict[str, str] :ivar location: Required. The geo-location where the resource lives. @@ -973,13 +970,13 @@ class Certificate(TrackedResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~container_apps_api_client.models.SystemData + :vartype system_data: ~azure.mgmt.app.models.SystemData :ivar tags: A set of tags. Resource tags. :vartype tags: dict[str, str] :ivar location: Required. The geo-location where the resource lives. :vartype location: str :ivar properties: Certificate resource specific properties. - :vartype properties: ~container_apps_api_client.models.CertificateProperties + :vartype properties: ~azure.mgmt.app.models.CertificateProperties """ _validation = { @@ -1005,7 +1002,7 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - properties: Optional["CertificateProperties"] = None, + properties: Optional["_models.CertificateProperties"] = None, **kwargs ): """ @@ -1014,7 +1011,7 @@ def __init__( :keyword location: Required. The geo-location where the resource lives. :paramtype location: str :keyword properties: Certificate resource specific properties. - :paramtype properties: ~container_apps_api_client.models.CertificateProperties + :paramtype properties: ~azure.mgmt.app.models.CertificateProperties """ super(Certificate, self).__init__(tags=tags, location=location, **kwargs) self.properties = properties @@ -1028,7 +1025,7 @@ class CertificateCollection(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar value: Required. Collection of resources. - :vartype value: list[~container_apps_api_client.models.Certificate] + :vartype value: list[~azure.mgmt.app.models.Certificate] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -1046,12 +1043,12 @@ class CertificateCollection(msrest.serialization.Model): def __init__( self, *, - value: List["Certificate"], + value: List["_models.Certificate"], **kwargs ): """ :keyword value: Required. Collection of resources. - :paramtype value: list[~container_apps_api_client.models.Certificate] + :paramtype value: list[~azure.mgmt.app.models.Certificate] """ super(CertificateCollection, self).__init__(**kwargs) self.value = value @@ -1088,10 +1085,9 @@ 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". - :vartype provisioning_state: str or - ~container_apps_api_client.models.CertificateProvisioningState + :ivar provisioning_state: Provisioning state of the certificate. Known values are: "Succeeded", + "Failed", "Canceled", "DeleteFailed", "Pending". + :vartype provisioning_state: str or ~azure.mgmt.app.models.CertificateProvisioningState :ivar password: Certificate password. :vartype password: str :ivar subject_name: Subject name of the certificate. @@ -1162,6 +1158,79 @@ def __init__( self.public_key_hash = None +class CheckNameAvailabilityRequest(msrest.serialization.Model): + """The check availability request body. + + :ivar name: The name of the resource for which availability needs to be checked. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The name of the resource for which availability needs to be checked. + :paramtype name: str + :keyword type: The resource type. + :paramtype type: str + """ + super(CheckNameAvailabilityRequest, self).__init__(**kwargs) + self.name = name + self.type = type + + +class CheckNameAvailabilityResponse(msrest.serialization.Model): + """The check availability result. + + :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. Known values are: "Invalid", + "AlreadyExists". + :vartype reason: str or ~azure.mgmt.app.models.CheckNameAvailabilityReason + :ivar message: Detailed reason why the given name is available. + :vartype message: str + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = 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. Known values are: "Invalid", + "AlreadyExists". + :paramtype reason: str or ~azure.mgmt.app.models.CheckNameAvailabilityReason + :keyword message: Detailed reason why the given name is available. + :paramtype message: str + """ + super(CheckNameAvailabilityResponse, self).__init__(**kwargs) + self.name_available = name_available + self.reason = reason + self.message = message + + class ClientRegistration(msrest.serialization.Model): """The configuration settings of the app registration for providers that have client ids and client secrets. @@ -1198,24 +1267,24 @@ class Configuration(msrest.serialization.Model): """Non versioned Container App configuration properties that define the mutable settings of a Container app. :ivar secrets: Collection of secrets used by a Container app. - :vartype secrets: list[~container_apps_api_client.models.Secret] + :vartype secrets: list[~azure.mgmt.app.models.Secret] :ivar active_revisions_mode: ActiveRevisionsMode controls how active revisions are handled for the Container app: .. raw:: html - Multiple: multiple revisions can be active. If no value if provided, this is - the defaultSingle: Only one revision can be active at a time. Revision weights can - not be used in this mode. Possible values include: "multiple", "single". - :vartype active_revisions_mode: str or ~container_apps_api_client.models.ActiveRevisionsMode + 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.. Known values are: "Multiple", "Single". + :vartype active_revisions_mode: str or ~azure.mgmt.app.models.ActiveRevisionsMode :ivar ingress: Ingress configurations. - :vartype ingress: ~container_apps_api_client.models.Ingress + :vartype ingress: ~azure.mgmt.app.models.Ingress :ivar registries: Collection of private container registry credentials for containers used by the Container app. - :vartype registries: list[~container_apps_api_client.models.RegistryCredentials] + :vartype registries: list[~azure.mgmt.app.models.RegistryCredentials] :ivar dapr: Dapr configuration for the Container App. - :vartype dapr: ~container_apps_api_client.models.Dapr + :vartype dapr: ~azure.mgmt.app.models.Dapr """ _attribute_map = { @@ -1229,33 +1298,33 @@ 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 ): """ :keyword secrets: Collection of secrets used by a Container app. - :paramtype secrets: list[~container_apps_api_client.models.Secret] + :paramtype secrets: list[~azure.mgmt.app.models.Secret] :keyword active_revisions_mode: ActiveRevisionsMode controls how active revisions are handled for the Container app: .. raw:: html - Multiple: multiple revisions can be active. If no value if provided, this is - the defaultSingle: Only one revision can be active at a time. Revision weights can - not be used in this mode. Possible values include: "multiple", "single". - :paramtype active_revisions_mode: str or ~container_apps_api_client.models.ActiveRevisionsMode + 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.. Known values are: "Multiple", "Single". + :paramtype active_revisions_mode: str or ~azure.mgmt.app.models.ActiveRevisionsMode :keyword ingress: Ingress configurations. - :paramtype ingress: ~container_apps_api_client.models.Ingress + :paramtype ingress: ~azure.mgmt.app.models.Ingress :keyword registries: Collection of private container registry credentials for containers used by the Container app. - :paramtype registries: list[~container_apps_api_client.models.RegistryCredentials] + :paramtype registries: list[~azure.mgmt.app.models.RegistryCredentials] :keyword dapr: Dapr configuration for the Container App. - :paramtype dapr: ~container_apps_api_client.models.Dapr + :paramtype dapr: ~azure.mgmt.app.models.Dapr """ super(Configuration, self).__init__(**kwargs) self.secrets = secrets @@ -1265,6 +1334,244 @@ def __init__( self.dapr = dapr +class ConnectedEnvironment(TrackedResource): + """An environment for Kubernetes cluster specialized for web workloads by Azure App Service. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :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.app.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar extended_location: The complex type of the extended location. + :vartype extended_location: ~azure.mgmt.app.models.ExtendedLocation + :ivar provisioning_state: Provisioning state of the Kubernetes Environment. Known values are: + "Succeeded", "Failed", "Canceled", "Waiting", "InitializationInProgress", + "InfrastructureSetupInProgress", "InfrastructureSetupComplete", "ScheduledForDelete". + :vartype provisioning_state: str or + ~azure.mgmt.app.models.ConnectedEnvironmentProvisioningState + :ivar deployment_errors: Any errors that occurred during deployment or deployment validation. + :vartype deployment_errors: str + :ivar default_domain: Default Domain Name for the cluster. + :vartype default_domain: str + :ivar static_ip: Static IP of the connectedEnvironment. + :vartype static_ip: str + :ivar dapr_ai_connection_string: Application Insights connection string used by Dapr to export + Service to Service communication telemetry. + :vartype dapr_ai_connection_string: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'deployment_errors': {'readonly': True}, + 'default_domain': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'deployment_errors': {'key': 'properties.deploymentErrors', 'type': 'str'}, + 'default_domain': {'key': 'properties.defaultDomain', 'type': 'str'}, + 'static_ip': {'key': 'properties.staticIp', 'type': 'str'}, + 'dapr_ai_connection_string': {'key': 'properties.daprAIConnectionString', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + static_ip: Optional[str] = None, + dapr_ai_connection_string: Optional[str] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword extended_location: The complex type of the extended location. + :paramtype extended_location: ~azure.mgmt.app.models.ExtendedLocation + :keyword static_ip: Static IP of the connectedEnvironment. + :paramtype static_ip: str + :keyword dapr_ai_connection_string: Application Insights connection string used by Dapr to + export Service to Service communication telemetry. + :paramtype dapr_ai_connection_string: str + """ + super(ConnectedEnvironment, self).__init__(tags=tags, location=location, **kwargs) + self.extended_location = extended_location + self.provisioning_state = None + self.deployment_errors = None + self.default_domain = None + self.static_ip = static_ip + self.dapr_ai_connection_string = dapr_ai_connection_string + + +class ConnectedEnvironmentCollection(msrest.serialization.Model): + """Collection of connectedEnvironments. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Collection of resources. + :vartype value: list[~azure.mgmt.app.models.ConnectedEnvironment] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ConnectedEnvironment]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ConnectedEnvironment"]] = None, + **kwargs + ): + """ + :keyword value: Collection of resources. + :paramtype value: list[~azure.mgmt.app.models.ConnectedEnvironment] + """ + super(ConnectedEnvironmentCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ConnectedEnvironmentStorage(ProxyResource): + """Storage resource for connectedEnvironment. + + 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.app.models.SystemData + :ivar properties: Storage properties. + :vartype properties: ~azure.mgmt.app.models.ConnectedEnvironmentStorageProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'ConnectedEnvironmentStorageProperties'}, + } + + def __init__( + self, + *, + properties: Optional["_models.ConnectedEnvironmentStorageProperties"] = None, + **kwargs + ): + """ + :keyword properties: Storage properties. + :paramtype properties: ~azure.mgmt.app.models.ConnectedEnvironmentStorageProperties + """ + super(ConnectedEnvironmentStorage, self).__init__(**kwargs) + self.properties = properties + + +class ConnectedEnvironmentStorageProperties(msrest.serialization.Model): + """Storage properties. + + :ivar azure_file: Azure file properties. + :vartype azure_file: ~azure.mgmt.app.models.AzureFileProperties + """ + + _attribute_map = { + 'azure_file': {'key': 'azureFile', 'type': 'AzureFileProperties'}, + } + + def __init__( + self, + *, + azure_file: Optional["_models.AzureFileProperties"] = None, + **kwargs + ): + """ + :keyword azure_file: Azure file properties. + :paramtype azure_file: ~azure.mgmt.app.models.AzureFileProperties + """ + super(ConnectedEnvironmentStorageProperties, self).__init__(**kwargs) + self.azure_file = azure_file + + +class ConnectedEnvironmentStoragesCollection(msrest.serialization.Model): + """Collection of Storage for Environments. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. Collection of storage resources. + :vartype value: list[~azure.mgmt.app.models.ConnectedEnvironmentStorage] + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ConnectedEnvironmentStorage]'}, + } + + def __init__( + self, + *, + value: List["_models.ConnectedEnvironmentStorage"], + **kwargs + ): + """ + :keyword value: Required. Collection of storage resources. + :paramtype value: list[~azure.mgmt.app.models.ConnectedEnvironmentStorage] + """ + super(ConnectedEnvironmentStoragesCollection, self).__init__(**kwargs) + self.value = value + + class Container(msrest.serialization.Model): """Container App container definition. @@ -1277,13 +1584,13 @@ class Container(msrest.serialization.Model): :ivar args: Container start command arguments. :vartype args: list[str] :ivar env: Container environment variables. - :vartype env: list[~container_apps_api_client.models.EnvironmentVar] + :vartype env: list[~azure.mgmt.app.models.EnvironmentVar] :ivar resources: Container resource requirements. - :vartype resources: ~container_apps_api_client.models.ContainerResources + :vartype resources: ~azure.mgmt.app.models.ContainerResources :ivar probes: List of probes for the container. - :vartype probes: list[~container_apps_api_client.models.ContainerAppProbe] + :vartype probes: list[~azure.mgmt.app.models.ContainerAppProbe] :ivar volume_mounts: Container volume mounts. - :vartype volume_mounts: list[~container_apps_api_client.models.VolumeMount] + :vartype volume_mounts: list[~azure.mgmt.app.models.VolumeMount] """ _attribute_map = { @@ -1304,10 +1611,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 ): """ @@ -1320,13 +1627,13 @@ def __init__( :keyword args: Container start command arguments. :paramtype args: list[str] :keyword env: Container environment variables. - :paramtype env: list[~container_apps_api_client.models.EnvironmentVar] + :paramtype env: list[~azure.mgmt.app.models.EnvironmentVar] :keyword resources: Container resource requirements. - :paramtype resources: ~container_apps_api_client.models.ContainerResources + :paramtype resources: ~azure.mgmt.app.models.ContainerResources :keyword probes: List of probes for the container. - :paramtype probes: list[~container_apps_api_client.models.ContainerAppProbe] + :paramtype probes: list[~azure.mgmt.app.models.ContainerAppProbe] :keyword volume_mounts: Container volume mounts. - :paramtype volume_mounts: list[~container_apps_api_client.models.VolumeMount] + :paramtype volume_mounts: list[~azure.mgmt.app.models.VolumeMount] """ super(Container, self).__init__(**kwargs) self.image = image @@ -1356,20 +1663,23 @@ class ContainerApp(TrackedResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~container_apps_api_client.models.SystemData + :vartype system_data: ~azure.mgmt.app.models.SystemData :ivar tags: A set of tags. Resource tags. :vartype tags: dict[str, str] :ivar location: Required. The geo-location where the resource lives. :vartype location: str + :ivar extended_location: The complex type of the extended location. + :vartype extended_location: ~azure.mgmt.app.models.ExtendedLocation :ivar identity: managed identities for the Container App to interact with other Azure services without maintaining any secrets or credentials in code. - :vartype identity: ~container_apps_api_client.models.ManagedServiceIdentity - :ivar provisioning_state: Provisioning state of the Container App. Possible values include: + :vartype identity: ~azure.mgmt.app.models.ManagedServiceIdentity + :ivar provisioning_state: Provisioning state of the Container App. Known values are: "InProgress", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~container_apps_api_client.models.ContainerAppProvisioningState - :ivar managed_environment_id: Resource ID of the Container App's environment. + :vartype provisioning_state: str or ~azure.mgmt.app.models.ContainerAppProvisioningState + :ivar managed_environment_id: Deprecated. Resource ID of the Container App's environment. :vartype managed_environment_id: str + :ivar environment_id: Resource ID of environment. + :vartype environment_id: str :ivar latest_revision_name: Name of the latest revision of the Container App. :vartype latest_revision_name: str :ivar latest_revision_fqdn: Fully Qualified Domain Name of the latest revision of the Container @@ -1378,9 +1688,9 @@ class ContainerApp(TrackedResource): :ivar custom_domain_verification_id: Id used to verify domain name ownership. :vartype custom_domain_verification_id: str :ivar configuration: Non versioned Container App configuration properties. - :vartype configuration: ~container_apps_api_client.models.Configuration + :vartype configuration: ~azure.mgmt.app.models.Configuration :ivar template: Container App versioned application definition. - :vartype template: ~container_apps_api_client.models.Template + :vartype template: ~azure.mgmt.app.models.Template :ivar outbound_ip_addresses: Outbound IP Addresses for container app. :vartype outbound_ip_addresses: list[str] """ @@ -1405,9 +1715,11 @@ class ContainerApp(TrackedResource): 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'managed_environment_id': {'key': 'properties.managedEnvironmentId', 'type': 'str'}, + 'environment_id': {'key': 'properties.environmentId', 'type': 'str'}, 'latest_revision_name': {'key': 'properties.latestRevisionName', 'type': 'str'}, 'latest_revision_fqdn': {'key': 'properties.latestRevisionFqdn', 'type': 'str'}, 'custom_domain_verification_id': {'key': 'properties.customDomainVerificationId', 'type': 'str'}, @@ -1421,10 +1733,12 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, managed_environment_id: Optional[str] = None, - configuration: Optional["Configuration"] = None, - template: Optional["Template"] = None, + environment_id: Optional[str] = None, + configuration: Optional["_models.Configuration"] = None, + template: Optional["_models.Template"] = None, **kwargs ): """ @@ -1432,20 +1746,26 @@ def __init__( :paramtype tags: dict[str, str] :keyword location: Required. The geo-location where the resource lives. :paramtype location: str + :keyword extended_location: The complex type of the extended location. + :paramtype extended_location: ~azure.mgmt.app.models.ExtendedLocation :keyword identity: managed identities for the Container App to interact with other Azure services without maintaining any secrets or credentials in code. - :paramtype identity: ~container_apps_api_client.models.ManagedServiceIdentity - :keyword managed_environment_id: Resource ID of the Container App's environment. + :paramtype identity: ~azure.mgmt.app.models.ManagedServiceIdentity + :keyword managed_environment_id: Deprecated. Resource ID of the Container App's environment. :paramtype managed_environment_id: str + :keyword environment_id: Resource ID of environment. + :paramtype environment_id: str :keyword configuration: Non versioned Container App configuration properties. - :paramtype configuration: ~container_apps_api_client.models.Configuration + :paramtype configuration: ~azure.mgmt.app.models.Configuration :keyword template: Container App versioned application definition. - :paramtype template: ~container_apps_api_client.models.Template + :paramtype template: ~azure.mgmt.app.models.Template """ super(ContainerApp, self).__init__(tags=tags, location=location, **kwargs) + self.extended_location = extended_location self.identity = identity self.provisioning_state = None self.managed_environment_id = managed_environment_id + self.environment_id = environment_id self.latest_revision_name = None self.latest_revision_fqdn = None self.custom_domain_verification_id = None @@ -1462,7 +1782,7 @@ class ContainerAppCollection(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar value: Required. Collection of resources. - :vartype value: list[~container_apps_api_client.models.ContainerApp] + :vartype value: list[~azure.mgmt.app.models.ContainerApp] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -1480,43 +1800,18 @@ class ContainerAppCollection(msrest.serialization.Model): def __init__( self, *, - value: List["ContainerApp"], + value: List["_models.ContainerApp"], **kwargs ): """ :keyword value: Required. Collection of resources. - :paramtype value: list[~container_apps_api_client.models.ContainerApp] + :paramtype value: list[~azure.mgmt.app.models.ContainerApp] """ super(ContainerAppCollection, self).__init__(**kwargs) self.value = value self.next_link = None -class ContainerAppPatch(msrest.serialization.Model): - """Container App Patch. - - :ivar tags: A set of tags. Application-specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Application-specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(ContainerAppPatch, self).__init__(**kwargs) - self.tags = tags - - class ContainerAppProbe(msrest.serialization.Model): """Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic. @@ -1524,7 +1819,7 @@ class ContainerAppProbe(msrest.serialization.Model): after having succeeded. Defaults to 3. Minimum value is 1. Maximum value is 10. :vartype failure_threshold: int :ivar http_get: HTTPGet specifies the http request to perform. - :vartype http_get: ~container_apps_api_client.models.ContainerAppProbeHttpGet + :vartype http_get: ~azure.mgmt.app.models.ContainerAppProbeHttpGet :ivar initial_delay_seconds: Number of seconds after the container has started before liveness probes are initiated. Minimum value is 1. Maximum value is 60. :vartype initial_delay_seconds: int @@ -1537,7 +1832,7 @@ class ContainerAppProbe(msrest.serialization.Model): :vartype success_threshold: int :ivar tcp_socket: TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported. - :vartype tcp_socket: ~container_apps_api_client.models.ContainerAppProbeTcpSocket + :vartype tcp_socket: ~azure.mgmt.app.models.ContainerAppProbeTcpSocket :ivar termination_grace_period_seconds: Optional duration in seconds the pod needs to terminate gracefully upon probe failure. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly @@ -1551,8 +1846,8 @@ 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". - :vartype type: str or ~container_apps_api_client.models.Type + :ivar type: The type of probe. Known values are: "Liveness", "Readiness", "Startup". + :vartype type: str or ~azure.mgmt.app.models.Type """ _attribute_map = { @@ -1571,14 +1866,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 ): """ @@ -1586,7 +1881,7 @@ def __init__( after having succeeded. Defaults to 3. Minimum value is 1. Maximum value is 10. :paramtype failure_threshold: int :keyword http_get: HTTPGet specifies the http request to perform. - :paramtype http_get: ~container_apps_api_client.models.ContainerAppProbeHttpGet + :paramtype http_get: ~azure.mgmt.app.models.ContainerAppProbeHttpGet :keyword initial_delay_seconds: Number of seconds after the container has started before liveness probes are initiated. Minimum value is 1. Maximum value is 60. :paramtype initial_delay_seconds: int @@ -1599,7 +1894,7 @@ def __init__( :paramtype success_threshold: int :keyword tcp_socket: TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported. - :paramtype tcp_socket: ~container_apps_api_client.models.ContainerAppProbeTcpSocket + :paramtype tcp_socket: ~azure.mgmt.app.models.ContainerAppProbeTcpSocket :keyword termination_grace_period_seconds: Optional duration in seconds the pod needs to terminate gracefully upon probe failure. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are @@ -1613,8 +1908,8 @@ 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". - :paramtype type: str or ~container_apps_api_client.models.Type + :keyword type: The type of probe. Known values are: "Liveness", "Readiness", "Startup". + :paramtype type: str or ~azure.mgmt.app.models.Type """ super(ContainerAppProbe, self).__init__(**kwargs) self.failure_threshold = failure_threshold @@ -1637,15 +1932,15 @@ class ContainerAppProbeHttpGet(msrest.serialization.Model): httpHeaders instead. :vartype host: str :ivar http_headers: Custom headers to set in the request. HTTP allows repeated headers. - :vartype http_headers: - list[~container_apps_api_client.models.ContainerAppProbeHttpGetHttpHeadersItem] + :vartype http_headers: list[~azure.mgmt.app.models.ContainerAppProbeHttpGetHttpHeadersItem] :ivar path: Path to access on the HTTP server. :vartype path: str :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. - :vartype scheme: str + :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. Known values are: + "HTTP", "HTTPS". + :vartype scheme: str or ~azure.mgmt.app.models.Scheme """ _validation = { @@ -1665,9 +1960,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[str] = None, + scheme: Optional[Union[str, "_models.Scheme"]] = None, **kwargs ): """ @@ -1675,15 +1970,15 @@ def __init__( in httpHeaders instead. :paramtype host: str :keyword http_headers: Custom headers to set in the request. HTTP allows repeated headers. - :paramtype http_headers: - list[~container_apps_api_client.models.ContainerAppProbeHttpGetHttpHeadersItem] + :paramtype http_headers: list[~azure.mgmt.app.models.ContainerAppProbeHttpGetHttpHeadersItem] :keyword path: Path to access on the HTTP server. :paramtype path: str :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. - :paramtype scheme: str + :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. Known values are: + "HTTP", "HTTPS". + :paramtype scheme: str or ~azure.mgmt.app.models.Scheme """ super(ContainerAppProbeHttpGet, self).__init__(**kwargs) self.host = host @@ -1849,9 +2144,9 @@ 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". - :vartype convention: str or ~container_apps_api_client.models.CookieExpirationConvention + :ivar convention: The convention used when determining the session cookie's expiration. Known + values are: "FixedTime", "IdentityProviderDerived". + :vartype convention: str or ~azure.mgmt.app.models.CookieExpirationConvention :ivar time_to_expiration: The time after the request is made when the session cookie should expire. :vartype time_to_expiration: str @@ -1865,14 +2160,14 @@ 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". - :paramtype convention: str or ~container_apps_api_client.models.CookieExpirationConvention + Known values are: "FixedTime", "IdentityProviderDerived". + :paramtype convention: str or ~azure.mgmt.app.models.CookieExpirationConvention :keyword time_to_expiration: The time after the request is made when the session cookie should expire. :paramtype time_to_expiration: str @@ -1889,9 +2184,8 @@ class CustomDomain(msrest.serialization.Model): :ivar name: Required. Hostname. :vartype name: str - :ivar binding_type: Custom Domain binding type. Possible values include: "Disabled", - "SniEnabled". - :vartype binding_type: str or ~container_apps_api_client.models.BindingType + :ivar binding_type: Custom Domain binding type. Known values are: "Disabled", "SniEnabled". + :vartype binding_type: str or ~azure.mgmt.app.models.BindingType :ivar certificate_id: Required. Resource Id of the Certificate to be bound to this hostname. Must exist in the Managed Environment. :vartype certificate_id: str @@ -1913,15 +2207,14 @@ 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". - :paramtype binding_type: str or ~container_apps_api_client.models.BindingType + :keyword binding_type: Custom Domain binding type. Known values are: "Disabled", "SniEnabled". + :paramtype binding_type: str or ~azure.mgmt.app.models.BindingType :keyword certificate_id: Required. Resource Id of the Certificate to be bound to this hostname. Must exist in the Managed Environment. :paramtype certificate_id: str @@ -1932,35 +2225,24 @@ 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: ~container_apps_api_client.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 - ~container_apps_api_client.models.DnsVerificationTestResult + ~azure.mgmt.app.models.DnsVerificationTestResult :ivar custom_domain_verification_failure_info: Raw failure information if DNS verification fails. :vartype custom_domain_verification_failure_info: - ~container_apps_api_client.models.DefaultErrorResponse + ~azure.mgmt.app.models.CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo :ivar has_conflict_on_managed_environment: :code:`true` if there is a conflict on the Container App's managed environment; otherwise, :code:`false`. :vartype has_conflict_on_managed_environment: bool @@ -1980,10 +2262,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}, @@ -1993,21 +2271,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': 'CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo'}, + '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__( @@ -2046,6 +2320,90 @@ def __init__( self.alternate_txt_records = alternate_txt_records +class CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo(msrest.serialization.Model): + """Raw failure information if DNS verification fails. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Standardized string to programmatically identify the error. + :vartype code: str + :ivar message: Detailed error description and debugging information. + :vartype message: str + :ivar target: Detailed error description and debugging information. + :vartype target: str + :ivar details: Details or the error. + :vartype details: + list[~azure.mgmt.app.models.CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem]'}, + } + + def __init__( + self, + *, + details: Optional[List["_models.CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem"]] = None, + **kwargs + ): + """ + :keyword details: Details or the error. + :paramtype details: + list[~azure.mgmt.app.models.CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem] + """ + super(CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = details + + +class CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem(msrest.serialization.Model): + """Detailed errors. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Standardized string to programmatically identify the error. + :vartype code: str + :ivar message: Detailed error description and debugging information. + :vartype message: str + :ivar target: Detailed error description and debugging information. + :vartype target: str + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + + class CustomOpenIdConnectProvider(msrest.serialization.Model): """The configuration settings of the custom Open ID Connect provider. @@ -2054,10 +2412,10 @@ class CustomOpenIdConnectProvider(msrest.serialization.Model): :vartype enabled: bool :ivar registration: The configuration settings of the app registration for the custom Open ID Connect provider. - :vartype registration: ~container_apps_api_client.models.OpenIdConnectRegistration + :vartype registration: ~azure.mgmt.app.models.OpenIdConnectRegistration :ivar login: The configuration settings of the login flow of the custom Open ID Connect provider. - :vartype login: ~container_apps_api_client.models.OpenIdConnectLogin + :vartype login: ~azure.mgmt.app.models.OpenIdConnectLogin """ _attribute_map = { @@ -2070,8 +2428,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 ): """ @@ -2080,10 +2438,10 @@ def __init__( :paramtype enabled: bool :keyword registration: The configuration settings of the app registration for the custom Open ID Connect provider. - :paramtype registration: ~container_apps_api_client.models.OpenIdConnectRegistration + :paramtype registration: ~azure.mgmt.app.models.OpenIdConnectRegistration :keyword login: The configuration settings of the login flow of the custom Open ID Connect provider. - :paramtype login: ~container_apps_api_client.models.OpenIdConnectLogin + :paramtype login: ~azure.mgmt.app.models.OpenIdConnectLogin """ super(CustomOpenIdConnectProvider, self).__init__(**kwargs) self.enabled = enabled @@ -2100,7 +2458,7 @@ class CustomScaleRule(msrest.serialization.Model): :ivar metadata: Metadata properties to describe custom scale rule. :vartype metadata: dict[str, str] :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~container_apps_api_client.models.ScaleRuleAuth] + :vartype auth: list[~azure.mgmt.app.models.ScaleRuleAuth] """ _attribute_map = { @@ -2114,7 +2472,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 ): """ @@ -2124,7 +2482,7 @@ def __init__( :keyword metadata: Metadata properties to describe custom scale rule. :paramtype metadata: dict[str, str] :keyword auth: Authentication secrets for the custom scale rule. - :paramtype auth: list[~container_apps_api_client.models.ScaleRuleAuth] + :paramtype auth: list[~azure.mgmt.app.models.ScaleRuleAuth] """ super(CustomScaleRule, self).__init__(**kwargs) self.type = type @@ -2140,10 +2498,12 @@ 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". - :vartype app_protocol: str or ~container_apps_api_client.models.AppProtocol + and grpc. Default is http. Known values are: "http", "grpc". + :vartype app_protocol: str or ~azure.mgmt.app.models.AppProtocol :ivar app_port: Tells Dapr which port your application is listening on. :vartype app_port: int + :ivar http_read_buffer_size: + :vartype http_read_buffer_size: int """ _attribute_map = { @@ -2151,6 +2511,7 @@ class Dapr(msrest.serialization.Model): 'app_id': {'key': 'appId', 'type': 'str'}, 'app_protocol': {'key': 'appProtocol', 'type': 'str'}, 'app_port': {'key': 'appPort', 'type': 'int'}, + 'http_read_buffer_size': {'key': 'httpReadBufferSize', 'type': 'int'}, } def __init__( @@ -2158,8 +2519,9 @@ 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, + http_read_buffer_size: Optional[int] = None, **kwargs ): """ @@ -2168,16 +2530,19 @@ 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". - :paramtype app_protocol: str or ~container_apps_api_client.models.AppProtocol + http and grpc. Default is http. Known values are: "http", "grpc". + :paramtype app_protocol: str or ~azure.mgmt.app.models.AppProtocol :keyword app_port: Tells Dapr which port your application is listening on. :paramtype app_port: int + :keyword http_read_buffer_size: + :paramtype http_read_buffer_size: int """ super(Dapr, self).__init__(**kwargs) self.enabled = enabled self.app_id = app_id self.app_protocol = app_protocol self.app_port = app_port + self.http_read_buffer_size = http_read_buffer_size class DaprComponent(ProxyResource): @@ -2195,7 +2560,7 @@ class DaprComponent(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~container_apps_api_client.models.SystemData + :vartype system_data: ~azure.mgmt.app.models.SystemData :ivar component_type: Component type. :vartype component_type: str :ivar version: Component version. @@ -2205,9 +2570,9 @@ class DaprComponent(ProxyResource): :ivar init_timeout: Initialization timeout. :vartype init_timeout: str :ivar secrets: Collection of secrets used by a Dapr component. - :vartype secrets: list[~container_apps_api_client.models.Secret] + :vartype secrets: list[~azure.mgmt.app.models.Secret] :ivar metadata: Component metadata. - :vartype metadata: list[~container_apps_api_client.models.DaprMetadata] + :vartype metadata: list[~azure.mgmt.app.models.DaprMetadata] :ivar scopes: Names of container apps that can use this Dapr component. :vartype scopes: list[str] """ @@ -2224,62 +2589,561 @@ class DaprComponent(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'component_type': {'key': 'properties.componentType', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'ignore_errors': {'key': 'properties.ignoreErrors', 'type': 'bool'}, - 'init_timeout': {'key': 'properties.initTimeout', 'type': 'str'}, - 'secrets': {'key': 'properties.secrets', 'type': '[Secret]'}, - 'metadata': {'key': 'properties.metadata', 'type': '[DaprMetadata]'}, - 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + 'component_type': {'key': 'properties.componentType', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'ignore_errors': {'key': 'properties.ignoreErrors', 'type': 'bool'}, + 'init_timeout': {'key': 'properties.initTimeout', 'type': 'str'}, + 'secrets': {'key': 'properties.secrets', 'type': '[Secret]'}, + 'metadata': {'key': 'properties.metadata', 'type': '[DaprMetadata]'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + } + + def __init__( + self, + *, + component_type: Optional[str] = None, + version: Optional[str] = None, + ignore_errors: Optional[bool] = None, + init_timeout: Optional[str] = None, + secrets: Optional[List["_models.Secret"]] = None, + metadata: Optional[List["_models.DaprMetadata"]] = None, + scopes: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword component_type: Component type. + :paramtype component_type: str + :keyword version: Component version. + :paramtype version: str + :keyword ignore_errors: Boolean describing if the component errors are ignores. + :paramtype ignore_errors: bool + :keyword init_timeout: Initialization timeout. + :paramtype init_timeout: str + :keyword secrets: Collection of secrets used by a Dapr component. + :paramtype secrets: list[~azure.mgmt.app.models.Secret] + :keyword metadata: Component metadata. + :paramtype metadata: list[~azure.mgmt.app.models.DaprMetadata] + :keyword scopes: Names of container apps that can use this Dapr component. + :paramtype scopes: list[str] + """ + super(DaprComponent, self).__init__(**kwargs) + self.component_type = component_type + self.version = version + self.ignore_errors = ignore_errors + self.init_timeout = init_timeout + self.secrets = secrets + self.metadata = metadata + self.scopes = scopes + + +class DaprComponentsCollection(msrest.serialization.Model): + """Dapr Components ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. Collection of resources. + :vartype value: list[~azure.mgmt.app.models.DaprComponent] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DaprComponent]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["_models.DaprComponent"], + **kwargs + ): + """ + :keyword value: Required. Collection of resources. + :paramtype value: list[~azure.mgmt.app.models.DaprComponent] + """ + super(DaprComponentsCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DaprMetadata(msrest.serialization.Model): + """Dapr component metadata. + + :ivar name: Metadata property name. + :vartype name: str + :ivar value: Metadata property value. + :vartype value: str + :ivar secret_ref: Name of the Dapr Component secret from which to pull the metadata property + value. + :vartype secret_ref: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'secret_ref': {'key': 'secretRef', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + secret_ref: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Metadata property name. + :paramtype name: str + :keyword value: Metadata property value. + :paramtype value: str + :keyword secret_ref: Name of the Dapr Component secret from which to pull the metadata property + value. + :paramtype secret_ref: str + """ + super(DaprMetadata, self).__init__(**kwargs) + self.name = name + self.value = value + self.secret_ref = secret_ref + + +class DaprSecretsCollection(msrest.serialization.Model): + """Dapr component Secrets Collection ARM resource. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. Collection of secrets used by a Dapr component. + :vartype value: list[~azure.mgmt.app.models.Secret] + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Secret]'}, + } + + def __init__( + self, + *, + value: List["_models.Secret"], + **kwargs + ): + """ + :keyword value: Required. Collection of secrets used by a Dapr component. + :paramtype value: list[~azure.mgmt.app.models.Secret] + """ + super(DaprSecretsCollection, self).__init__(**kwargs) + self.value = value + + +class DefaultAuthorizationPolicy(msrest.serialization.Model): + """The configuration settings of the Azure Active Directory default authorization policy. + + :ivar allowed_principals: The configuration settings of the Azure Active Directory allowed + principals. + :vartype allowed_principals: ~azure.mgmt.app.models.AllowedPrincipals + :ivar allowed_applications: The configuration settings of the Azure Active Directory allowed + applications. + :vartype allowed_applications: list[str] + """ + + _attribute_map = { + 'allowed_principals': {'key': 'allowedPrincipals', 'type': 'AllowedPrincipals'}, + 'allowed_applications': {'key': 'allowedApplications', 'type': '[str]'}, + } + + def __init__( + self, + *, + allowed_principals: Optional["_models.AllowedPrincipals"] = None, + allowed_applications: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword allowed_principals: The configuration settings of the Azure Active Directory allowed + principals. + :paramtype allowed_principals: ~azure.mgmt.app.models.AllowedPrincipals + :keyword allowed_applications: The configuration settings of the Azure Active Directory allowed + applications. + :paramtype allowed_applications: list[str] + """ + super(DefaultAuthorizationPolicy, self).__init__(**kwargs) + self.allowed_principals = allowed_principals + self.allowed_applications = allowed_applications + + +class DefaultErrorResponse(msrest.serialization.Model): + """App Service error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: Error model. + :vartype error: ~azure.mgmt.app.models.DefaultErrorResponseError + """ + + _validation = { + 'error': {'readonly': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'DefaultErrorResponseError'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DefaultErrorResponse, self).__init__(**kwargs) + self.error = None + + +class DefaultErrorResponseError(msrest.serialization.Model): + """Error model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Standardized string to programmatically identify the error. + :vartype code: str + :ivar message: Detailed error description and debugging information. + :vartype message: str + :ivar target: Detailed error description and debugging information. + :vartype target: str + :ivar details: Details or the error. + :vartype details: list[~azure.mgmt.app.models.DefaultErrorResponseErrorDetailsItem] + :ivar innererror: More information to debug error. + :vartype innererror: str + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'innererror': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[DefaultErrorResponseErrorDetailsItem]'}, + 'innererror': {'key': 'innererror', 'type': 'str'}, + } + + def __init__( + self, + *, + details: Optional[List["_models.DefaultErrorResponseErrorDetailsItem"]] = None, + **kwargs + ): + """ + :keyword details: Details or the error. + :paramtype details: list[~azure.mgmt.app.models.DefaultErrorResponseErrorDetailsItem] + """ + super(DefaultErrorResponseError, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = details + self.innererror = None + + +class DefaultErrorResponseErrorDetailsItem(msrest.serialization.Model): + """Detailed errors. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Standardized string to programmatically identify the error. + :vartype code: str + :ivar message: Detailed error description and debugging information. + :vartype message: str + :ivar target: Detailed error description and debugging information. + :vartype target: str + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DefaultErrorResponseErrorDetailsItem, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + + +class DiagnosticDataProviderMetadata(msrest.serialization.Model): + """Details of a diagnostics data provider. + + :ivar provider_name: Name of data provider. + :vartype provider_name: str + :ivar property_bag: Collection of properties. + :vartype property_bag: + list[~azure.mgmt.app.models.DiagnosticDataProviderMetadataPropertyBagItem] + """ + + _attribute_map = { + 'provider_name': {'key': 'providerName', 'type': 'str'}, + 'property_bag': {'key': 'propertyBag', 'type': '[DiagnosticDataProviderMetadataPropertyBagItem]'}, + } + + def __init__( + self, + *, + provider_name: Optional[str] = None, + property_bag: Optional[List["_models.DiagnosticDataProviderMetadataPropertyBagItem"]] = None, + **kwargs + ): + """ + :keyword provider_name: Name of data provider. + :paramtype provider_name: str + :keyword property_bag: Collection of properties. + :paramtype property_bag: + list[~azure.mgmt.app.models.DiagnosticDataProviderMetadataPropertyBagItem] + """ + super(DiagnosticDataProviderMetadata, self).__init__(**kwargs) + self.provider_name = provider_name + self.property_bag = property_bag + + +class DiagnosticDataProviderMetadataPropertyBagItem(msrest.serialization.Model): + """Property details. + + :ivar name: Property name. + :vartype name: str + :ivar value: Property value. + :vartype value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Property name. + :paramtype name: str + :keyword value: Property value. + :paramtype value: str + """ + super(DiagnosticDataProviderMetadataPropertyBagItem, self).__init__(**kwargs) + self.name = name + self.value = value + + +class DiagnosticDataTableResponseColumn(msrest.serialization.Model): + """Diagnostics data column. + + :ivar column_name: Column name. + :vartype column_name: str + :ivar data_type: Data type of the column. + :vartype data_type: str + :ivar column_type: Column type. + :vartype column_type: str + """ + + _attribute_map = { + 'column_name': {'key': 'columnName', 'type': 'str'}, + 'data_type': {'key': 'dataType', 'type': 'str'}, + 'column_type': {'key': 'columnType', 'type': 'str'}, + } + + def __init__( + self, + *, + column_name: Optional[str] = None, + data_type: Optional[str] = None, + column_type: Optional[str] = None, + **kwargs + ): + """ + :keyword column_name: Column name. + :paramtype column_name: str + :keyword data_type: Data type of the column. + :paramtype data_type: str + :keyword column_type: Column type. + :paramtype column_type: str + """ + super(DiagnosticDataTableResponseColumn, self).__init__(**kwargs) + self.column_name = column_name + self.data_type = data_type + self.column_type = column_type + + +class DiagnosticDataTableResponseObject(msrest.serialization.Model): + """Diagnostics data table. + + :ivar table_name: Table name. + :vartype table_name: str + :ivar columns: Columns in the table. + :vartype columns: list[~azure.mgmt.app.models.DiagnosticDataTableResponseColumn] + :ivar rows: Rows in the table. + :vartype rows: list[any] + """ + + _attribute_map = { + 'table_name': {'key': 'tableName', 'type': 'str'}, + 'columns': {'key': 'columns', 'type': '[DiagnosticDataTableResponseColumn]'}, + 'rows': {'key': 'rows', 'type': '[object]'}, + } + + def __init__( + self, + *, + table_name: Optional[str] = None, + columns: Optional[List["_models.DiagnosticDataTableResponseColumn"]] = None, + rows: Optional[List[Any]] = None, + **kwargs + ): + """ + :keyword table_name: Table name. + :paramtype table_name: str + :keyword columns: Columns in the table. + :paramtype columns: list[~azure.mgmt.app.models.DiagnosticDataTableResponseColumn] + :keyword rows: Rows in the table. + :paramtype rows: list[any] + """ + super(DiagnosticDataTableResponseObject, self).__init__(**kwargs) + self.table_name = table_name + self.columns = columns + self.rows = rows + + +class DiagnosticRendering(msrest.serialization.Model): + """Rendering details of a diagnostics table. + + :ivar type: Rendering type. + :vartype type: int + :ivar title: Title of the table. + :vartype title: str + :ivar description: Description of the table. + :vartype description: str + :ivar is_visible: Flag if the table should be rendered. + :vartype is_visible: bool + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'int'}, + 'title': {'key': 'title', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'is_visible': {'key': 'isVisible', 'type': 'bool'}, + } + + def __init__( + self, + *, + type: Optional[int] = None, + title: Optional[str] = None, + description: Optional[str] = None, + is_visible: Optional[bool] = None, + **kwargs + ): + """ + :keyword type: Rendering type. + :paramtype type: int + :keyword title: Title of the table. + :paramtype title: str + :keyword description: Description of the table. + :paramtype description: str + :keyword is_visible: Flag if the table should be rendered. + :paramtype is_visible: bool + """ + super(DiagnosticRendering, self).__init__(**kwargs) + self.type = type + self.title = title + self.description = description + self.is_visible = is_visible + + +class Diagnostics(ProxyResource): + """Diagnostics data for a resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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.app.models.SystemData + :ivar properties: Diagnostics resource specific properties. + :vartype properties: ~azure.mgmt.app.models.DiagnosticsProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'DiagnosticsProperties'}, } def __init__( self, *, - component_type: Optional[str] = None, - version: Optional[str] = None, - ignore_errors: Optional[bool] = None, - init_timeout: Optional[str] = None, - secrets: Optional[List["Secret"]] = None, - metadata: Optional[List["DaprMetadata"]] = None, - scopes: Optional[List[str]] = None, + properties: Optional["_models.DiagnosticsProperties"] = None, **kwargs ): """ - :keyword component_type: Component type. - :paramtype component_type: str - :keyword version: Component version. - :paramtype version: str - :keyword ignore_errors: Boolean describing if the component errors are ignores. - :paramtype ignore_errors: bool - :keyword init_timeout: Initialization timeout. - :paramtype init_timeout: str - :keyword secrets: Collection of secrets used by a Dapr component. - :paramtype secrets: list[~container_apps_api_client.models.Secret] - :keyword metadata: Component metadata. - :paramtype metadata: list[~container_apps_api_client.models.DaprMetadata] - :keyword scopes: Names of container apps that can use this Dapr component. - :paramtype scopes: list[str] + :keyword properties: Diagnostics resource specific properties. + :paramtype properties: ~azure.mgmt.app.models.DiagnosticsProperties """ - super(DaprComponent, self).__init__(**kwargs) - self.component_type = component_type - self.version = version - self.ignore_errors = ignore_errors - self.init_timeout = init_timeout - self.secrets = secrets - self.metadata = metadata - self.scopes = scopes + super(Diagnostics, self).__init__(**kwargs) + self.properties = properties -class DaprComponentsCollection(msrest.serialization.Model): - """Dapr Components ARM resource. +class DiagnosticsCollection(msrest.serialization.Model): + """Diagnostics data collection for a resource. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar value: Required. Collection of resources. - :vartype value: list[~container_apps_api_client.models.DaprComponent] + :ivar value: Required. Collection of diagnostic data. + :vartype value: list[~azure.mgmt.app.models.Diagnostics] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -2290,203 +3154,226 @@ class DaprComponentsCollection(msrest.serialization.Model): } _attribute_map = { - 'value': {'key': 'value', 'type': '[DaprComponent]'}, + 'value': {'key': 'value', 'type': '[Diagnostics]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, *, - value: List["DaprComponent"], + value: List["_models.Diagnostics"], **kwargs ): """ - :keyword value: Required. Collection of resources. - :paramtype value: list[~container_apps_api_client.models.DaprComponent] + :keyword value: Required. Collection of diagnostic data. + :paramtype value: list[~azure.mgmt.app.models.Diagnostics] """ - super(DaprComponentsCollection, self).__init__(**kwargs) + super(DiagnosticsCollection, self).__init__(**kwargs) self.value = value self.next_link = None -class DaprMetadata(msrest.serialization.Model): - """Dapr component metadata. +class DiagnosticsDataApiResponse(msrest.serialization.Model): + """Diagnostics data returned from a detector. - :ivar name: Metadata property name. - :vartype name: str - :ivar value: Metadata property value. - :vartype value: str - :ivar secret_ref: Name of the Dapr Component secret from which to pull the metadata property - value. - :vartype secret_ref: str + :ivar table: Table response. + :vartype table: ~azure.mgmt.app.models.DiagnosticDataTableResponseObject + :ivar rendering_properties: Details of the table response. + :vartype rendering_properties: ~azure.mgmt.app.models.DiagnosticRendering """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'secret_ref': {'key': 'secretRef', 'type': 'str'}, + 'table': {'key': 'table', 'type': 'DiagnosticDataTableResponseObject'}, + 'rendering_properties': {'key': 'renderingProperties', 'type': 'DiagnosticRendering'}, } def __init__( self, *, - name: Optional[str] = None, - value: Optional[str] = None, - secret_ref: Optional[str] = None, + table: Optional["_models.DiagnosticDataTableResponseObject"] = None, + rendering_properties: Optional["_models.DiagnosticRendering"] = None, **kwargs ): """ - :keyword name: Metadata property name. - :paramtype name: str - :keyword value: Metadata property value. - :paramtype value: str - :keyword secret_ref: Name of the Dapr Component secret from which to pull the metadata property - value. - :paramtype secret_ref: str + :keyword table: Table response. + :paramtype table: ~azure.mgmt.app.models.DiagnosticDataTableResponseObject + :keyword rendering_properties: Details of the table response. + :paramtype rendering_properties: ~azure.mgmt.app.models.DiagnosticRendering """ - super(DaprMetadata, self).__init__(**kwargs) - self.name = name - self.value = value - self.secret_ref = secret_ref + super(DiagnosticsDataApiResponse, self).__init__(**kwargs) + self.table = table + self.rendering_properties = rendering_properties -class DefaultAuthorizationPolicy(msrest.serialization.Model): - """The configuration settings of the Azure Active Directory default authorization policy. +class DiagnosticsDefinition(msrest.serialization.Model): + """Metadata of the diagnostics response. - :ivar allowed_principals: The configuration settings of the Azure Active Directory allowed - principals. - :vartype allowed_principals: ~container_apps_api_client.models.AllowedPrincipals - :ivar allowed_applications: The configuration settings of the Azure Active Directory allowed - applications. - :vartype allowed_applications: list[str] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Unique detector name. + :vartype id: str + :ivar name: Display Name of the detector. + :vartype name: str + :ivar description: Details of the diagnostics info. + :vartype description: str + :ivar author: Authors' names of the detector. + :vartype author: str + :ivar category: Category of the detector. + :vartype category: str + :ivar support_topic_list: List of support topics. + :vartype support_topic_list: list[~azure.mgmt.app.models.DiagnosticSupportTopic] + :ivar analysis_types: List of analysis types. + :vartype analysis_types: list[str] + :ivar type: Authors' names of the detector. + :vartype type: str + :ivar score: Authors' names of the detector. + :vartype score: float """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'description': {'readonly': True}, + 'author': {'readonly': True}, + 'category': {'readonly': True}, + 'type': {'readonly': True}, + 'score': {'readonly': True}, + } + _attribute_map = { - 'allowed_principals': {'key': 'allowedPrincipals', 'type': 'AllowedPrincipals'}, - 'allowed_applications': {'key': 'allowedApplications', 'type': '[str]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'author': {'key': 'author', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'support_topic_list': {'key': 'supportTopicList', 'type': '[DiagnosticSupportTopic]'}, + 'analysis_types': {'key': 'analysisTypes', 'type': '[str]'}, + 'type': {'key': 'type', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, } def __init__( self, *, - allowed_principals: Optional["AllowedPrincipals"] = None, - allowed_applications: Optional[List[str]] = None, + support_topic_list: Optional[List["_models.DiagnosticSupportTopic"]] = None, + analysis_types: Optional[List[str]] = None, **kwargs ): """ - :keyword allowed_principals: The configuration settings of the Azure Active Directory allowed - principals. - :paramtype allowed_principals: ~container_apps_api_client.models.AllowedPrincipals - :keyword allowed_applications: The configuration settings of the Azure Active Directory allowed - applications. - :paramtype allowed_applications: list[str] + :keyword support_topic_list: List of support topics. + :paramtype support_topic_list: list[~azure.mgmt.app.models.DiagnosticSupportTopic] + :keyword analysis_types: List of analysis types. + :paramtype analysis_types: list[str] """ - super(DefaultAuthorizationPolicy, self).__init__(**kwargs) - self.allowed_principals = allowed_principals - self.allowed_applications = allowed_applications - + super(DiagnosticsDefinition, self).__init__(**kwargs) + self.id = None + self.name = None + self.description = None + self.author = None + self.category = None + self.support_topic_list = support_topic_list + self.analysis_types = analysis_types + self.type = None + self.score = None -class DefaultErrorResponse(msrest.serialization.Model): - """App Service error response. - Variables are only populated by the server, and will be ignored when sending a request. +class DiagnosticsProperties(msrest.serialization.Model): + """Diagnostics resource specific properties. - :ivar error: Error model. - :vartype error: ~container_apps_api_client.models.DefaultErrorResponseError + :ivar metadata: Metadata of the diagnostics response. + :vartype metadata: ~azure.mgmt.app.models.DiagnosticsDefinition + :ivar dataset: Set of data collections associated with the response. + :vartype dataset: list[~azure.mgmt.app.models.DiagnosticsDataApiResponse] + :ivar status: Status of the diagnostics response. + :vartype status: ~azure.mgmt.app.models.DiagnosticsStatus + :ivar data_provider_metadata: List of data providers' metadata. + :vartype data_provider_metadata: ~azure.mgmt.app.models.DiagnosticDataProviderMetadata """ - _validation = { - 'error': {'readonly': True}, - } - _attribute_map = { - 'error': {'key': 'error', 'type': 'DefaultErrorResponseError'}, + 'metadata': {'key': 'metadata', 'type': 'DiagnosticsDefinition'}, + 'dataset': {'key': 'dataset', 'type': '[DiagnosticsDataApiResponse]'}, + 'status': {'key': 'status', 'type': 'DiagnosticsStatus'}, + 'data_provider_metadata': {'key': 'dataProviderMetadata', 'type': 'DiagnosticDataProviderMetadata'}, } def __init__( self, + *, + metadata: Optional["_models.DiagnosticsDefinition"] = None, + dataset: Optional[List["_models.DiagnosticsDataApiResponse"]] = None, + status: Optional["_models.DiagnosticsStatus"] = None, + data_provider_metadata: Optional["_models.DiagnosticDataProviderMetadata"] = None, **kwargs ): """ + :keyword metadata: Metadata of the diagnostics response. + :paramtype metadata: ~azure.mgmt.app.models.DiagnosticsDefinition + :keyword dataset: Set of data collections associated with the response. + :paramtype dataset: list[~azure.mgmt.app.models.DiagnosticsDataApiResponse] + :keyword status: Status of the diagnostics response. + :paramtype status: ~azure.mgmt.app.models.DiagnosticsStatus + :keyword data_provider_metadata: List of data providers' metadata. + :paramtype data_provider_metadata: ~azure.mgmt.app.models.DiagnosticDataProviderMetadata """ - super(DefaultErrorResponse, self).__init__(**kwargs) - self.error = None - + super(DiagnosticsProperties, self).__init__(**kwargs) + self.metadata = metadata + self.dataset = dataset + self.status = status + self.data_provider_metadata = data_provider_metadata -class DefaultErrorResponseError(msrest.serialization.Model): - """Error model. - Variables are only populated by the server, and will be ignored when sending a request. +class DiagnosticsStatus(msrest.serialization.Model): + """Rendering details of a diagnostics table. - :ivar code: Standardized string to programmatically identify the error. - :vartype code: str - :ivar message: Detailed error description and debugging information. + :ivar message: Diagnostic message. :vartype message: str - :ivar target: Detailed error description and debugging information. - :vartype target: str - :ivar details: Details or the error. - :vartype details: list[~container_apps_api_client.models.DefaultErrorResponseErrorDetailsItem] - :ivar innererror: More information to debug error. - :vartype innererror: str + :ivar status_id: Status. + :vartype status_id: int """ - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'innererror': {'readonly': True}, - } - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[DefaultErrorResponseErrorDetailsItem]'}, - 'innererror': {'key': 'innererror', 'type': 'str'}, + 'status_id': {'key': 'statusId', 'type': 'int'}, } def __init__( self, *, - details: Optional[List["DefaultErrorResponseErrorDetailsItem"]] = None, + message: Optional[str] = None, + status_id: Optional[int] = None, **kwargs ): """ - :keyword details: Details or the error. - :paramtype details: - list[~container_apps_api_client.models.DefaultErrorResponseErrorDetailsItem] + :keyword message: Diagnostic message. + :paramtype message: str + :keyword status_id: Status. + :paramtype status_id: int """ - super(DefaultErrorResponseError, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = details - self.innererror = None + super(DiagnosticsStatus, self).__init__(**kwargs) + self.message = message + self.status_id = status_id -class DefaultErrorResponseErrorDetailsItem(msrest.serialization.Model): - """Detailed errors. +class DiagnosticSupportTopic(msrest.serialization.Model): + """Support topic information. Variables are only populated by the server, and will be ignored when sending a request. - :ivar code: Standardized string to programmatically identify the error. - :vartype code: str - :ivar message: Detailed error description and debugging information. - :vartype message: str - :ivar target: Detailed error description and debugging information. - :vartype target: str + :ivar id: Unique topic identifier. + :vartype id: str + :ivar pes_id: PES identifier. + :vartype pes_id: str """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, + 'id': {'readonly': True}, + 'pes_id': {'readonly': True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'pes_id': {'key': 'pesId', 'type': 'str'}, } def __init__( @@ -2495,10 +3382,9 @@ def __init__( ): """ """ - super(DefaultErrorResponseErrorDetailsItem, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None + super(DiagnosticSupportTopic, self).__init__(**kwargs) + self.id = None + self.pes_id = None class EnvironmentVar(msrest.serialization.Model): @@ -2542,6 +3428,38 @@ def __init__( self.secret_ref = secret_ref +class ExtendedLocation(msrest.serialization.Model): + """The complex type of the extended location. + + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. Known values are: "CustomLocation". + :vartype type: str or ~azure.mgmt.app.models.ExtendedLocationTypes + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, + **kwargs + ): + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. Known values are: "CustomLocation". + :paramtype type: str or ~azure.mgmt.app.models.ExtendedLocationTypes + """ + super(ExtendedLocation, self).__init__(**kwargs) + self.name = name + self.type = type + + class Facebook(msrest.serialization.Model): """The configuration settings of the Facebook provider. @@ -2550,11 +3468,11 @@ class Facebook(msrest.serialization.Model): :vartype enabled: bool :ivar registration: The configuration settings of the app registration for the Facebook provider. - :vartype registration: ~container_apps_api_client.models.AppRegistration + :vartype registration: ~azure.mgmt.app.models.AppRegistration :ivar graph_api_version: The version of the Facebook api to be used while logging in. :vartype graph_api_version: str :ivar login: The configuration settings of the login flow. - :vartype login: ~container_apps_api_client.models.LoginScopes + :vartype login: ~azure.mgmt.app.models.LoginScopes """ _attribute_map = { @@ -2568,9 +3486,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 ): """ @@ -2579,11 +3497,11 @@ def __init__( :paramtype enabled: bool :keyword registration: The configuration settings of the app registration for the Facebook provider. - :paramtype registration: ~container_apps_api_client.models.AppRegistration + :paramtype registration: ~azure.mgmt.app.models.AppRegistration :keyword graph_api_version: The version of the Facebook api to be used while logging in. :paramtype graph_api_version: str :keyword login: The configuration settings of the login flow. - :paramtype login: ~container_apps_api_client.models.LoginScopes + :paramtype login: ~azure.mgmt.app.models.LoginScopes """ super(Facebook, self).__init__(**kwargs) self.enabled = enabled @@ -2595,9 +3513,9 @@ 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". - :vartype convention: str or ~container_apps_api_client.models.ForwardProxyConvention + :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.app.models.ForwardProxyConvention :ivar custom_host_header_name: The name of the header containing the host of the request. :vartype custom_host_header_name: str :ivar custom_proto_header_name: The name of the header containing the scheme of the request. @@ -2613,15 +3531,15 @@ 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". - :paramtype convention: str or ~container_apps_api_client.models.ForwardProxyConvention + :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.app.models.ForwardProxyConvention :keyword custom_host_header_name: The name of the header containing the host of the request. :paramtype custom_host_header_name: str :keyword custom_proto_header_name: The name of the header containing the scheme of the request. @@ -2640,9 +3558,9 @@ class GitHub(msrest.serialization.Model): the set registration; otherwise, :code:`true`. :vartype enabled: bool :ivar registration: The configuration settings of the app registration for the GitHub provider. - :vartype registration: ~container_apps_api_client.models.ClientRegistration + :vartype registration: ~azure.mgmt.app.models.ClientRegistration :ivar login: The configuration settings of the login flow. - :vartype login: ~container_apps_api_client.models.LoginScopes + :vartype login: ~azure.mgmt.app.models.LoginScopes """ _attribute_map = { @@ -2655,8 +3573,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 ): """ @@ -2665,9 +3583,9 @@ def __init__( :paramtype enabled: bool :keyword registration: The configuration settings of the app registration for the GitHub provider. - :paramtype registration: ~container_apps_api_client.models.ClientRegistration + :paramtype registration: ~azure.mgmt.app.models.ClientRegistration :keyword login: The configuration settings of the login flow. - :paramtype login: ~container_apps_api_client.models.LoginScopes + :paramtype login: ~azure.mgmt.app.models.LoginScopes """ super(GitHub, self).__init__(**kwargs) self.enabled = enabled @@ -2679,25 +3597,28 @@ class GithubActionConfiguration(msrest.serialization.Model): """Configuration properties that define the mutable settings of a Container App SourceControl. :ivar registry_info: Registry configurations. - :vartype registry_info: ~container_apps_api_client.models.RegistryInfo + :vartype registry_info: ~azure.mgmt.app.models.RegistryInfo :ivar azure_credentials: AzureCredentials configurations. - :vartype azure_credentials: ~container_apps_api_client.models.AzureCredentials - :ivar dockerfile_path: Docker file path. - :vartype dockerfile_path: str + :vartype azure_credentials: ~azure.mgmt.app.models.AzureCredentials + :ivar context_path: Context path. + :vartype context_path: str + :ivar image: Image name. + :vartype image: str :ivar publish_type: Code or Image. :vartype publish_type: str :ivar os: Operation system. :vartype os: str :ivar runtime_stack: Runtime stack. :vartype runtime_stack: str - :ivar runtime_version: Runtime Version. + :ivar runtime_version: Runtime version. :vartype runtime_version: str """ _attribute_map = { 'registry_info': {'key': 'registryInfo', 'type': 'RegistryInfo'}, 'azure_credentials': {'key': 'azureCredentials', 'type': 'AzureCredentials'}, - 'dockerfile_path': {'key': 'dockerfilePath', 'type': 'str'}, + 'context_path': {'key': 'contextPath', 'type': 'str'}, + 'image': {'key': 'image', 'type': 'str'}, 'publish_type': {'key': 'publishType', 'type': 'str'}, 'os': {'key': 'os', 'type': 'str'}, 'runtime_stack': {'key': 'runtimeStack', 'type': 'str'}, @@ -2707,9 +3628,10 @@ class GithubActionConfiguration(msrest.serialization.Model): def __init__( self, *, - registry_info: Optional["RegistryInfo"] = None, - azure_credentials: Optional["AzureCredentials"] = None, - dockerfile_path: Optional[str] = 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, os: Optional[str] = None, runtime_stack: Optional[str] = None, @@ -2718,24 +3640,27 @@ def __init__( ): """ :keyword registry_info: Registry configurations. - :paramtype registry_info: ~container_apps_api_client.models.RegistryInfo + :paramtype registry_info: ~azure.mgmt.app.models.RegistryInfo :keyword azure_credentials: AzureCredentials configurations. - :paramtype azure_credentials: ~container_apps_api_client.models.AzureCredentials - :keyword dockerfile_path: Docker file path. - :paramtype dockerfile_path: str + :paramtype azure_credentials: ~azure.mgmt.app.models.AzureCredentials + :keyword context_path: Context path. + :paramtype context_path: str + :keyword image: Image name. + :paramtype image: str :keyword publish_type: Code or Image. :paramtype publish_type: str :keyword os: Operation system. :paramtype os: str :keyword runtime_stack: Runtime stack. :paramtype runtime_stack: str - :keyword runtime_version: Runtime Version. + :keyword runtime_version: Runtime version. :paramtype runtime_version: str """ super(GithubActionConfiguration, self).__init__(**kwargs) self.registry_info = registry_info self.azure_credentials = azure_credentials - self.dockerfile_path = dockerfile_path + self.context_path = context_path + self.image = image self.publish_type = publish_type self.os = os self.runtime_stack = runtime_stack @@ -2746,10 +3671,10 @@ 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 - ~container_apps_api_client.models.UnauthenticatedClientActionV2 + ~azure.mgmt.app.models.UnauthenticatedClientActionV2 :ivar redirect_to_provider: The default authentication provider to use when multiple providers are configured. This setting is only needed if multiple providers are configured and the unauthenticated @@ -2770,17 +3695,17 @@ 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 - ~container_apps_api_client.models.UnauthenticatedClientActionV2 + ~azure.mgmt.app.models.UnauthenticatedClientActionV2 :keyword redirect_to_provider: The default authentication provider to use when multiple providers are configured. This setting is only needed if multiple providers are configured and the unauthenticated @@ -2804,12 +3729,12 @@ class Google(msrest.serialization.Model): the set registration; otherwise, :code:`true`. :vartype enabled: bool :ivar registration: The configuration settings of the app registration for the Google provider. - :vartype registration: ~container_apps_api_client.models.ClientRegistration + :vartype registration: ~azure.mgmt.app.models.ClientRegistration :ivar login: The configuration settings of the login flow. - :vartype login: ~container_apps_api_client.models.LoginScopes + :vartype login: ~azure.mgmt.app.models.LoginScopes :ivar validation: The configuration settings of the Azure Active Directory token validation flow. - :vartype validation: ~container_apps_api_client.models.AllowedAudiencesValidation + :vartype validation: ~azure.mgmt.app.models.AllowedAudiencesValidation """ _attribute_map = { @@ -2823,9 +3748,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 ): """ @@ -2834,12 +3759,12 @@ def __init__( :paramtype enabled: bool :keyword registration: The configuration settings of the app registration for the Google provider. - :paramtype registration: ~container_apps_api_client.models.ClientRegistration + :paramtype registration: ~azure.mgmt.app.models.ClientRegistration :keyword login: The configuration settings of the login flow. - :paramtype login: ~container_apps_api_client.models.LoginScopes + :paramtype login: ~azure.mgmt.app.models.LoginScopes :keyword validation: The configuration settings of the Azure Active Directory token validation flow. - :paramtype validation: ~container_apps_api_client.models.AllowedAudiencesValidation + :paramtype validation: ~azure.mgmt.app.models.AllowedAudiencesValidation """ super(Google, self).__init__(**kwargs) self.enabled = enabled @@ -2854,7 +3779,7 @@ class HttpScaleRule(msrest.serialization.Model): :ivar metadata: Metadata properties to describe http scale rule. :vartype metadata: dict[str, str] :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~container_apps_api_client.models.ScaleRuleAuth] + :vartype auth: list[~azure.mgmt.app.models.ScaleRuleAuth] """ _attribute_map = { @@ -2866,14 +3791,14 @@ def __init__( self, *, metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["ScaleRuleAuth"]] = None, + auth: Optional[List["_models.ScaleRuleAuth"]] = None, **kwargs ): """ :keyword metadata: Metadata properties to describe http scale rule. :paramtype metadata: dict[str, str] :keyword auth: Authentication secrets for the custom scale rule. - :paramtype auth: list[~container_apps_api_client.models.ScaleRuleAuth] + :paramtype auth: list[~azure.mgmt.app.models.ScaleRuleAuth] """ super(HttpScaleRule, self).__init__(**kwargs) self.metadata = metadata @@ -2887,9 +3812,9 @@ class HttpSettings(msrest.serialization.Model): not having the HTTPS scheme are permissible; otherwise, :code:`true`. :vartype require_https: bool :ivar routes: The configuration settings of the paths HTTP requests. - :vartype routes: ~container_apps_api_client.models.HttpSettingsRoutes + :vartype routes: ~azure.mgmt.app.models.HttpSettingsRoutes :ivar forward_proxy: The configuration settings of a forward proxy used to make the requests. - :vartype forward_proxy: ~container_apps_api_client.models.ForwardProxy + :vartype forward_proxy: ~azure.mgmt.app.models.ForwardProxy """ _attribute_map = { @@ -2902,8 +3827,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 ): """ @@ -2911,10 +3836,10 @@ def __init__( responses not having the HTTPS scheme are permissible; otherwise, :code:`true`. :paramtype require_https: bool :keyword routes: The configuration settings of the paths HTTP requests. - :paramtype routes: ~container_apps_api_client.models.HttpSettingsRoutes + :paramtype routes: ~azure.mgmt.app.models.HttpSettingsRoutes :keyword forward_proxy: The configuration settings of a forward proxy used to make the requests. - :paramtype forward_proxy: ~container_apps_api_client.models.ForwardProxy + :paramtype forward_proxy: ~azure.mgmt.app.models.ForwardProxy """ super(HttpSettings, self).__init__(**kwargs) self.require_https = require_https @@ -2952,24 +3877,24 @@ class IdentityProviders(msrest.serialization.Model): :ivar azure_active_directory: The configuration settings of the Azure Active directory provider. - :vartype azure_active_directory: ~container_apps_api_client.models.AzureActiveDirectory + :vartype azure_active_directory: ~azure.mgmt.app.models.AzureActiveDirectory :ivar facebook: The configuration settings of the Facebook provider. - :vartype facebook: ~container_apps_api_client.models.Facebook + :vartype facebook: ~azure.mgmt.app.models.Facebook :ivar git_hub: The configuration settings of the GitHub provider. - :vartype git_hub: ~container_apps_api_client.models.GitHub + :vartype git_hub: ~azure.mgmt.app.models.GitHub :ivar google: The configuration settings of the Google provider. - :vartype google: ~container_apps_api_client.models.Google + :vartype google: ~azure.mgmt.app.models.Google :ivar twitter: The configuration settings of the Twitter provider. - :vartype twitter: ~container_apps_api_client.models.Twitter + :vartype twitter: ~azure.mgmt.app.models.Twitter :ivar apple: The configuration settings of the Apple provider. - :vartype apple: ~container_apps_api_client.models.Apple + :vartype apple: ~azure.mgmt.app.models.Apple :ivar azure_static_web_apps: The configuration settings of the Azure Static Web Apps provider. - :vartype azure_static_web_apps: ~container_apps_api_client.models.AzureStaticWebApps + :vartype azure_static_web_apps: ~azure.mgmt.app.models.AzureStaticWebApps :ivar custom_open_id_connect_providers: The map of the name of the alias of each custom Open ID Connect provider to the configuration settings of the custom Open ID Connect provider. :vartype custom_open_id_connect_providers: dict[str, - ~container_apps_api_client.models.CustomOpenIdConnectProvider] + ~azure.mgmt.app.models.CustomOpenIdConnectProvider] """ _attribute_map = { @@ -2986,38 +3911,38 @@ 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 ): """ :keyword azure_active_directory: The configuration settings of the Azure Active directory provider. - :paramtype azure_active_directory: ~container_apps_api_client.models.AzureActiveDirectory + :paramtype azure_active_directory: ~azure.mgmt.app.models.AzureActiveDirectory :keyword facebook: The configuration settings of the Facebook provider. - :paramtype facebook: ~container_apps_api_client.models.Facebook + :paramtype facebook: ~azure.mgmt.app.models.Facebook :keyword git_hub: The configuration settings of the GitHub provider. - :paramtype git_hub: ~container_apps_api_client.models.GitHub + :paramtype git_hub: ~azure.mgmt.app.models.GitHub :keyword google: The configuration settings of the Google provider. - :paramtype google: ~container_apps_api_client.models.Google + :paramtype google: ~azure.mgmt.app.models.Google :keyword twitter: The configuration settings of the Twitter provider. - :paramtype twitter: ~container_apps_api_client.models.Twitter + :paramtype twitter: ~azure.mgmt.app.models.Twitter :keyword apple: The configuration settings of the Apple provider. - :paramtype apple: ~container_apps_api_client.models.Apple + :paramtype apple: ~azure.mgmt.app.models.Apple :keyword azure_static_web_apps: The configuration settings of the Azure Static Web Apps provider. - :paramtype azure_static_web_apps: ~container_apps_api_client.models.AzureStaticWebApps + :paramtype azure_static_web_apps: ~azure.mgmt.app.models.AzureStaticWebApps :keyword custom_open_id_connect_providers: The map of the name of the alias of each custom Open ID Connect provider to the configuration settings of the custom Open ID Connect provider. :paramtype custom_open_id_connect_providers: dict[str, - ~container_apps_api_client.models.CustomOpenIdConnectProvider] + ~azure.mgmt.app.models.CustomOpenIdConnectProvider] """ super(IdentityProviders, self).__init__(**kwargs) self.azure_active_directory = azure_active_directory @@ -3041,12 +3966,12 @@ 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". - :vartype transport: str or ~container_apps_api_client.models.IngressTransportMethod + :ivar transport: Ingress transport protocol. Known values are: "auto", "http", "http2". + :vartype transport: str or ~azure.mgmt.app.models.IngressTransportMethod :ivar traffic: Traffic weights for app's revisions. - :vartype traffic: list[~container_apps_api_client.models.TrafficWeight] + :vartype traffic: list[~azure.mgmt.app.models.TrafficWeight] :ivar custom_domains: custom domain bindings for Container Apps' hostnames. - :vartype custom_domains: list[~container_apps_api_client.models.CustomDomain] + :vartype custom_domains: list[~azure.mgmt.app.models.CustomDomain] :ivar allow_insecure: Bool indicating if HTTP connections to is allowed. If set to false HTTP connections are automatically redirected to HTTPS connections. :vartype allow_insecure: bool @@ -3071,9 +3996,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 ): @@ -3082,13 +4007,12 @@ 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". - :paramtype transport: str or ~container_apps_api_client.models.IngressTransportMethod + :keyword transport: Ingress transport protocol. Known values are: "auto", "http", "http2". + :paramtype transport: str or ~azure.mgmt.app.models.IngressTransportMethod :keyword traffic: Traffic weights for app's revisions. - :paramtype traffic: list[~container_apps_api_client.models.TrafficWeight] + :paramtype traffic: list[~azure.mgmt.app.models.TrafficWeight] :keyword custom_domains: custom domain bindings for Container Apps' hostnames. - :paramtype custom_domains: list[~container_apps_api_client.models.CustomDomain] + :paramtype custom_domains: list[~azure.mgmt.app.models.CustomDomain] :keyword allow_insecure: Bool indicating if HTTP connections to is allowed. If set to false HTTP connections are automatically redirected to HTTPS connections. :paramtype allow_insecure: bool @@ -3171,7 +4095,7 @@ class Login(msrest.serialization.Model): """The configuration settings of the login flow of users using ContainerApp Service Authentication/Authorization. :ivar routes: The routes that specify the endpoints used for login and logout requests. - :vartype routes: ~container_apps_api_client.models.LoginRoutes + :vartype routes: ~azure.mgmt.app.models.LoginRoutes :ivar preserve_url_fragments_for_logins: :code:`true` if the fragments from the request are preserved after the login request is made; otherwise, :code:`false`. :vartype preserve_url_fragments_for_logins: bool @@ -3181,9 +4105,9 @@ class Login(msrest.serialization.Model): Note that URLs within the current domain are always implicitly allowed. :vartype allowed_external_redirect_urls: list[str] :ivar cookie_expiration: The configuration settings of the session cookie's expiration. - :vartype cookie_expiration: ~container_apps_api_client.models.CookieExpiration + :vartype cookie_expiration: ~azure.mgmt.app.models.CookieExpiration :ivar nonce: The configuration settings of the nonce used in the login flow. - :vartype nonce: ~container_apps_api_client.models.Nonce + :vartype nonce: ~azure.mgmt.app.models.Nonce """ _attribute_map = { @@ -3197,16 +4121,16 @@ 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 ): """ :keyword routes: The routes that specify the endpoints used for login and logout requests. - :paramtype routes: ~container_apps_api_client.models.LoginRoutes + :paramtype routes: ~azure.mgmt.app.models.LoginRoutes :keyword preserve_url_fragments_for_logins: :code:`true` if the fragments from the request are preserved after the login request is made; otherwise, :code:`false`. :paramtype preserve_url_fragments_for_logins: bool @@ -3216,9 +4140,9 @@ def __init__( Note that URLs within the current domain are always implicitly allowed. :paramtype allowed_external_redirect_urls: list[str] :keyword cookie_expiration: The configuration settings of the session cookie's expiration. - :paramtype cookie_expiration: ~container_apps_api_client.models.CookieExpiration + :paramtype cookie_expiration: ~azure.mgmt.app.models.CookieExpiration :keyword nonce: The configuration settings of the nonce used in the login flow. - :paramtype nonce: ~container_apps_api_client.models.Nonce + :paramtype nonce: ~azure.mgmt.app.models.Nonce """ super(Login, self).__init__(**kwargs) self.routes = routes @@ -3295,22 +4219,23 @@ class ManagedEnvironment(TrackedResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~container_apps_api_client.models.SystemData + :vartype system_data: ~azure.mgmt.app.models.SystemData :ivar tags: A set of tags. Resource tags. :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". - :vartype provisioning_state: str or - ~container_apps_api_client.models.EnvironmentProvisioningState + :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.app.models.EnvironmentProvisioningState :ivar dapr_ai_instrumentation_key: Azure Monitor instrumentation key used by Dapr to export Service to Service communication telemetry. :vartype dapr_ai_instrumentation_key: str + :ivar dapr_ai_connection_string: Application Insights connection string used by Dapr to export + Service to Service communication telemetry. + :vartype dapr_ai_connection_string: str :ivar vnet_configuration: Vnet configuration for the environment. - :vartype vnet_configuration: ~container_apps_api_client.models.VnetConfiguration + :vartype vnet_configuration: ~azure.mgmt.app.models.VnetConfiguration :ivar deployment_errors: Any errors that occurred during deployment or deployment validation. :vartype deployment_errors: str :ivar default_domain: Default Domain Name for the cluster. @@ -3320,7 +4245,9 @@ class ManagedEnvironment(TrackedResource): :ivar app_logs_configuration: Cluster configuration which enables the log daemon to export app logs to a destination. Currently only "log-analytics" is supported. - :vartype app_logs_configuration: ~container_apps_api_client.models.AppLogsConfiguration + :vartype app_logs_configuration: ~azure.mgmt.app.models.AppLogsConfiguration + :ivar zone_redundant: Whether or not this Managed Environment is zone-redundant. + :vartype zone_redundant: bool """ _validation = { @@ -3344,11 +4271,13 @@ class ManagedEnvironment(TrackedResource): 'location': {'key': 'location', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'dapr_ai_instrumentation_key': {'key': 'properties.daprAIInstrumentationKey', 'type': 'str'}, + 'dapr_ai_connection_string': {'key': 'properties.daprAIConnectionString', 'type': 'str'}, 'vnet_configuration': {'key': 'properties.vnetConfiguration', 'type': 'VnetConfiguration'}, 'deployment_errors': {'key': 'properties.deploymentErrors', 'type': 'str'}, 'default_domain': {'key': 'properties.defaultDomain', 'type': 'str'}, 'static_ip': {'key': 'properties.staticIp', 'type': 'str'}, 'app_logs_configuration': {'key': 'properties.appLogsConfiguration', 'type': 'AppLogsConfiguration'}, + 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, } def __init__( @@ -3357,8 +4286,10 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, dapr_ai_instrumentation_key: Optional[str] = None, - vnet_configuration: Optional["VnetConfiguration"] = None, - app_logs_configuration: Optional["AppLogsConfiguration"] = None, + dapr_ai_connection_string: Optional[str] = None, + vnet_configuration: Optional["_models.VnetConfiguration"] = None, + app_logs_configuration: Optional["_models.AppLogsConfiguration"] = None, + zone_redundant: Optional[bool] = None, **kwargs ): """ @@ -3369,46 +4300,28 @@ def __init__( :keyword dapr_ai_instrumentation_key: Azure Monitor instrumentation key used by Dapr to export Service to Service communication telemetry. :paramtype dapr_ai_instrumentation_key: str + :keyword dapr_ai_connection_string: Application Insights connection string used by Dapr to + export Service to Service communication telemetry. + :paramtype dapr_ai_connection_string: str :keyword vnet_configuration: Vnet configuration for the environment. - :paramtype vnet_configuration: ~container_apps_api_client.models.VnetConfiguration + :paramtype vnet_configuration: ~azure.mgmt.app.models.VnetConfiguration :keyword app_logs_configuration: Cluster configuration which enables the log daemon to export app logs to a destination. Currently only "log-analytics" is supported. - :paramtype app_logs_configuration: ~container_apps_api_client.models.AppLogsConfiguration + :paramtype app_logs_configuration: ~azure.mgmt.app.models.AppLogsConfiguration + :keyword zone_redundant: Whether or not this Managed Environment is zone-redundant. + :paramtype zone_redundant: bool """ super(ManagedEnvironment, self).__init__(tags=tags, location=location, **kwargs) self.provisioning_state = None self.dapr_ai_instrumentation_key = dapr_ai_instrumentation_key + self.dapr_ai_connection_string = dapr_ai_connection_string self.vnet_configuration = vnet_configuration self.deployment_errors = None self.default_domain = None self.static_ip = None self.app_logs_configuration = app_logs_configuration - - -class ManagedEnvironmentPatch(msrest.serialization.Model): - """An environment for hosting container apps. - - :ivar tags: A set of tags. Application-specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword tags: A set of tags. Application-specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super(ManagedEnvironmentPatch, self).__init__(**kwargs) - self.tags = tags + self.zone_redundant = zone_redundant class ManagedEnvironmentsCollection(msrest.serialization.Model): @@ -3419,7 +4332,7 @@ class ManagedEnvironmentsCollection(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar value: Required. Collection of resources. - :vartype value: list[~container_apps_api_client.models.ManagedEnvironment] + :vartype value: list[~azure.mgmt.app.models.ManagedEnvironment] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -3437,12 +4350,12 @@ class ManagedEnvironmentsCollection(msrest.serialization.Model): def __init__( self, *, - value: List["ManagedEnvironment"], + value: List["_models.ManagedEnvironment"], **kwargs ): """ :keyword value: Required. Collection of resources. - :paramtype value: list[~container_apps_api_client.models.ManagedEnvironment] + :paramtype value: list[~azure.mgmt.app.models.ManagedEnvironment] """ super(ManagedEnvironmentsCollection, self).__init__(**kwargs) self.value = value @@ -3464,9 +4377,9 @@ class ManagedEnvironmentStorage(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~container_apps_api_client.models.SystemData + :vartype system_data: ~azure.mgmt.app.models.SystemData :ivar properties: Storage properties. - :vartype properties: ~container_apps_api_client.models.ManagedEnvironmentStorageProperties + :vartype properties: ~azure.mgmt.app.models.ManagedEnvironmentStorageProperties """ _validation = { @@ -3487,12 +4400,12 @@ class ManagedEnvironmentStorage(ProxyResource): def __init__( self, *, - properties: Optional["ManagedEnvironmentStorageProperties"] = None, + properties: Optional["_models.ManagedEnvironmentStorageProperties"] = None, **kwargs ): """ :keyword properties: Storage properties. - :paramtype properties: ~container_apps_api_client.models.ManagedEnvironmentStorageProperties + :paramtype properties: ~azure.mgmt.app.models.ManagedEnvironmentStorageProperties """ super(ManagedEnvironmentStorage, self).__init__(**kwargs) self.properties = properties @@ -3502,7 +4415,7 @@ class ManagedEnvironmentStorageProperties(msrest.serialization.Model): """Storage properties. :ivar azure_file: Azure file properties. - :vartype azure_file: ~container_apps_api_client.models.AzureFileProperties + :vartype azure_file: ~azure.mgmt.app.models.AzureFileProperties """ _attribute_map = { @@ -3512,12 +4425,12 @@ class ManagedEnvironmentStorageProperties(msrest.serialization.Model): def __init__( self, *, - azure_file: Optional["AzureFileProperties"] = None, + azure_file: Optional["_models.AzureFileProperties"] = None, **kwargs ): """ :keyword azure_file: Azure file properties. - :paramtype azure_file: ~container_apps_api_client.models.AzureFileProperties + :paramtype azure_file: ~azure.mgmt.app.models.AzureFileProperties """ super(ManagedEnvironmentStorageProperties, self).__init__(**kwargs) self.azure_file = azure_file @@ -3529,7 +4442,7 @@ class ManagedEnvironmentStoragesCollection(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar value: Required. Collection of storage resources. - :vartype value: list[~container_apps_api_client.models.ManagedEnvironmentStorage] + :vartype value: list[~azure.mgmt.app.models.ManagedEnvironmentStorage] """ _validation = { @@ -3543,12 +4456,12 @@ class ManagedEnvironmentStoragesCollection(msrest.serialization.Model): def __init__( self, *, - value: List["ManagedEnvironmentStorage"], + value: List["_models.ManagedEnvironmentStorage"], **kwargs ): """ :keyword value: Required. Collection of storage resources. - :paramtype value: list[~container_apps_api_client.models.ManagedEnvironmentStorage] + :paramtype value: list[~azure.mgmt.app.models.ManagedEnvironmentStorage] """ super(ManagedEnvironmentStoragesCollection, self).__init__(**kwargs) self.value = value @@ -3568,15 +4481,14 @@ 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". - :vartype type: str or ~container_apps_api_client.models.ManagedServiceIdentityType + UserAssigned types are allowed). Known values are: "None", "SystemAssigned", "UserAssigned", + "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.app.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: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, - ~container_apps_api_client.models.UserAssignedIdentity] + :vartype user_assigned_identities: dict[str, ~azure.mgmt.app.models.UserAssignedIdentity] """ _validation = { @@ -3595,21 +4507,20 @@ 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". - :paramtype type: str or ~container_apps_api_client.models.ManagedServiceIdentityType + UserAssigned types are allowed). Known values are: "None", "SystemAssigned", "UserAssigned", + "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.app.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: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, - ~container_apps_api_client.models.UserAssignedIdentity] + :paramtype user_assigned_identities: dict[str, ~azure.mgmt.app.models.UserAssignedIdentity] """ super(ManagedServiceIdentity, self).__init__(**kwargs) self.principal_id = None @@ -3784,10 +4695,10 @@ class OpenIdConnectRegistration(msrest.serialization.Model): :ivar client_id: The client id of the custom Open ID Connect provider. :vartype client_id: str :ivar client_credential: The authentication credentials of the custom Open ID Connect provider. - :vartype client_credential: ~container_apps_api_client.models.OpenIdConnectClientCredential + :vartype client_credential: ~azure.mgmt.app.models.OpenIdConnectClientCredential :ivar open_id_connect_configuration: The configuration settings of the endpoints used for the custom Open ID Connect provider. - :vartype open_id_connect_configuration: ~container_apps_api_client.models.OpenIdConnectConfig + :vartype open_id_connect_configuration: ~azure.mgmt.app.models.OpenIdConnectConfig """ _attribute_map = { @@ -3800,8 +4711,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 ): """ @@ -3809,10 +4720,10 @@ def __init__( :paramtype client_id: str :keyword client_credential: The authentication credentials of the custom Open ID Connect provider. - :paramtype client_credential: ~container_apps_api_client.models.OpenIdConnectClientCredential + :paramtype client_credential: ~azure.mgmt.app.models.OpenIdConnectClientCredential :keyword open_id_connect_configuration: The configuration settings of the endpoints used for the custom Open ID Connect provider. - :paramtype open_id_connect_configuration: ~container_apps_api_client.models.OpenIdConnectConfig + :paramtype open_id_connect_configuration: ~azure.mgmt.app.models.OpenIdConnectConfig """ super(OpenIdConnectRegistration, self).__init__(**kwargs) self.client_id = client_id @@ -3828,7 +4739,7 @@ class OperationDetail(msrest.serialization.Model): :ivar is_data_action: Indicates whether the operation is a data action. :vartype is_data_action: bool :ivar display: Display of the operation. - :vartype display: ~container_apps_api_client.models.OperationDisplay + :vartype display: ~azure.mgmt.app.models.OperationDisplay :ivar origin: Origin of the operation. :vartype origin: str """ @@ -3845,7 +4756,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 ): @@ -3855,7 +4766,7 @@ def __init__( :keyword is_data_action: Indicates whether the operation is a data action. :paramtype is_data_action: bool :keyword display: Display of the operation. - :paramtype display: ~container_apps_api_client.models.OperationDisplay + :paramtype display: ~azure.mgmt.app.models.OperationDisplay :keyword origin: Origin of the operation. :paramtype origin: str """ @@ -3920,7 +4831,7 @@ class QueueScaleRule(msrest.serialization.Model): :ivar queue_length: Queue length. :vartype queue_length: int :ivar auth: Authentication secrets for the queue scale rule. - :vartype auth: list[~container_apps_api_client.models.ScaleRuleAuth] + :vartype auth: list[~azure.mgmt.app.models.ScaleRuleAuth] """ _attribute_map = { @@ -3934,7 +4845,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 ): """ @@ -3943,7 +4854,7 @@ def __init__( :keyword queue_length: Queue length. :paramtype queue_length: int :keyword auth: Authentication secrets for the queue scale rule. - :paramtype auth: list[~container_apps_api_client.models.ScaleRuleAuth] + :paramtype auth: list[~azure.mgmt.app.models.ScaleRuleAuth] """ super(QueueScaleRule, self).__init__(**kwargs) self.queue_name = queue_name @@ -3960,12 +4871,17 @@ class RegistryCredentials(msrest.serialization.Model): :vartype username: str :ivar password_secret_ref: The name of the Secret that contains the registry login password. :vartype password_secret_ref: str + :ivar identity: A Managed Identity to use to authenticate with Azure Container Registry. For + user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned + identities, use 'system'. + :vartype identity: str """ _attribute_map = { 'server': {'key': 'server', 'type': 'str'}, 'username': {'key': 'username', 'type': 'str'}, 'password_secret_ref': {'key': 'passwordSecretRef', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'str'}, } def __init__( @@ -3974,6 +4890,7 @@ def __init__( server: Optional[str] = None, username: Optional[str] = None, password_secret_ref: Optional[str] = None, + identity: Optional[str] = None, **kwargs ): """ @@ -3983,11 +4900,16 @@ def __init__( :paramtype username: str :keyword password_secret_ref: The name of the Secret that contains the registry login password. :paramtype password_secret_ref: str + :keyword identity: A Managed Identity to use to authenticate with Azure Container Registry. For + user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned + identities, use 'system'. + :paramtype identity: str """ super(RegistryCredentials, self).__init__(**kwargs) self.server = server self.username = username self.password_secret_ref = password_secret_ref + self.identity = identity class RegistryInfo(msrest.serialization.Model): @@ -4044,11 +4966,11 @@ class Replica(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~container_apps_api_client.models.SystemData + :vartype system_data: ~azure.mgmt.app.models.SystemData :ivar created_time: Timestamp describing when the pod was created by controller. :vartype created_time: ~datetime.datetime :ivar containers: The containers collection under a replica. - :vartype containers: list[~container_apps_api_client.models.ReplicaContainer] + :vartype containers: list[~azure.mgmt.app.models.ReplicaContainer] """ _validation = { @@ -4071,12 +4993,12 @@ class Replica(ProxyResource): def __init__( self, *, - containers: Optional[List["ReplicaContainer"]] = None, + containers: Optional[List["_models.ReplicaContainer"]] = None, **kwargs ): """ :keyword containers: The containers collection under a replica. - :paramtype containers: list[~container_apps_api_client.models.ReplicaContainer] + :paramtype containers: list[~azure.mgmt.app.models.ReplicaContainer] """ super(Replica, self).__init__(**kwargs) self.created_time = None @@ -4089,7 +5011,7 @@ class ReplicaCollection(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar value: Required. Collection of resources. - :vartype value: list[~container_apps_api_client.models.Replica] + :vartype value: list[~azure.mgmt.app.models.Replica] """ _validation = { @@ -4103,12 +5025,12 @@ class ReplicaCollection(msrest.serialization.Model): def __init__( self, *, - value: List["Replica"], + value: List["_models.Replica"], **kwargs ): """ :keyword value: Required. Collection of resources. - :paramtype value: list[~container_apps_api_client.models.Replica] + :paramtype value: list[~azure.mgmt.app.models.Replica] """ super(ReplicaCollection, self).__init__(**kwargs) self.value = value @@ -4182,7 +5104,7 @@ class Revision(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~container_apps_api_client.models.SystemData + :vartype system_data: ~azure.mgmt.app.models.SystemData :ivar created_time: Timestamp describing when the revision was created by controller. :vartype created_time: ~datetime.datetime @@ -4191,21 +5113,23 @@ class Revision(ProxyResource): :ivar template: Container App Revision Template with all possible settings and the defaults if user did not provide them. The defaults are populated as they were at the creation time. - :vartype template: ~container_apps_api_client.models.Template + :vartype template: ~azure.mgmt.app.models.Template :ivar active: Boolean describing if the Revision is Active. :vartype active: bool :ivar replicas: Number of pods currently running for this revision. :vartype replicas: int :ivar traffic_weight: Traffic weight assigned to this revision. :vartype traffic_weight: int + :ivar traffic_labels: Traffic labels associated with this revision. + :vartype traffic_labels: list[~azure.mgmt.app.models.TrafficLabel] :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 ~container_apps_api_client.models.RevisionHealthState - :ivar provisioning_state: Current provisioning State of the revision. Possible values include: + :vartype health_state: str or ~azure.mgmt.app.models.RevisionHealthState + :ivar provisioning_state: Current provisioning State of the revision. Known values are: "Provisioning", "Provisioned", "Failed", "Deprovisioning", "Deprovisioned". - :vartype provisioning_state: str or ~container_apps_api_client.models.RevisionProvisioningState + :vartype provisioning_state: str or ~azure.mgmt.app.models.RevisionProvisioningState """ _validation = { @@ -4219,6 +5143,7 @@ class Revision(ProxyResource): 'active': {'readonly': True}, 'replicas': {'readonly': True}, 'traffic_weight': {'readonly': True}, + 'traffic_labels': {'readonly': True}, 'provisioning_error': {'readonly': True}, 'health_state': {'readonly': True}, 'provisioning_state': {'readonly': True}, @@ -4235,6 +5160,7 @@ class Revision(ProxyResource): 'active': {'key': 'properties.active', 'type': 'bool'}, 'replicas': {'key': 'properties.replicas', 'type': 'int'}, 'traffic_weight': {'key': 'properties.trafficWeight', 'type': 'int'}, + 'traffic_labels': {'key': 'properties.trafficLabels', 'type': '[TrafficLabel]'}, 'provisioning_error': {'key': 'properties.provisioningError', 'type': 'str'}, 'health_state': {'key': 'properties.healthState', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -4253,6 +5179,7 @@ def __init__( self.active = None self.replicas = None self.traffic_weight = None + self.traffic_labels = None self.provisioning_error = None self.health_state = None self.provisioning_state = None @@ -4266,7 +5193,7 @@ class RevisionCollection(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar value: Required. Collection of resources. - :vartype value: list[~container_apps_api_client.models.Revision] + :vartype value: list[~azure.mgmt.app.models.Revision] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -4284,12 +5211,12 @@ class RevisionCollection(msrest.serialization.Model): def __init__( self, *, - value: List["Revision"], + value: List["_models.Revision"], **kwargs ): """ :keyword value: Required. Collection of resources. - :paramtype value: list[~container_apps_api_client.models.Revision] + :paramtype value: list[~azure.mgmt.app.models.Revision] """ super(RevisionCollection, self).__init__(**kwargs) self.value = value @@ -4304,7 +5231,7 @@ class Scale(msrest.serialization.Model): :ivar max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not set. :vartype max_replicas: int :ivar rules: Scaling rules. - :vartype rules: list[~container_apps_api_client.models.ScaleRule] + :vartype rules: list[~azure.mgmt.app.models.ScaleRule] """ _attribute_map = { @@ -4318,7 +5245,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 ): """ @@ -4328,7 +5255,7 @@ def __init__( set. :paramtype max_replicas: int :keyword rules: Scaling rules. - :paramtype rules: list[~container_apps_api_client.models.ScaleRule] + :paramtype rules: list[~azure.mgmt.app.models.ScaleRule] """ super(Scale, self).__init__(**kwargs) self.min_replicas = min_replicas @@ -4342,11 +5269,11 @@ class ScaleRule(msrest.serialization.Model): :ivar name: Scale Rule Name. :vartype name: str :ivar azure_queue: Azure Queue based scaling. - :vartype azure_queue: ~container_apps_api_client.models.QueueScaleRule + :vartype azure_queue: ~azure.mgmt.app.models.QueueScaleRule :ivar custom: Custom scale rule. - :vartype custom: ~container_apps_api_client.models.CustomScaleRule + :vartype custom: ~azure.mgmt.app.models.CustomScaleRule :ivar http: HTTP requests based scaling. - :vartype http: ~container_apps_api_client.models.HttpScaleRule + :vartype http: ~azure.mgmt.app.models.HttpScaleRule """ _attribute_map = { @@ -4360,20 +5287,20 @@ 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 ): """ :keyword name: Scale Rule Name. :paramtype name: str :keyword azure_queue: Azure Queue based scaling. - :paramtype azure_queue: ~container_apps_api_client.models.QueueScaleRule + :paramtype azure_queue: ~azure.mgmt.app.models.QueueScaleRule :keyword custom: Custom scale rule. - :paramtype custom: ~container_apps_api_client.models.CustomScaleRule + :paramtype custom: ~azure.mgmt.app.models.CustomScaleRule :keyword http: HTTP requests based scaling. - :paramtype http: ~container_apps_api_client.models.HttpScaleRule + :paramtype http: ~azure.mgmt.app.models.HttpScaleRule """ super(ScaleRule, self).__init__(**kwargs) self.name = name @@ -4452,7 +5379,7 @@ class SecretsCollection(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar value: Required. Collection of resources. - :vartype value: list[~container_apps_api_client.models.ContainerAppSecret] + :vartype value: list[~azure.mgmt.app.models.ContainerAppSecret] """ _validation = { @@ -4466,12 +5393,12 @@ class SecretsCollection(msrest.serialization.Model): def __init__( self, *, - value: List["ContainerAppSecret"], + value: List["_models.ContainerAppSecret"], **kwargs ): """ :keyword value: Required. Collection of resources. - :paramtype value: list[~container_apps_api_client.models.ContainerAppSecret] + :paramtype value: list[~azure.mgmt.app.models.ContainerAppSecret] """ super(SecretsCollection, self).__init__(**kwargs) self.value = value @@ -4492,10 +5419,10 @@ class SourceControl(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~container_apps_api_client.models.SystemData - :ivar operation_state: Current provisioning State of the operation. Possible values include: + :vartype system_data: ~azure.mgmt.app.models.SystemData + :ivar operation_state: Current provisioning State of the operation. Known values are: "InProgress", "Succeeded", "Failed", "Canceled". - :vartype operation_state: str or ~container_apps_api_client.models.SourceControlOperationState + :vartype operation_state: str or ~azure.mgmt.app.models.SourceControlOperationState :ivar repo_url: The repo url which will be integrated to ContainerApp. :vartype repo_url: str :ivar branch: The branch which will trigger the auto deployment. @@ -4504,8 +5431,7 @@ class SourceControl(ProxyResource): and the defaults if user did not provide them. The defaults are populated as they were at the creation time. - :vartype github_action_configuration: - ~container_apps_api_client.models.GithubActionConfiguration + :vartype github_action_configuration: ~azure.mgmt.app.models.GithubActionConfiguration """ _validation = { @@ -4532,7 +5458,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 ): """ @@ -4544,8 +5470,7 @@ def __init__( settings and the defaults if user did not provide them. The defaults are populated as they were at the creation time. - :paramtype github_action_configuration: - ~container_apps_api_client.models.GithubActionConfiguration + :paramtype github_action_configuration: ~azure.mgmt.app.models.GithubActionConfiguration """ super(SourceControl, self).__init__(**kwargs) self.operation_state = None @@ -4562,7 +5487,7 @@ class SourceControlCollection(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar value: Required. Collection of resources. - :vartype value: list[~container_apps_api_client.models.SourceControl] + :vartype value: list[~azure.mgmt.app.models.SourceControl] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -4580,12 +5505,12 @@ class SourceControlCollection(msrest.serialization.Model): def __init__( self, *, - value: List["SourceControl"], + value: List["_models.SourceControl"], **kwargs ): """ :keyword value: Required. Collection of resources. - :paramtype value: list[~container_apps_api_client.models.SourceControl] + :paramtype value: list[~azure.mgmt.app.models.SourceControl] """ super(SourceControlCollection, self).__init__(**kwargs) self.value = value @@ -4597,16 +5522,16 @@ 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 ~container_apps_api_client.models.CreatedByType + :vartype created_by_type: str or ~azure.mgmt.app.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". - :vartype last_modified_by_type: str or ~container_apps_api_client.models.CreatedByType + :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.app.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). :vartype last_modified_at: ~datetime.datetime """ @@ -4624,26 +5549,26 @@ 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". - :paramtype created_by_type: str or ~container_apps_api_client.models.CreatedByType + :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.app.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". - :paramtype last_modified_by_type: str or ~container_apps_api_client.models.CreatedByType + :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.app.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime """ @@ -4664,11 +5589,11 @@ class Template(msrest.serialization.Model): :ivar revision_suffix: User friendly suffix that is appended to the revision name. :vartype revision_suffix: str :ivar containers: List of container definitions for the Container App. - :vartype containers: list[~container_apps_api_client.models.Container] + :vartype containers: list[~azure.mgmt.app.models.Container] :ivar scale: Scaling properties for the Container App. - :vartype scale: ~container_apps_api_client.models.Scale + :vartype scale: ~azure.mgmt.app.models.Scale :ivar volumes: List of volume definitions for the Container App. - :vartype volumes: list[~container_apps_api_client.models.Volume] + :vartype volumes: list[~azure.mgmt.app.models.Volume] """ _attribute_map = { @@ -4682,20 +5607,20 @@ 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 ): """ :keyword revision_suffix: User friendly suffix that is appended to the revision name. :paramtype revision_suffix: str :keyword containers: List of container definitions for the Container App. - :paramtype containers: list[~container_apps_api_client.models.Container] + :paramtype containers: list[~azure.mgmt.app.models.Container] :keyword scale: Scaling properties for the Container App. - :paramtype scale: ~container_apps_api_client.models.Scale + :paramtype scale: ~azure.mgmt.app.models.Scale :keyword volumes: List of volume definitions for the Container App. - :paramtype volumes: list[~container_apps_api_client.models.Volume] + :paramtype volumes: list[~azure.mgmt.app.models.Volume] """ super(Template, self).__init__(**kwargs) self.revision_suffix = revision_suffix @@ -4704,6 +5629,38 @@ def __init__( self.volumes = volumes +class TrafficLabel(msrest.serialization.Model): + """Traffic label information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar label: Traffic label assigned to a revision. + :vartype label: str + :ivar fqdn: Fully qualified domain name of a labelled revision. + :vartype fqdn: str + """ + + _validation = { + 'label': {'readonly': True}, + 'fqdn': {'readonly': True}, + } + + _attribute_map = { + 'label': {'key': 'label', 'type': 'str'}, + 'fqdn': {'key': 'fqdn', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(TrafficLabel, self).__init__(**kwargs) + self.label = None + self.fqdn = None + + class TrafficWeight(msrest.serialization.Model): """Traffic weight assigned to a revision. @@ -4713,12 +5670,15 @@ class TrafficWeight(msrest.serialization.Model): :vartype weight: int :ivar latest_revision: Indicates that the traffic weight belongs to a latest stable revision. :vartype latest_revision: bool + :ivar label: Associates a traffic label with a revision. + :vartype label: str """ _attribute_map = { 'revision_name': {'key': 'revisionName', 'type': 'str'}, 'weight': {'key': 'weight', 'type': 'int'}, 'latest_revision': {'key': 'latestRevision', 'type': 'bool'}, + 'label': {'key': 'label', 'type': 'str'}, } def __init__( @@ -4727,6 +5687,7 @@ def __init__( revision_name: Optional[str] = None, weight: Optional[int] = None, latest_revision: Optional[bool] = False, + label: Optional[str] = None, **kwargs ): """ @@ -4737,11 +5698,14 @@ def __init__( :keyword latest_revision: Indicates that the traffic weight belongs to a latest stable revision. :paramtype latest_revision: bool + :keyword label: Associates a traffic label with a revision. + :paramtype label: str """ super(TrafficWeight, self).__init__(**kwargs) self.revision_name = revision_name self.weight = weight self.latest_revision = latest_revision + self.label = label class Twitter(msrest.serialization.Model): @@ -4752,7 +5716,7 @@ class Twitter(msrest.serialization.Model): :vartype enabled: bool :ivar registration: The configuration settings of the app registration for the Twitter provider. - :vartype registration: ~container_apps_api_client.models.TwitterRegistration + :vartype registration: ~azure.mgmt.app.models.TwitterRegistration """ _attribute_map = { @@ -4764,7 +5728,7 @@ def __init__( self, *, enabled: Optional[bool] = None, - registration: Optional["TwitterRegistration"] = None, + registration: Optional["_models.TwitterRegistration"] = None, **kwargs ): """ @@ -4773,7 +5737,7 @@ def __init__( :paramtype enabled: bool :keyword registration: The configuration settings of the app registration for the Twitter provider. - :paramtype registration: ~container_apps_api_client.models.TwitterRegistration + :paramtype registration: ~azure.mgmt.app.models.TwitterRegistration """ super(Twitter, self).__init__(**kwargs) self.enabled = enabled @@ -4856,8 +5820,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 @@ -4900,8 +5864,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 @@ -4935,9 +5899,9 @@ 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". - :vartype storage_type: str or ~container_apps_api_client.models.StorageType + :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.app.models.StorageType :ivar storage_name: Name of storage resource. No need to provide for EmptyDir. :vartype storage_name: str """ @@ -4952,16 +5916,16 @@ 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". - :paramtype storage_type: str or ~container_apps_api_client.models.StorageType + :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.app.models.StorageType :keyword storage_name: Name of storage resource. No need to provide for EmptyDir. :paramtype storage_name: str """ diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/models/_patch.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/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/app/azure-mgmt-app/azure/mgmt/app/operations/__init__.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/__init__.py index 021cee48b4be..f60dd7271574 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/__init__.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/__init__.py @@ -6,26 +6,47 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._container_apps_auth_configs_operations import ContainerAppsAuthConfigsOperations from ._container_apps_operations import ContainerAppsOperations from ._container_apps_revisions_operations import ContainerAppsRevisionsOperations from ._container_apps_revision_replicas_operations import ContainerAppsRevisionReplicasOperations +from ._dapr_components_operations import DaprComponentsOperations +from ._container_apps_diagnostics_operations import ContainerAppsDiagnosticsOperations +from ._managed_environment_diagnostics_operations import ManagedEnvironmentDiagnosticsOperations +from ._managed_environments_diagnostics_operations import ManagedEnvironmentsDiagnosticsOperations +from ._operations import Operations from ._managed_environments_operations import ManagedEnvironmentsOperations from ._certificates_operations import CertificatesOperations -from ._operations import Operations -from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations -from ._dapr_components_operations import DaprComponentsOperations -from ._container_apps_auth_configs_operations import ContainerAppsAuthConfigsOperations +from ._namespaces_operations import NamespacesOperations from ._managed_environments_storages_operations import ManagedEnvironmentsStoragesOperations +from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations +from ._connected_environments_operations import ConnectedEnvironmentsOperations +from ._connected_environments_certificates_operations import ConnectedEnvironmentsCertificatesOperations +from ._connected_environments_dapr_components_operations import ConnectedEnvironmentsDaprComponentsOperations +from ._connected_environments_storages_operations import ConnectedEnvironmentsStoragesOperations +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', 'ContainerAppsRevisionsOperations', 'ContainerAppsRevisionReplicasOperations', + 'DaprComponentsOperations', + 'ContainerAppsDiagnosticsOperations', + 'ManagedEnvironmentDiagnosticsOperations', + 'ManagedEnvironmentsDiagnosticsOperations', + 'Operations', 'ManagedEnvironmentsOperations', 'CertificatesOperations', - 'Operations', - 'ContainerAppsSourceControlsOperations', - 'DaprComponentsOperations', - 'ContainerAppsAuthConfigsOperations', + 'NamespacesOperations', 'ManagedEnvironmentsStoragesOperations', + 'ContainerAppsSourceControlsOperations', + 'ConnectedEnvironmentsOperations', + 'ConnectedEnvironmentsCertificatesOperations', + 'ConnectedEnvironmentsDaprComponentsOperations', + 'ConnectedEnvironmentsStoragesOperations', ] +__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/app/azure-mgmt-app/azure/mgmt/app/operations/_certificates_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_certificates_operations.py index a0d95b39d63c..d588d3a7f6e1 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_certificates_operations.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_certificates_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +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 msrest import Serializer 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() @@ -30,34 +30,36 @@ def build_list_request( subscription_id: str, resource_group_name: str, - managed_environment_name: str, + environment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "managedEnvironmentName": _SERIALIZER.url("managed_environment_name", managed_environment_name, 'str'), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -65,36 +67,38 @@ def build_list_request( def build_get_request( subscription_id: str, resource_group_name: str, - managed_environment_name: str, - name: str, + environment_name: str, + certificate_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "managedEnvironmentName": _SERIALIZER.url("managed_environment_name", managed_environment_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -102,43 +106,44 @@ def build_get_request( def build_create_or_update_request( subscription_id: str, resource_group_name: str, - managed_environment_name: str, - name: str, + environment_name: str, + certificate_name: str, *, - json: JSONType = None, + json: Optional[_models.Certificate] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - 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-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "managedEnvironmentName": _SERIALIZER.url("managed_environment_name", managed_environment_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -148,36 +153,38 @@ def build_create_or_update_request( def build_delete_request( subscription_id: str, resource_group_name: str, - managed_environment_name: str, - name: str, + environment_name: str, + certificate_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "managedEnvironmentName": _SERIALIZER.url("managed_environment_name", managed_environment_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -185,118 +192,128 @@ def build_delete_request( def build_update_request( subscription_id: str, resource_group_name: str, - managed_environment_name: str, - name: str, + environment_name: str, + certificate_name: str, *, - json: JSONType = None, + json: Optional[_models.CertificatePatch] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - 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-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "managedEnvironmentName": _SERIALIZER.url("managed_environment_name", managed_environment_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + 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: ~container_apps_api_client.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.app.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( self, resource_group_name: str, - managed_environment_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. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param managed_environment_name: Name of the Managed Environment. - :type managed_environment_name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CertificateCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~container_apps_api_client.models.CertificateCollection] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.app.models.CertificateCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateCollection"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + 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: request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - managed_environment_name=managed_environment_name, + 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: request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - managed_environment_name=managed_environment_name, + 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 @@ -310,7 +327,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -324,49 +345,61 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates"} # type: ignore @distributed_trace def get( self, resource_group_name: str, - managed_environment_name: str, - name: str, + environment_name: str, + certificate_name: str, **kwargs: Any - ) -> "_models.Certificate": + ) -> _models.Certificate: """Get the specified Certificate. Get the specified Certificate. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param managed_environment_name: Name of the Managed Environment. - :type managed_environment_name: str - :param name: Name of the Certificate. - :type name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :param certificate_name: Name of the Certificate. + :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate, or the result of cls(response) - :rtype: ~container_apps_api_client.models.Certificate + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Certificate] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - managed_environment_name=managed_environment_name, - name=name, + environment_name=environment_name, + 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(request, stream=False, **kwargs) + 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]: @@ -381,42 +414,46 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}"} # type: ignore @distributed_trace def create_or_update( self, resource_group_name: str, - managed_environment_name: str, - name: str, - certificate_envelope: Optional["_models.Certificate"] = None, + environment_name: str, + certificate_name: str, + certificate_envelope: Optional[_models.Certificate] = None, **kwargs: Any - ) -> "_models.Certificate": + ) -> _models.Certificate: """Create or Update a Certificate. Create or Update a Certificate. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param managed_environment_name: Name of the Managed Environment. - :type managed_environment_name: str - :param name: Name of the Certificate. - :type name: str - :param certificate_envelope: Certificate to be created or updated. - :type certificate_envelope: ~container_apps_api_client.models.Certificate + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :param certificate_name: Name of the Certificate. + :type certificate_name: str + :param certificate_envelope: Certificate to be created or updated. Default value is None. + :type certificate_envelope: ~azure.mgmt.app.models.Certificate :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate, or the result of cls(response) - :rtype: ~container_apps_api_client.models.Certificate + :rtype: ~azure.mgmt.app.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 {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # 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') @@ -426,16 +463,23 @@ def create_or_update( request = build_create_or_update_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - managed_environment_name=managed_environment_name, - name=name, + environment_name=environment_name, + certificate_name=certificate_name, + api_version=api_version, 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(request, stream=False, **kwargs) + 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]: @@ -450,15 +494,15 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, - managed_environment_name: str, - name: str, + environment_name: str, + certificate_name: str, **kwargs: Any ) -> None: """Deletes the specified Certificate. @@ -467,33 +511,45 @@ def delete( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param managed_environment_name: Name of the Managed Environment. - :type managed_environment_name: str - :param name: Name of the Certificate. - :type name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :param certificate_name: Name of the Certificate. + :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - managed_environment_name=managed_environment_name, - name=name, + environment_name=environment_name, + 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(request, stream=False, **kwargs) + 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, 204]: @@ -504,58 +560,69 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}"} # type: ignore @distributed_trace def update( self, resource_group_name: str, - managed_environment_name: str, - name: str, - certificate_envelope: "_models.CertificatePatch", + environment_name: str, + certificate_name: str, + 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. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param managed_environment_name: Name of the Managed Environment. - :type managed_environment_name: str - :param name: Name of the Certificate. - :type name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :param certificate_name: Name of the Certificate. + :type certificate_name: str :param certificate_envelope: Properties of a certificate that need to be updated. - :type certificate_envelope: ~container_apps_api_client.models.CertificatePatch + :type certificate_envelope: ~azure.mgmt.app.models.CertificatePatch :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate, or the result of cls(response) - :rtype: ~container_apps_api_client.models.Certificate + :rtype: ~azure.mgmt.app.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 {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # 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') request = build_update_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - managed_environment_name=managed_environment_name, - name=name, + environment_name=environment_name, + certificate_name=certificate_name, + api_version=api_version, 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(request, stream=False, **kwargs) + 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]: @@ -570,5 +637,5 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}"} # type: ignore diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_connected_environments_certificates_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_connected_environments_certificates_operations.py new file mode 100644 index 000000000000..571781c05fec --- /dev/null +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_connected_environments_certificates_operations.py @@ -0,0 +1,641 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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 + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from 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') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + connected_environment_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "connectedEnvironmentName": _SERIALIZER.url("connected_environment_name", connected_environment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + connected_environment_name: str, + certificate_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "connectedEnvironmentName": _SERIALIZER.url("connected_environment_name", connected_environment_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + connected_environment_name: str, + certificate_name: str, + *, + json: Optional[_models.Certificate] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "connectedEnvironmentName": _SERIALIZER.url("connected_environment_name", connected_environment_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + connected_environment_name: str, + certificate_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "connectedEnvironmentName": _SERIALIZER.url("connected_environment_name", connected_environment_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + connected_environment_name: str, + certificate_name: str, + *, + json: Optional[_models.CertificatePatch] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "connectedEnvironmentName": _SERIALIZER.url("connected_environment_name", connected_environment_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + +class ConnectedEnvironmentsCertificatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.app.ContainerAppsAPIClient`'s + :attr:`connected_environments_certificates` attribute. + """ + + models = _models + + 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, + resource_group_name: str, + connected_environment_name: str, + **kwargs: Any + ) -> Iterable[_models.CertificateCollection]: + """Get the Certificates in a given connected environment. + + Get the Certificates in a given connected environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the Connected Environment. + :type connected_environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateCollection or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.app.models.CertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CertificateCollection] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_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) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_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) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CertificateCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + connected_environment_name: str, + certificate_name: str, + **kwargs: Any + ) -> _models.Certificate: + """Get the specified Certificate. + + Get the specified Certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the Connected Environment. + :type connected_environment_name: str + :param certificate_name: Name of the Certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Certificate] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + connected_environment_name: str, + certificate_name: str, + certificate_envelope: Optional[_models.Certificate] = None, + **kwargs: Any + ) -> _models.Certificate: + """Create or Update a Certificate. + + Create or Update a Certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the Connected Environment. + :type connected_environment_name: str + :param certificate_name: Name of the Certificate. + :type certificate_name: str + :param certificate_envelope: Certificate to be created or updated. Default value is None. + :type certificate_envelope: ~azure.mgmt.app.models.Certificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # 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') + else: + _json = None + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + certificate_name=certificate_name, + api_version=api_version, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + connected_environment_name: str, + certificate_name: str, + **kwargs: Any + ) -> None: + """Deletes the specified Certificate. + + Deletes the specified Certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the Connected Environment. + :type connected_environment_name: str + :param certificate_name: Name of the Certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + 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) # type: ignore + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name: str, + connected_environment_name: str, + certificate_name: str, + certificate_envelope: _models.CertificatePatch, + **kwargs: Any + ) -> _models.Certificate: + """Update properties of a certificate. + + Patches a certificate. Currently only patching of tags is supported. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the Connected Environment. + :type connected_environment_name: str + :param certificate_name: Name of the Certificate. + :type certificate_name: str + :param certificate_envelope: Properties of a certificate that need to be updated. + :type certificate_envelope: ~azure.mgmt.app.models.CertificatePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # 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') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + certificate_name=certificate_name, + api_version=api_version, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}"} # type: ignore + diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_connected_environments_dapr_components_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_connected_environments_dapr_components_operations.py new file mode 100644 index 000000000000..eb799696a41b --- /dev/null +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_connected_environments_dapr_components_operations.py @@ -0,0 +1,623 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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 + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from 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') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + connected_environment_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "connectedEnvironmentName": _SERIALIZER.url("connected_environment_name", connected_environment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + connected_environment_name: str, + component_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "connectedEnvironmentName": _SERIALIZER.url("connected_environment_name", connected_environment_name, 'str'), + "componentName": _SERIALIZER.url("component_name", component_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + connected_environment_name: str, + component_name: str, + *, + json: Optional[_models.DaprComponent] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "connectedEnvironmentName": _SERIALIZER.url("connected_environment_name", connected_environment_name, 'str'), + "componentName": _SERIALIZER.url("component_name", component_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + connected_environment_name: str, + component_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "connectedEnvironmentName": _SERIALIZER.url("connected_environment_name", connected_environment_name, 'str'), + "componentName": _SERIALIZER.url("component_name", component_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_secrets_request( + subscription_id: str, + resource_group_name: str, + connected_environment_name: str, + component_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}/listSecrets") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "connectedEnvironmentName": _SERIALIZER.url("connected_environment_name", connected_environment_name, 'str'), + "componentName": _SERIALIZER.url("component_name", component_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class ConnectedEnvironmentsDaprComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.app.ContainerAppsAPIClient`'s + :attr:`connected_environments_dapr_components` attribute. + """ + + models = _models + + 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, + resource_group_name: str, + connected_environment_name: str, + **kwargs: Any + ) -> Iterable[_models.DaprComponentsCollection]: + """Get the Dapr Components for a connected environment. + + Get the Dapr Components for a connected environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the connected environment. + :type connected_environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DaprComponentsCollection or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.app.models.DaprComponentsCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DaprComponentsCollection] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_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) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_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) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DaprComponentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + connected_environment_name: str, + component_name: str, + **kwargs: Any + ) -> _models.DaprComponent: + """Get a dapr component. + + Get a dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the connected environment. + :type connected_environment_name: str + :param component_name: Name of the Dapr Component. + :type component_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprComponent, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.DaprComponent + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DaprComponent] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DaprComponent', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}"} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + connected_environment_name: str, + component_name: str, + dapr_component_envelope: _models.DaprComponent, + **kwargs: Any + ) -> _models.DaprComponent: + """Creates or updates a Dapr Component. + + Creates or updates a Dapr Component in a connected environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the connected environment. + :type connected_environment_name: str + :param component_name: Name of the Dapr Component. + :type component_name: str + :param dapr_component_envelope: Configuration details of the Dapr Component. + :type dapr_component_envelope: ~azure.mgmt.app.models.DaprComponent + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprComponent, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.DaprComponent + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # 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') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + component_name=component_name, + api_version=api_version, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DaprComponent', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + connected_environment_name: str, + component_name: str, + **kwargs: Any + ) -> None: + """Delete a Dapr Component. + + Delete a Dapr Component from a connected environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the connected environment. + :type connected_environment_name: str + :param component_name: Name of the Dapr Component. + :type component_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + 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) # type: ignore + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}"} # type: ignore + + + @distributed_trace + def list_secrets( + self, + resource_group_name: str, + connected_environment_name: str, + component_name: str, + **kwargs: Any + ) -> _models.DaprSecretsCollection: + """List secrets for a dapr component. + + List secrets for a dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the connected environment. + :type connected_environment_name: str + :param component_name: Name of the Dapr Component. + :type component_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprSecretsCollection, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.DaprSecretsCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DaprSecretsCollection] + + + request = build_list_secrets_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DaprSecretsCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_secrets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}/listSecrets"} # type: ignore + diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_connected_environments_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_connected_environments_operations.py new file mode 100644 index 000000000000..8a9449f3698f --- /dev/null +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_connected_environments_operations.py @@ -0,0 +1,953 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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, cast + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.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') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/connectedEnvironments") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + connected_environment_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "connectedEnvironmentName": _SERIALIZER.url("connected_environment_name", connected_environment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + connected_environment_name: str, + *, + json: Optional[_models.ConnectedEnvironment] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "connectedEnvironmentName": _SERIALIZER.url("connected_environment_name", connected_environment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + connected_environment_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "connectedEnvironmentName": _SERIALIZER.url("connected_environment_name", connected_environment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + connected_environment_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "connectedEnvironmentName": _SERIALIZER.url("connected_environment_name", connected_environment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + resource_group_name: str, + connected_environment_name: str, + *, + json: Optional[_models.CheckNameAvailabilityRequest] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/checkNameAvailability") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "connectedEnvironmentName": _SERIALIZER.url("connected_environment_name", connected_environment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + +class ConnectedEnvironmentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.app.ContainerAppsAPIClient`'s + :attr:`connected_environments` attribute. + """ + + models = _models + + 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.ConnectedEnvironmentCollection]: + """Get all connectedEnvironments for a subscription. + + Description for Get all connectedEnvironments for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConnectedEnvironmentCollection or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.app.models.ConnectedEnvironmentCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectedEnvironmentCollection] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + 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) # type: ignore + + else: + + request = build_list_by_subscription_request( + 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) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ConnectedEnvironmentCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.App/connectedEnvironments"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable[_models.ConnectedEnvironmentCollection]: + """Get all connectedEnvironments in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConnectedEnvironmentCollection or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.app.models.ConnectedEnvironmentCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectedEnvironmentCollection] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + 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) # type: ignore + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + 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) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ConnectedEnvironmentCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + connected_environment_name: str, + **kwargs: Any + ) -> _models.ConnectedEnvironment: + """Get the properties of an connectedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the connectedEnvironment. + :type connected_environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectedEnvironment, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.ConnectedEnvironment + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectedEnvironment] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectedEnvironment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + connected_environment_name: str, + environment_envelope: _models.ConnectedEnvironment, + **kwargs: Any + ) -> _models.ConnectedEnvironment: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # 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.ConnectedEnvironment] + + _json = self._serialize.body(environment_envelope, 'ConnectedEnvironment') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + api_version=api_version, + 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) # type: ignore + + 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, 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('ConnectedEnvironment', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConnectedEnvironment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + connected_environment_name: str, + environment_envelope: _models.ConnectedEnvironment, + **kwargs: Any + ) -> LROPoller[_models.ConnectedEnvironment]: + """Creates or updates an connectedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the connectedEnvironment. + :type connected_environment_name: str + :param environment_envelope: Configuration details of the connectedEnvironment. + :type environment_envelope: ~azure.mgmt.app.models.ConnectedEnvironment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConnectedEnvironment or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.app.models.ConnectedEnvironment] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _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-06-01-preview")) # 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.ConnectedEnvironment] + 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._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + connected_environment_name=connected_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): + deserialized = self._deserialize('ConnectedEnvironment', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + 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( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + connected_environment_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_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) # type: ignore + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + connected_environment_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete an connectedEnvironment. + + Description for Delete an connectedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the connectedEnvironment. + :type connected_environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # 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( # type: ignore + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + 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( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}"} # type: ignore + + @distributed_trace + def update( + self, + resource_group_name: str, + connected_environment_name: str, + **kwargs: Any + ) -> _models.ConnectedEnvironment: + """Update connected Environment's properties. + + Patches a Managed Environment. Only patching of tags is supported currently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the connectedEnvironment. + :type connected_environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectedEnvironment, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.ConnectedEnvironment + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectedEnvironment] + + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + api_version=api_version, + template_url=self.update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectedEnvironment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}"} # type: ignore + + + @distributed_trace + def check_name_availability( + self, + resource_group_name: str, + connected_environment_name: str, + check_name_availability_request: _models.CheckNameAvailabilityRequest, + **kwargs: Any + ) -> _models.CheckNameAvailabilityResponse: + """Checks the resource connectedEnvironmentName availability. + + Checks if resource connectedEnvironmentName is available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the Managed Environment. + :type connected_environment_name: str + :param check_name_availability_request: The check connectedEnvironmentName availability + request. + :type check_name_availability_request: ~azure.mgmt.app.models.CheckNameAvailabilityRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResponse, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.CheckNameAvailabilityResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # 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') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + api_version=api_version, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/checkNameAvailability"} # type: ignore + diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_connected_environments_storages_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_connected_environments_storages_operations.py new file mode 100644 index 000000000000..91ed63865f01 --- /dev/null +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_connected_environments_storages_operations.py @@ -0,0 +1,487 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from 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') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + connected_environment_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "connectedEnvironmentName": _SERIALIZER.url("connected_environment_name", connected_environment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + connected_environment_name: str, + storage_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "connectedEnvironmentName": _SERIALIZER.url("connected_environment_name", connected_environment_name, 'str'), + "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + connected_environment_name: str, + storage_name: str, + *, + json: Optional[_models.ConnectedEnvironmentStorage] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "connectedEnvironmentName": _SERIALIZER.url("connected_environment_name", connected_environment_name, 'str'), + "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + connected_environment_name: str, + storage_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "connectedEnvironmentName": _SERIALIZER.url("connected_environment_name", connected_environment_name, 'str'), + "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class ConnectedEnvironmentsStoragesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.app.ContainerAppsAPIClient`'s + :attr:`connected_environments_storages` attribute. + """ + + models = _models + + 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, + resource_group_name: str, + connected_environment_name: str, + **kwargs: Any + ) -> _models.ConnectedEnvironmentStoragesCollection: + """Get all storages for a connectedEnvironment. + + Get all storages for a connectedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the Environment. + :type connected_environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectedEnvironmentStoragesCollection, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.ConnectedEnvironmentStoragesCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectedEnvironmentStoragesCollection] + + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectedEnvironmentStoragesCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages"} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + connected_environment_name: str, + storage_name: str, + **kwargs: Any + ) -> _models.ConnectedEnvironmentStorage: + """Get storage for a connectedEnvironment. + + Get storage for a connectedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the Environment. + :type connected_environment_name: str + :param storage_name: Name of the storage. + :type storage_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectedEnvironmentStorage, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.ConnectedEnvironmentStorage + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectedEnvironmentStorage] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectedEnvironmentStorage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}"} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + connected_environment_name: str, + storage_name: str, + storage_envelope: _models.ConnectedEnvironmentStorage, + **kwargs: Any + ) -> _models.ConnectedEnvironmentStorage: + """Create or update storage for a connectedEnvironment. + + Create or update storage for a connectedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the Environment. + :type connected_environment_name: str + :param storage_name: Name of the storage. + :type storage_name: str + :param storage_envelope: Configuration details of storage. + :type storage_envelope: ~azure.mgmt.app.models.ConnectedEnvironmentStorage + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConnectedEnvironmentStorage, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.ConnectedEnvironmentStorage + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # 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.ConnectedEnvironmentStorage] + + _json = self._serialize.body(storage_envelope, 'ConnectedEnvironmentStorage') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + storage_name=storage_name, + api_version=api_version, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConnectedEnvironmentStorage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + connected_environment_name: str, + storage_name: str, + **kwargs: Any + ) -> None: + """Delete storage for a connectedEnvironment. + + Delete storage for a connectedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param connected_environment_name: Name of the Environment. + :type connected_environment_name: str + :param storage_name: Name of the storage. + :type storage_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + 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) # type: ignore + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}"} # type: ignore + diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_auth_configs_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_auth_configs_operations.py index 5cf790e91218..a3994de70b5b 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_auth_configs_operations.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_auth_configs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +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 msrest import Serializer 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,31 +33,33 @@ def build_list_by_container_app_request( container_app_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -66,35 +68,37 @@ def build_get_request( subscription_id: str, resource_group_name: str, container_app_name: str, - name: str, + auth_config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "authConfigName": _SERIALIZER.url("auth_config_name", auth_config_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -103,42 +107,43 @@ def build_create_or_update_request( subscription_id: str, resource_group_name: str, container_app_name: str, - name: str, + auth_config_name: str, *, - json: JSONType = None, + json: Optional[_models.AuthConfig] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - 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-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "authConfigName": _SERIALIZER.url("auth_config_name", auth_config_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -149,59 +154,59 @@ def build_delete_request( subscription_id: str, resource_group_name: str, container_app_name: str, - name: str, + auth_config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "authConfigName": _SERIALIZER.url("auth_config_name", auth_config_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + 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: ~container_apps_api_client.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.app.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( @@ -209,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. @@ -221,14 +226,19 @@ def list_by_container_app( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AuthConfigCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~container_apps_api_client.models.AuthConfigCollection] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.app.models.AuthConfigCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthConfigCollection"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + 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: @@ -236,10 +246,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, 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: @@ -247,10 +260,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, 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 @@ -264,7 +280,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -278,16 +298,16 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_container_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs'} # type: ignore + list_by_container_app.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs"} # type: ignore @distributed_trace def get( self, resource_group_name: str, container_app_name: str, - 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. @@ -296,31 +316,43 @@ def get( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param name: Name of the Container App AuthConfig. - :type name: str + :param auth_config_name: Name of the Container App AuthConfig. + :type auth_config_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthConfig, or the result of cls(response) - :rtype: ~container_apps_api_client.models.AuthConfig + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AuthConfig] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -335,7 +367,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}"} # type: ignore @distributed_trace @@ -343,10 +375,10 @@ def create_or_update( self, resource_group_name: str, container_app_name: str, - name: str, - auth_config_envelope: "_models.AuthConfig", + auth_config_name: str, + 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. @@ -355,22 +387,26 @@ def create_or_update( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param name: Name of the Container App AuthConfig. - :type name: str + :param auth_config_name: Name of the Container App AuthConfig. + :type auth_config_name: str :param auth_config_envelope: Properties used to create a Container App AuthConfig. - :type auth_config_envelope: ~container_apps_api_client.models.AuthConfig + :type auth_config_envelope: ~azure.mgmt.app.models.AuthConfig :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthConfig, or the result of cls(response) - :rtype: ~container_apps_api_client.models.AuthConfig + :rtype: ~azure.mgmt.app.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 {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # 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') @@ -378,15 +414,22 @@ def create_or_update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, - name=name, + auth_config_name=auth_config_name, + api_version=api_version, 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(request, stream=False, **kwargs) + 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]: @@ -401,15 +444,15 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, container_app_name: str, - name: str, + auth_config_name: str, **kwargs: Any ) -> None: """Delete a Container App AuthConfig. @@ -420,31 +463,43 @@ def delete( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param name: Name of the Container App AuthConfig. - :type name: str + :param auth_config_name: Name of the Container App AuthConfig. + :type auth_config_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, - name=name, + 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(request, stream=False, **kwargs) + 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, 204]: @@ -455,5 +510,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}"} # type: ignore diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_diagnostics_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_diagnostics_operations.py new file mode 100644 index 000000000000..621d32400de1 --- /dev/null +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_diagnostics_operations.py @@ -0,0 +1,634 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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 + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from 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') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_detectors_request( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_detector_request( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + detector_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors/{detectorName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + "detectorName": _SERIALIZER.url("detector_name", detector_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_revisions_request( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorproperties/revisionsApi/revisions/") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_revision_request( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + revision_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorproperties/revisionsApi/revisions/{revisionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + "revisionName": _SERIALIZER.url("revision_name", revision_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_root_request( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorproperties/rootApi/") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class ContainerAppsDiagnosticsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.app.ContainerAppsAPIClient`'s + :attr:`container_apps_diagnostics` attribute. + """ + + models = _models + + 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_detectors( + self, + resource_group_name: str, + container_app_name: str, + **kwargs: Any + ) -> Iterable[_models.DiagnosticsCollection]: + """Get the list of diagnostics for a given Container App. + + Get the list of diagnostics for a given Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App for which detector info is needed. + :type container_app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DiagnosticsCollection or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.app.models.DiagnosticsCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DiagnosticsCollection] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_detectors_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + template_url=self.list_detectors.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_detectors_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + 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) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DiagnosticsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_detectors.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors"} # type: ignore + + @distributed_trace + def get_detector( + self, + resource_group_name: str, + container_app_name: str, + detector_name: str, + **kwargs: Any + ) -> _models.Diagnostics: + """Get a diagnostics result of a Container App. + + Get a diagnostics result of a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param detector_name: Name of the Container App Detector. + :type detector_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Diagnostics, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.Diagnostics + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Diagnostics] + + + request = build_get_detector_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + detector_name=detector_name, + api_version=api_version, + template_url=self.get_detector.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Diagnostics', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_detector.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors/{detectorName}"} # type: ignore + + + @distributed_trace + def list_revisions( + self, + resource_group_name: str, + container_app_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable[_models.RevisionCollection]: + """Get the Revisions for a given Container App. + + Get the Revisions for a given Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App for which Revisions are needed. + :type container_app_name: str + :param filter: The filter to apply on the operation. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RevisionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.app.models.RevisionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RevisionCollection] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_revisions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + 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) # type: ignore + + else: + + request = build_list_revisions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + 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) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RevisionCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_revisions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorproperties/revisionsApi/revisions/"} # type: ignore + + @distributed_trace + def get_revision( + self, + resource_group_name: str, + container_app_name: str, + revision_name: str, + **kwargs: Any + ) -> _models.Revision: + """Get a revision of a Container App. + + Get a revision of a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param revision_name: Name of the Container App Revision. + :type revision_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Revision, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.Revision + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Revision] + + + request = build_get_revision_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Revision', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_revision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorproperties/revisionsApi/revisions/{revisionName}"} # type: ignore + + + @distributed_trace + def get_root( + self, + resource_group_name: str, + container_app_name: str, + **kwargs: Any + ) -> _models.ContainerApp: + """Get the properties of a Container App. + + Get the properties of a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContainerApp, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.ContainerApp + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerApp] + + + request = build_get_root_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + template_url=self.get_root.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ContainerApp', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_root.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorproperties/rootApi/"} # type: ignore + diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_operations.py index 84b483c37f78..8a4d489a6d82 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_operations.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,14 +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 msrest import Serializer 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,29 +33,31 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -65,30 +67,32 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -96,34 +100,36 @@ def build_list_by_resource_group_request( def build_get_request( subscription_id: str, resource_group_name: str, - name: str, + container_app_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "name": _SERIALIZER.url("name", name, 'str'), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -131,41 +137,42 @@ def build_get_request( def build_create_or_update_request_initial( subscription_id: str, resource_group_name: str, - name: str, + container_app_name: str, *, - json: JSONType = None, + json: Optional[_models.ContainerApp] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - 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-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "name": _SERIALIZER.url("name", name, 'str'), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -175,76 +182,79 @@ def build_create_or_update_request_initial( def build_delete_request_initial( subscription_id: str, resource_group_name: str, - name: str, + container_app_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "name": _SERIALIZER.url("name", name, 'str'), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) -def build_update_request( +def build_update_request_initial( subscription_id: str, resource_group_name: str, - name: str, + container_app_name: str, *, - json: JSONType = None, + json: Optional[_models.ContainerApp] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - 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-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "name": _SERIALIZER.url("name", name, 'str'), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -259,33 +269,35 @@ def build_list_custom_host_name_analysis_request( custom_hostname: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listCustomHostNameAnalysis') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listCustomHostNameAnalysis") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -293,64 +305,64 @@ def build_list_custom_host_name_analysis_request( def build_list_secrets_request( subscription_id: str, resource_group_name: str, - name: str, + container_app_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}/listSecrets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listSecrets") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "name": _SERIALIZER.url("name", name, 'str'), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + 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: ~container_apps_api_client.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.app.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. @@ -358,32 +370,43 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContainerAppCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~container_apps_api_client.models.ContainerAppCollection] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.app.models.ContainerAppCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerAppCollection"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + 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: request = build_list_by_subscription_request( 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: request = build_list_by_subscription_request( 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 @@ -397,7 +420,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -411,14 +438,14 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps"} # type: ignore @distributed_trace 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. @@ -428,34 +455,45 @@ def list_by_resource_group( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContainerAppCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~container_apps_api_client.models.ContainerAppCollection] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.app.models.ContainerAppCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerAppCollection"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + 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: request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, 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: request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, 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 @@ -469,7 +507,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -483,45 +525,57 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps"} # type: ignore @distributed_trace def get( self, resource_group_name: str, - 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. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param name: Name of the Container App. - :type name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ContainerApp, or the result of cls(response) - :rtype: ~container_apps_api_client.models.ContainerApp + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerApp] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -536,38 +590,49 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, - name: str, - container_app_envelope: "_models.ContainerApp", + container_app_name: str, + 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 {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # 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') request = build_create_or_update_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - name=name, + container_app_name=container_app_name, + api_version=api_version, 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(request, stream=False, **kwargs) + 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, 201]: @@ -585,27 +650,27 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}"} # type: ignore @distributed_trace def begin_create_or_update( self, resource_group_name: str, - name: str, - container_app_envelope: "_models.ContainerApp", + container_app_name: str, + 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. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param name: Name of the Container App. - :type name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str :param container_app_envelope: Properties used to create a container app. - :type container_app_envelope: ~container_apps_api_client.models.ContainerApp + :type container_app_envelope: ~azure.mgmt.app.models.ContainerApp :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -616,38 +681,50 @@ def begin_create_or_update( Retry-After header is present. :return: An instance of LROPoller that returns either ContainerApp or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~container_apps_api_client.models.ContainerApp] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.app.models.ContainerApp] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerApp"] + _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-06-01-preview")) # 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] 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, - name=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( @@ -656,34 +733,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, - name: str, + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - name=name, + 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(request, stream=False, **kwargs) + 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, 204]: @@ -693,14 +781,14 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, - name: str, + container_app_name: str, **kwargs: Any ) -> LROPoller[None]: """Delete a Container App. @@ -709,8 +797,8 @@ def begin_delete( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param name: Name of the Container App. - :type name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -723,18 +811,25 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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-06-01-preview")) # 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, - name=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) @@ -744,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( @@ -754,73 +855,143 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}"} # type: ignore - @distributed_trace - def update( + def _update_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, - name: str, - container_app_envelope: "_models.ContainerAppPatch", + container_app_name: str, + container_app_envelope: _models.ContainerApp, **kwargs: Any - ) -> "_models.ContainerApp": - """Update properties of a Container App. - - Patches a Container App. Currently only patching of tags is supported. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param name: Name of the Container App. - :type name: str - :param container_app_envelope: Properties of a container app that need to be updated. - :type container_app_envelope: ~container_apps_api_client.models.ContainerAppPatch - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ContainerApp, or the result of cls(response) - :rtype: ~container_apps_api_client.models.ContainerApp - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerApp"] + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - 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 {}) - _json = self._serialize.body(container_app_envelope, 'ContainerAppPatch') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # 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') - request = build_update_request( + request = build_update_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - name=name, + container_app_name=container_app_name, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + 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(request, stream=False, **kwargs) + 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]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ContainerApp', pipeline_response) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, {}) - return deserialized + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}"} # type: ignore + + + @distributed_trace + def begin_update( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + container_app_envelope: _models.ContainerApp, + **kwargs: Any + ) -> LROPoller[None]: + """Update properties of a Container App. + + Patches a Container App using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param container_app_envelope: Properties of a Container App that need to be updated. + :type container_app_envelope: ~azure.mgmt.app.models.ContainerApp + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}'} # type: ignore + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # 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( # 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): + if cls: + return cls(pipeline_response, None, {}) + 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( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}"} # type: ignore + @distributed_trace def list_custom_host_name_analysis( self, @@ -828,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. @@ -837,31 +1008,43 @@ def list_custom_host_name_analysis( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param custom_hostname: Custom hostname. + :param custom_hostname: Custom hostname. Default value is None. :type custom_hostname: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomHostnameAnalysisResult, or the result of cls(response) - :rtype: ~container_apps_api_client.models.CustomHostnameAnalysisResult + :rtype: ~azure.mgmt.app.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 {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CustomHostnameAnalysisResult] request = build_list_custom_host_name_analysis_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, + 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(request, stream=False, **kwargs) + 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]: @@ -876,46 +1059,58 @@ def list_custom_host_name_analysis( return deserialized - list_custom_host_name_analysis.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listCustomHostNameAnalysis'} # type: ignore + list_custom_host_name_analysis.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listCustomHostNameAnalysis"} # type: ignore @distributed_trace def list_secrets( self, resource_group_name: str, - name: str, + container_app_name: str, **kwargs: Any - ) -> "_models.SecretsCollection": + ) -> _models.SecretsCollection: """List secrets for a container app. List secrets for a container app. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param name: Name of the Container App. - :type name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SecretsCollection, or the result of cls(response) - :rtype: ~container_apps_api_client.models.SecretsCollection + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SecretsCollection] request = build_list_secrets_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -930,5 +1125,5 @@ def list_secrets( return deserialized - list_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}/listSecrets'} # type: ignore + list_secrets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listSecrets"} # type: ignore diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_revision_replicas_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_revision_replicas_operations.py index 7ed14ea71456..fe8950a5ae95 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_revision_replicas_operations.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_revision_replicas_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -30,36 +31,38 @@ def build_get_replica_request( resource_group_name: str, container_app_name: str, revision_name: str, - name: str, + replica_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{name}') + _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 = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), "revisionName": _SERIALIZER.url("revision_name", revision_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "replicaName": _SERIALIZER.url("replica_name", replica_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -71,10 +74,14 @@ def build_list_replicas_request( revision_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas') + _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 = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -82,45 +89,41 @@ def build_list_replicas_request( "revisionName": _SERIALIZER.url("revision_name", revision_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + 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: ~container_apps_api_client.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.app.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( @@ -128,9 +131,9 @@ def get_replica( resource_group_name: str, container_app_name: str, revision_name: str, - 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. @@ -141,18 +144,23 @@ def get_replica( :type container_app_name: str :param revision_name: Name of the Container App Revision. :type revision_name: str - :param name: Name of the Container App Revision Replica. - :type name: str + :param replica_name: Name of the Container App Revision Replica. + :type replica_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Replica, or the result of cls(response) - :rtype: ~container_apps_api_client.models.Replica + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Replica] request = build_get_replica_request( @@ -160,13 +168,20 @@ def get_replica( resource_group_name=resource_group_name, container_app_name=container_app_name, revision_name=revision_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -181,7 +196,7 @@ def get_replica( return deserialized - get_replica.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{name}'} # type: ignore + get_replica.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{replicaName}"} # type: ignore @distributed_trace @@ -191,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. @@ -204,14 +219,19 @@ def list_replicas( :type revision_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ReplicaCollection, or the result of cls(response) - :rtype: ~container_apps_api_client.models.ReplicaCollection + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ReplicaCollection] request = build_list_replicas_request( @@ -219,12 +239,19 @@ def list_replicas( resource_group_name=resource_group_name, container_app_name=container_app_name, 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(request, stream=False, **kwargs) + 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]: @@ -239,5 +266,5 @@ def list_replicas( return deserialized - list_replicas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas'} # type: ignore + list_replicas.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas"} # type: ignore diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_revisions_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_revisions_operations.py index 55acb0f3d9c7..ffaa875e95a5 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_revisions_operations.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_revisions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,8 +16,8 @@ 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 msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -30,33 +31,39 @@ def build_list_revisions_request( subscription_id: str, resource_group_name: str, container_app_name: str, + *, + filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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: + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -65,35 +72,37 @@ def build_get_revision_request( subscription_id: str, resource_group_name: str, container_app_name: str, - name: str, + revision_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "revisionName": _SERIALIZER.url("revision_name", revision_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -102,35 +111,37 @@ def build_activate_revision_request( subscription_id: str, resource_group_name: str, container_app_name: str, - name: str, + revision_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/activate') + _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 = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "revisionName": _SERIALIZER.url("revision_name", revision_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -139,35 +150,37 @@ def build_deactivate_revision_request( subscription_id: str, resource_group_name: str, container_app_name: str, - name: str, + revision_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/deactivate') + _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 = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "revisionName": _SERIALIZER.url("revision_name", revision_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -176,67 +189,68 @@ def build_restart_revision_request( subscription_id: str, resource_group_name: str, container_app_name: str, - name: str, + revision_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/restart') + _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 = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "revisionName": _SERIALIZER.url("revision_name", revision_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + 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: ~container_apps_api_client.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.app.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( self, resource_group_name: str, 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. @@ -245,16 +259,23 @@ def list_revisions( :type resource_group_name: str :param container_app_name: Name of the Container App for which Revisions are needed. :type container_app_name: str + :param filter: The filter to apply on the operation. Default value is None. + :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RevisionCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~container_apps_api_client.models.RevisionCollection] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.app.models.RevisionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RevisionCollection"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + 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: @@ -262,10 +283,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, + 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: @@ -273,10 +298,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, + 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 @@ -290,7 +319,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -304,16 +337,16 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_revisions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions'} # type: ignore + list_revisions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions"} # type: ignore @distributed_trace def get_revision( self, resource_group_name: str, container_app_name: str, - 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. @@ -322,31 +355,43 @@ def get_revision( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param name: Name of the Container App Revision. - :type name: str + :param revision_name: Name of the Container App Revision. + :type revision_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Revision, or the result of cls(response) - :rtype: ~container_apps_api_client.models.Revision + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Revision] request = build_get_revision_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -361,15 +406,15 @@ def get_revision( return deserialized - get_revision.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}'} # type: ignore + get_revision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}"} # type: ignore @distributed_trace - def activate_revision( + def activate_revision( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, container_app_name: str, - name: str, + revision_name: str, **kwargs: Any ) -> None: """Activates a revision for a Container App. @@ -380,31 +425,43 @@ def activate_revision( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param name: Name of the Container App Revision. - :type name: str + :param revision_name: Name of the Container App Revision. + :type revision_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_activate_revision_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -415,15 +472,15 @@ def activate_revision( if cls: return cls(pipeline_response, None, {}) - activate_revision.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/activate'} # type: ignore + activate_revision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/activate"} # type: ignore @distributed_trace - def deactivate_revision( + def deactivate_revision( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, container_app_name: str, - name: str, + revision_name: str, **kwargs: Any ) -> None: """Deactivates a revision for a Container App. @@ -434,31 +491,43 @@ def deactivate_revision( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param name: Name of the Container App Revision. - :type name: str + :param revision_name: Name of the Container App Revision. + :type revision_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_deactivate_revision_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -469,15 +538,15 @@ def deactivate_revision( if cls: return cls(pipeline_response, None, {}) - deactivate_revision.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/deactivate'} # type: ignore + deactivate_revision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/deactivate"} # type: ignore @distributed_trace - def restart_revision( + def restart_revision( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, container_app_name: str, - name: str, + revision_name: str, **kwargs: Any ) -> None: """Restarts a revision for a Container App. @@ -488,31 +557,43 @@ def restart_revision( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param name: Name of the Container App Revision. - :type name: str + :param revision_name: Name of the Container App Revision. + :type revision_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_restart_revision_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -523,5 +604,5 @@ def restart_revision( if cls: return cls(pipeline_response, None, {}) - restart_revision.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/restart'} # type: ignore + restart_revision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/restart"} # type: ignore diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_source_controls_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_source_controls_operations.py index 840a4c9f6839..29be54a19edb 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_source_controls_operations.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_container_apps_source_controls_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,14 +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 msrest import Serializer 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,31 +35,33 @@ def build_list_by_container_app_request( container_app_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -68,35 +70,37 @@ def build_get_request( subscription_id: str, resource_group_name: str, container_app_name: str, - name: str, + source_control_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "sourceControlName": _SERIALIZER.url("source_control_name", source_control_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -105,42 +109,43 @@ def build_create_or_update_request_initial( subscription_id: str, resource_group_name: str, container_app_name: str, - name: str, + source_control_name: str, *, - json: JSONType = None, + json: Optional[_models.SourceControl] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - 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-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "sourceControlName": _SERIALIZER.url("source_control_name", source_control_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -151,59 +156,59 @@ def build_delete_request_initial( subscription_id: str, resource_group_name: str, container_app_name: str, - name: str, + source_control_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "sourceControlName": _SERIALIZER.url("source_control_name", source_control_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + 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: ~container_apps_api_client.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.app.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( @@ -211,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. @@ -223,14 +228,19 @@ def list_by_container_app( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SourceControlCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~container_apps_api_client.models.SourceControlCollection] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.app.models.SourceControlCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlCollection"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + 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: @@ -238,10 +248,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, 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: @@ -249,10 +262,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, 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 @@ -266,7 +282,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -280,16 +300,16 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_container_app.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols'} # type: ignore + list_by_container_app.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols"} # type: ignore @distributed_trace def get( self, resource_group_name: str, container_app_name: str, - 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. @@ -298,31 +318,43 @@ def get( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param name: Name of the Container App SourceControl. - :type name: str + :param source_control_name: Name of the Container App SourceControl. + :type source_control_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControl, or the result of cls(response) - :rtype: ~container_apps_api_client.models.SourceControl + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControl] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -337,24 +369,28 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, container_app_name: str, - name: str, - source_control_envelope: "_models.SourceControl", + source_control_name: str, + 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 {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # 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') @@ -362,15 +398,22 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, - name=name, + source_control_name=source_control_name, + api_version=api_version, 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(request, stream=False, **kwargs) + 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]: @@ -388,7 +431,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}"} # type: ignore @distributed_trace @@ -396,10 +439,10 @@ def begin_create_or_update( self, resource_group_name: str, container_app_name: str, - name: str, - source_control_envelope: "_models.SourceControl", + source_control_name: str, + 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. @@ -408,10 +451,10 @@ def begin_create_or_update( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param name: Name of the Container App SourceControl. - :type name: str + :param source_control_name: Name of the Container App SourceControl. + :type source_control_name: str :param source_control_envelope: Properties used to create a Container App SourceControl. - :type source_control_envelope: ~container_apps_api_client.models.SourceControl + :type source_control_envelope: ~azure.mgmt.app.models.SourceControl :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -422,39 +465,51 @@ def begin_create_or_update( Retry-After header is present. :return: An instance of LROPoller that returns either SourceControl or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~container_apps_api_client.models.SourceControl] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.app.models.SourceControl] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControl"] + _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-06-01-preview")) # 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] 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, - name=name, + source_control_name=source_control_name, source_control_envelope=source_control_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('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( @@ -463,36 +518,47 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, container_app_name: str, - name: str, + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, container_app_name=container_app_name, - name=name, + 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(request, stream=False, **kwargs) + 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, 204]: @@ -502,15 +568,15 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, container_app_name: str, - name: str, + source_control_name: str, **kwargs: Any ) -> LROPoller[None]: """Delete a Container App SourceControl. @@ -521,8 +587,8 @@ def begin_delete( :type resource_group_name: str :param container_app_name: Name of the Container App. :type container_app_name: str - :param name: Name of the Container App SourceControl. - :type name: str + :param source_control_name: Name of the Container App SourceControl. + :type source_control_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -535,19 +601,26 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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-06-01-preview")) # 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, - name=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) @@ -557,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( @@ -567,7 +646,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}"} # type: ignore diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_dapr_components_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_dapr_components_operations.py index a61679d7fa61..1e8c2a890b74 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_dapr_components_operations.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_dapr_components_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +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 msrest import Serializer 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,31 +33,33 @@ def build_list_request( environment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -66,35 +68,37 @@ def build_get_request( subscription_id: str, resource_group_name: str, environment_name: str, - name: str, + component_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "componentName": _SERIALIZER.url("component_name", component_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -103,42 +107,43 @@ def build_create_or_update_request( subscription_id: str, resource_group_name: str, environment_name: str, - name: str, + component_name: str, *, - json: JSONType = None, + json: Optional[_models.DaprComponent] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - 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-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "componentName": _SERIALIZER.url("component_name", component_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -149,59 +154,98 @@ def build_delete_request( subscription_id: str, resource_group_name: str, environment_name: str, - name: str, + component_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "componentName": _SERIALIZER.url("component_name", component_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + 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. +def build_list_secrets_request( + subscription_id: str, + resource_group_name: str, + environment_name: str, + component_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('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 = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), + "componentName": _SERIALIZER.url("component_name", component_name, 'str'), + } - :ivar models: Alias to model classes used in this operation group. - :type models: ~container_apps_api_client.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. + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class DaprComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.app.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( @@ -209,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. @@ -221,15 +265,19 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DaprComponentsCollection or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~container_apps_api_client.models.DaprComponentsCollection] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.app.models.DaprComponentsCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DaprComponentsCollection"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + 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: @@ -237,10 +285,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, 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: @@ -248,10 +299,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, 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 @@ -265,7 +319,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -279,16 +337,16 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents"} # type: ignore @distributed_trace def get( self, resource_group_name: str, environment_name: str, - name: str, + component_name: str, **kwargs: Any - ) -> "_models.DaprComponent": + ) -> _models.DaprComponent: """Get a dapr component. Get a dapr component. @@ -297,31 +355,43 @@ def get( :type resource_group_name: str :param environment_name: Name of the Managed Environment. :type environment_name: str - :param name: Name of the Dapr Component. - :type name: str + :param component_name: Name of the Dapr Component. + :type component_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DaprComponent, or the result of cls(response) - :rtype: ~container_apps_api_client.models.DaprComponent + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DaprComponent] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, environment_name=environment_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -336,7 +406,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}"} # type: ignore @distributed_trace @@ -344,10 +414,10 @@ def create_or_update( self, resource_group_name: str, environment_name: str, - name: str, - dapr_component_envelope: "_models.DaprComponent", + component_name: str, + 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. @@ -356,22 +426,26 @@ def create_or_update( :type resource_group_name: str :param environment_name: Name of the Managed Environment. :type environment_name: str - :param name: Name of the Dapr Component. - :type name: str + :param component_name: Name of the Dapr Component. + :type component_name: str :param dapr_component_envelope: Configuration details of the Dapr Component. - :type dapr_component_envelope: ~container_apps_api_client.models.DaprComponent + :type dapr_component_envelope: ~azure.mgmt.app.models.DaprComponent :keyword callable cls: A custom type or function that will be passed the direct response :return: DaprComponent, or the result of cls(response) - :rtype: ~container_apps_api_client.models.DaprComponent + :rtype: ~azure.mgmt.app.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 {}) - 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-06-01-preview")) # 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') @@ -379,15 +453,22 @@ def create_or_update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, environment_name=environment_name, - name=name, + component_name=component_name, + api_version=api_version, 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(request, stream=False, **kwargs) + 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]: @@ -402,15 +483,15 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, environment_name: str, - name: str, + component_name: str, **kwargs: Any ) -> None: """Delete a Dapr Component. @@ -421,31 +502,43 @@ def delete( :type resource_group_name: str :param environment_name: Name of the Managed Environment. :type environment_name: str - :param name: Name of the Dapr Component. - :type name: str + :param component_name: Name of the Dapr Component. + :type component_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, environment_name=environment_name, - name=name, + 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(request, stream=False, **kwargs) + 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, 204]: @@ -456,5 +549,75 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}"} # type: ignore + + + @distributed_trace + def list_secrets( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + **kwargs: Any + ) -> _models.DaprSecretsCollection: + """List secrets for a dapr component. + + List secrets for a dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :param component_name: Name of the Dapr Component. + :type component_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprSecretsCollection, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.DaprSecretsCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DaprSecretsCollection] + + + request = build_list_secrets_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DaprSecretsCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_secrets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/listSecrets"} # type: ignore diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_managed_environment_diagnostics_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_managed_environment_diagnostics_operations.py new file mode 100644 index 000000000000..54e023564673 --- /dev/null +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_managed_environment_diagnostics_operations.py @@ -0,0 +1,258 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from 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') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_detectors_request( + subscription_id: str, + resource_group_name: str, + environment_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_detector_request( + subscription_id: str, + resource_group_name: str, + environment_name: str, + detector_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors/{detectorName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), + "detectorName": _SERIALIZER.url("detector_name", detector_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class ManagedEnvironmentDiagnosticsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.app.ContainerAppsAPIClient`'s + :attr:`managed_environment_diagnostics` attribute. + """ + + models = _models + + 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_detectors( + self, + resource_group_name: str, + environment_name: str, + **kwargs: Any + ) -> _models.DiagnosticsCollection: + """Get the list of diagnostics for a given Managed Environment. + + Get the list of diagnostics for a Managed Environment used to host container apps. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Environment. + :type environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticsCollection, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.DiagnosticsCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DiagnosticsCollection] + + + request = build_list_detectors_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + api_version=api_version, + template_url=self.list_detectors.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DiagnosticsCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_detectors.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors"} # type: ignore + + + @distributed_trace + def get_detector( + self, + resource_group_name: str, + environment_name: str, + detector_name: str, + **kwargs: Any + ) -> _models.Diagnostics: + """Get the diagnostics data for a given Managed Environment. + + Get the diagnostics data for a Managed Environment used to host container apps. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Environment. + :type environment_name: str + :param detector_name: Name of the Managed Environment detector. + :type detector_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Diagnostics, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.Diagnostics + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Diagnostics] + + + request = build_get_detector_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + detector_name=detector_name, + api_version=api_version, + template_url=self.get_detector.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Diagnostics', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_detector.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors/{detectorName}"} # type: ignore + diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_managed_environments_diagnostics_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_managed_environments_diagnostics_operations.py new file mode 100644 index 000000000000..a6d921dd2a72 --- /dev/null +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_managed_environments_diagnostics_operations.py @@ -0,0 +1,149 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from 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') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_root_request( + subscription_id: str, + resource_group_name: str, + environment_name: str, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectorproperties/rootApi/") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class ManagedEnvironmentsDiagnosticsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.app.ContainerAppsAPIClient`'s + :attr:`managed_environments_diagnostics` attribute. + """ + + models = _models + + 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_root( + self, + resource_group_name: str, + environment_name: str, + **kwargs: Any + ) -> _models.ManagedEnvironment: + """Get the properties of a Managed Environment. + + Get the properties of a Managed Environment used to host container apps. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Environment. + :type environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedEnvironment, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.ManagedEnvironment + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironment] + + + request = build_get_root_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + api_version=api_version, + template_url=self.get_root.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedEnvironment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_root.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectorproperties/rootApi/"} # type: ignore + diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_managed_environments_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_managed_environments_operations.py index e9846a028b32..0a376b936d87 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_managed_environments_operations.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_managed_environments_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,14 +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 msrest import Serializer 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,29 +33,31 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -65,30 +67,32 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -96,34 +100,36 @@ def build_list_by_resource_group_request( def build_get_request( subscription_id: str, resource_group_name: str, - name: str, + environment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "name": _SERIALIZER.url("name", name, 'str'), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -131,41 +137,42 @@ def build_get_request( def build_create_or_update_request_initial( subscription_id: str, resource_group_name: str, - name: str, + environment_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedEnvironment] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - 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-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "name": _SERIALIZER.url("name", name, 'str'), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -175,108 +182,109 @@ def build_create_or_update_request_initial( def build_delete_request_initial( subscription_id: str, resource_group_name: str, - name: str, + environment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "name": _SERIALIZER.url("name", name, 'str'), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) -def build_update_request( +def build_update_request_initial( subscription_id: str, resource_group_name: str, - name: str, + environment_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedEnvironment] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - 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-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "name": _SERIALIZER.url("name", name, 'str'), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + 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: ~container_apps_api_client.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.app.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. @@ -284,33 +292,43 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ManagedEnvironmentsCollection or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~container_apps_api_client.models.ManagedEnvironmentsCollection] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.app.models.ManagedEnvironmentsCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentsCollection"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + 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: request = build_list_by_subscription_request( 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: request = build_list_by_subscription_request( 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 @@ -324,7 +342,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -338,14 +360,14 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments"} # type: ignore @distributed_trace 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. @@ -355,35 +377,45 @@ def list_by_resource_group( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ManagedEnvironmentsCollection or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~container_apps_api_client.models.ManagedEnvironmentsCollection] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.app.models.ManagedEnvironmentsCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentsCollection"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + 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: request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, 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: request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, 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 @@ -397,7 +429,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -411,45 +447,57 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments"} # type: ignore @distributed_trace def get( self, resource_group_name: str, - 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. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param name: Name of the Environment. - :type name: str + :param environment_name: Name of the Environment. + :type environment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedEnvironment, or the result of cls(response) - :rtype: ~container_apps_api_client.models.ManagedEnvironment + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironment] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - name=name, + 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(request, stream=False, **kwargs) + 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]: @@ -464,38 +512,49 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, - name: str, - environment_envelope: "_models.ManagedEnvironment", + environment_name: str, + 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 {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # 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') request = build_create_or_update_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - name=name, + environment_name=environment_name, + api_version=api_version, 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(request, stream=False, **kwargs) + 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, 201]: @@ -513,27 +572,27 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}"} # type: ignore @distributed_trace def begin_create_or_update( self, resource_group_name: str, - name: str, - environment_envelope: "_models.ManagedEnvironment", + environment_name: str, + 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. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param name: Name of the Environment. - :type name: str + :param environment_name: Name of the Environment. + :type environment_name: str :param environment_envelope: Configuration details of the Environment. - :type environment_envelope: ~container_apps_api_client.models.ManagedEnvironment + :type environment_envelope: ~azure.mgmt.app.models.ManagedEnvironment :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -544,38 +603,50 @@ def begin_create_or_update( Retry-After header is present. :return: An instance of LROPoller that returns either ManagedEnvironment or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~container_apps_api_client.models.ManagedEnvironment] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.app.models.ManagedEnvironment] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironment"] + _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-06-01-preview")) # 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] 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, - name=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( @@ -584,34 +655,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, - name: str, + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - name=name, + 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(request, stream=False, **kwargs) + 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, 204]: @@ -621,14 +703,14 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, - name: str, + environment_name: str, **kwargs: Any ) -> LROPoller[None]: """Delete a Managed Environment. @@ -637,8 +719,8 @@ def begin_delete( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param name: Name of the Environment. - :type name: str + :param environment_name: Name of the Environment. + :type environment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -651,18 +733,25 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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-06-01-preview")) # 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, - name=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) @@ -672,8 +761,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( @@ -682,69 +777,139 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}"} # type: ignore - @distributed_trace - def update( + def _update_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, - name: str, - environment_envelope: "_models.ManagedEnvironmentPatch", + environment_name: str, + environment_envelope: _models.ManagedEnvironment, **kwargs: Any - ) -> "_models.ManagedEnvironment": - """Update Managed Environment's properties. - - Patches a Managed Environment. Only patching of tags is supported currently. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param name: Name of the Environment. - :type name: str - :param environment_envelope: Configuration details of the Environment. - :type environment_envelope: ~container_apps_api_client.models.ManagedEnvironmentPatch - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedEnvironment, or the result of cls(response) - :rtype: ~container_apps_api_client.models.ManagedEnvironment - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironment"] + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - 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 {}) - _json = self._serialize.body(environment_envelope, 'ManagedEnvironmentPatch') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # 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') - request = build_update_request( + request = build_update_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - name=name, + environment_name=environment_name, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + 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(request, stream=False, **kwargs) + 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]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ManagedEnvironment', pipeline_response) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, {}) - return deserialized + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}"} # type: ignore + + + @distributed_trace + def begin_update( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + environment_name: str, + environment_envelope: _models.ManagedEnvironment, + **kwargs: Any + ) -> LROPoller[None]: + """Update Managed Environment's properties. + + Patches a Managed Environment using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Environment. + :type environment_name: str + :param environment_envelope: Configuration details of the Environment. + :type environment_envelope: ~azure.mgmt.app.models.ManagedEnvironment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}'} # type: ignore + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # 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( # 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): + if cls: + return cls(pipeline_response, None, {}) + + + 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( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}"} # type: ignore diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_managed_environments_storages_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_managed_environments_storages_operations.py index 065193077a23..f34bfaa5ed94 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_managed_environments_storages_operations.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_managed_environments_storages_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer 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() @@ -29,34 +29,36 @@ def build_list_request( subscription_id: str, resource_group_name: str, - env_name: str, + environment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "envName": _SERIALIZER.url("env_name", env_name, 'str'), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -64,36 +66,38 @@ def build_list_request( def build_get_request( subscription_id: str, resource_group_name: str, - env_name: str, - name: str, + environment_name: str, + storage_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "envName": _SERIALIZER.url("env_name", env_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), + "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -101,43 +105,44 @@ def build_get_request( def build_create_or_update_request( subscription_id: str, resource_group_name: str, - env_name: str, - name: str, + environment_name: str, + storage_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedEnvironmentStorage] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - 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-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "envName": _SERIALIZER.url("env_name", env_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), + "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -147,98 +152,110 @@ def build_create_or_update_request( def build_delete_request( subscription_id: str, resource_group_name: str, - env_name: str, - name: str, + environment_name: str, + storage_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "envName": _SERIALIZER.url("env_name", env_name, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), + "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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, + url=_url, + 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: ~container_apps_api_client.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.app.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( self, resource_group_name: str, - env_name: str, + environment_name: str, **kwargs: Any - ) -> "_models.ManagedEnvironmentStoragesCollection": + ) -> _models.ManagedEnvironmentStoragesCollection: """Get all storages for a managedEnvironment. Get all storages for a managedEnvironment. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param env_name: Name of the Environment. - :type env_name: str + :param environment_name: Name of the Environment. + :type environment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedEnvironmentStoragesCollection, or the result of cls(response) - :rtype: ~container_apps_api_client.models.ManagedEnvironmentStoragesCollection + :rtype: ~azure.mgmt.app.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 {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironmentStoragesCollection] request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - env_name=env_name, + 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(request, stream=False, **kwargs) + 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]: @@ -253,50 +270,62 @@ def list( return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages"} # type: ignore @distributed_trace def get( self, resource_group_name: str, - env_name: str, - name: str, + environment_name: str, + storage_name: str, **kwargs: Any - ) -> "_models.ManagedEnvironmentStorage": + ) -> _models.ManagedEnvironmentStorage: """Get storage for a managedEnvironment. Get storage for a managedEnvironment. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param env_name: Name of the Environment. - :type env_name: str - :param name: Name of the storage. - :type name: str + :param environment_name: Name of the Environment. + :type environment_name: str + :param storage_name: Name of the storage. + :type storage_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedEnvironmentStorage, or the result of cls(response) - :rtype: ~container_apps_api_client.models.ManagedEnvironmentStorage + :rtype: ~azure.mgmt.app.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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedEnvironmentStorage] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - env_name=env_name, - name=name, + environment_name=environment_name, + 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(request, stream=False, **kwargs) + 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]: @@ -311,58 +340,69 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}"} # type: ignore @distributed_trace def create_or_update( self, resource_group_name: str, - env_name: str, - name: str, - storage_envelope: "_models.ManagedEnvironmentStorage", + environment_name: str, + storage_name: str, + storage_envelope: _models.ManagedEnvironmentStorage, **kwargs: Any - ) -> "_models.ManagedEnvironmentStorage": + ) -> _models.ManagedEnvironmentStorage: """Create or update storage for a managedEnvironment. Create or update storage for a managedEnvironment. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param env_name: Name of the Environment. - :type env_name: str - :param name: Name of the storage. - :type name: str + :param environment_name: Name of the Environment. + :type environment_name: str + :param storage_name: Name of the storage. + :type storage_name: str :param storage_envelope: Configuration details of storage. - :type storage_envelope: ~container_apps_api_client.models.ManagedEnvironmentStorage + :type storage_envelope: ~azure.mgmt.app.models.ManagedEnvironmentStorage :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedEnvironmentStorage, or the result of cls(response) - :rtype: ~container_apps_api_client.models.ManagedEnvironmentStorage + :rtype: ~azure.mgmt.app.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 {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # 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') request = build_create_or_update_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - env_name=env_name, - name=name, + environment_name=environment_name, + storage_name=storage_name, + api_version=api_version, 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(request, stream=False, **kwargs) + 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]: @@ -377,15 +417,15 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, - env_name: str, - name: str, + environment_name: str, + storage_name: str, **kwargs: Any ) -> None: """Delete storage for a managedEnvironment. @@ -394,33 +434,45 @@ def delete( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param env_name: Name of the Environment. - :type env_name: str - :param name: Name of the storage. - :type name: str + :param environment_name: Name of the Environment. + :type environment_name: str + :param storage_name: Name of the storage. + :type storage_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :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', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - env_name=env_name, - name=name, + environment_name=environment_name, + 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(request, stream=False, **kwargs) + 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, 204]: @@ -431,5 +483,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}"} # type: ignore diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_namespaces_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_namespaces_operations.py new file mode 100644 index 000000000000..3a3dd444a21c --- /dev/null +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_namespaces_operations.py @@ -0,0 +1,164 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from 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') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_check_name_availability_request( + subscription_id: str, + resource_group_name: str, + environment_name: str, + *, + json: Optional[_models.CheckNameAvailabilityRequest] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _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-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('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 = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + +class NamespacesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.app.ContainerAppsAPIClient`'s + :attr:`namespaces` attribute. + """ + + models = _models + + 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, + **kwargs: Any + ) -> _models.CheckNameAvailabilityResponse: + """Checks the resource name availability. + + Checks if resource name is available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :param check_name_availability_request: The check name availability request. + :type check_name_availability_request: ~azure.mgmt.app.models.CheckNameAvailabilityRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResponse, or the result of cls(response) + :rtype: ~azure.mgmt.app.models.CheckNameAvailabilityResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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', _params.pop('api-version', "2022-06-01-preview")) # 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') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + api_version=api_version, + 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) # type: ignore + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/checkNameAvailability"} # type: ignore + diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_operations.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_operations.py index a998d5f98846..0f33d7837733 100644 --- a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_operations.py +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,8 +16,8 @@ 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 msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,82 +30,93 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _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-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.App/operations') + _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, + url=_url, + 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: ~container_apps_api_client.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.app.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 :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~container_apps_api_client.models.AvailableOperations] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.app.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + 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 @@ -118,7 +130,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -132,4 +148,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.App/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.App/operations"} # type: ignore diff --git a/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_patch.py b/sdk/app/azure-mgmt-app/azure/mgmt/app/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/app/azure-mgmt-app/azure/mgmt/app/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 + """