diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json b/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json index 071ce382b183..993005be0f4c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json +++ b/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json @@ -1,11 +1,11 @@ { - "commit": "e5404d3e55f885d2cb8fdbff3fd1a03bcfc6bb4c", + "commit": "87b7642f405cddfcb39c083557dfa137f579761f", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.7", + "autorest": "3.10.2", "use": [ - "@autorest/python@6.13.7", + "@autorest/python@6.17.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/app/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/app/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.17.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/app/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py index 5f29dcf6e118..bb3a324b2a38 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py @@ -26,22 +26,29 @@ class ContainerAppsAPIClientConfiguration: # pylint: disable=too-many-instance- :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-11-02-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-08-02-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-11-02-preview") + def __init__( + self, credential: "TokenCredential", session_pool_name: str, subscription_id: str, **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2024-08-02-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") + if session_pool_name is None: + raise ValueError("Parameter 'session_pool_name' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") self.credential = credential + self.session_pool_name = session_pool_name self.subscription_id = subscription_id self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py index 36b82db88f46..e8790b95442c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -32,20 +33,28 @@ ConnectedEnvironmentsStoragesOperations, ContainerAppsAPIClientOperationsMixin, ContainerAppsAuthConfigsOperations, + ContainerAppsBuildsByContainerAppOperations, + ContainerAppsBuildsOperations, ContainerAppsDiagnosticsOperations, ContainerAppsOperations, + ContainerAppsPatchesOperations, ContainerAppsRevisionReplicasOperations, ContainerAppsRevisionsOperations, + ContainerAppsSessionPoolsOperations, ContainerAppsSourceControlsOperations, DaprComponentResiliencyPoliciesOperations, DaprComponentsOperations, DaprSubscriptionsOperations, DotNetComponentsOperations, + FunctionsExtensionOperations, JavaComponentsOperations, JobsExecutionsOperations, JobsOperations, + LogicAppsOperations, ManagedCertificatesOperations, ManagedEnvironmentDiagnosticsOperations, + ManagedEnvironmentPrivateEndpointConnectionsOperations, + ManagedEnvironmentPrivateLinkResourcesOperations, ManagedEnvironmentUsagesOperations, ManagedEnvironmentsDiagnosticsOperations, ManagedEnvironmentsOperations, @@ -63,7 +72,9 @@ class ContainerAppsAPIClient( ContainerAppsAPIClientOperationsMixin ): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """ContainerAppsAPIClient. + """Functions is an extension resource to revisions and the api listed is used to proxy the call + from Web RP to the function app's host process, this api is not exposed to users and only Web + RP is allowed to invoke functions extension resource. :ivar app_resiliency: AppResiliencyOperations operations :vartype app_resiliency: azure.mgmt.appcontainers.operations.AppResiliencyOperations @@ -100,6 +111,16 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.operations.ConnectedEnvironmentsStoragesOperations :ivar container_apps: ContainerAppsOperations operations :vartype container_apps: azure.mgmt.appcontainers.operations.ContainerAppsOperations + :ivar container_apps_builds_by_container_app: ContainerAppsBuildsByContainerAppOperations + operations + :vartype container_apps_builds_by_container_app: + azure.mgmt.appcontainers.operations.ContainerAppsBuildsByContainerAppOperations + :ivar container_apps_builds: ContainerAppsBuildsOperations operations + :vartype container_apps_builds: + azure.mgmt.appcontainers.operations.ContainerAppsBuildsOperations + :ivar container_apps_patches: ContainerAppsPatchesOperations operations + :vartype container_apps_patches: + azure.mgmt.appcontainers.operations.ContainerAppsPatchesOperations :ivar container_apps_revisions: ContainerAppsRevisionsOperations operations :vartype container_apps_revisions: azure.mgmt.appcontainers.operations.ContainerAppsRevisionsOperations @@ -117,10 +138,18 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.operations.ManagedEnvironmentsDiagnosticsOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.appcontainers.operations.JobsOperations + :ivar dot_net_components: DotNetComponentsOperations operations + :vartype dot_net_components: azure.mgmt.appcontainers.operations.DotNetComponentsOperations + :ivar functions_extension: FunctionsExtensionOperations operations + :vartype functions_extension: azure.mgmt.appcontainers.operations.FunctionsExtensionOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appcontainers.operations.Operations + :ivar java_components: JavaComponentsOperations operations + :vartype java_components: azure.mgmt.appcontainers.operations.JavaComponentsOperations :ivar jobs_executions: JobsExecutionsOperations operations :vartype jobs_executions: azure.mgmt.appcontainers.operations.JobsExecutionsOperations + :ivar logic_apps: LogicAppsOperations operations + :vartype logic_apps: azure.mgmt.appcontainers.operations.LogicAppsOperations :ivar managed_environments: ManagedEnvironmentsOperations operations :vartype managed_environments: azure.mgmt.appcontainers.operations.ManagedEnvironmentsOperations @@ -131,6 +160,14 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.operations.ManagedCertificatesOperations :ivar namespaces: NamespacesOperations operations :vartype namespaces: azure.mgmt.appcontainers.operations.NamespacesOperations + :ivar managed_environment_private_endpoint_connections: + ManagedEnvironmentPrivateEndpointConnectionsOperations operations + :vartype managed_environment_private_endpoint_connections: + azure.mgmt.appcontainers.operations.ManagedEnvironmentPrivateEndpointConnectionsOperations + :ivar managed_environment_private_link_resources: + ManagedEnvironmentPrivateLinkResourcesOperations operations + :vartype managed_environment_private_link_resources: + azure.mgmt.appcontainers.operations.ManagedEnvironmentPrivateLinkResourcesOperations :ivar dapr_component_resiliency_policies: DaprComponentResiliencyPoliciesOperations operations :vartype dapr_component_resiliency_policies: azure.mgmt.appcontainers.operations.DaprComponentResiliencyPoliciesOperations @@ -141,6 +178,9 @@ class ContainerAppsAPIClient( :ivar managed_environments_storages: ManagedEnvironmentsStoragesOperations operations :vartype managed_environments_storages: azure.mgmt.appcontainers.operations.ManagedEnvironmentsStoragesOperations + :ivar container_apps_session_pools: ContainerAppsSessionPoolsOperations operations + :vartype container_apps_session_pools: + azure.mgmt.appcontainers.operations.ContainerAppsSessionPoolsOperations :ivar container_apps_source_controls: ContainerAppsSourceControlsOperations operations :vartype container_apps_source_controls: azure.mgmt.appcontainers.operations.ContainerAppsSourceControlsOperations @@ -149,17 +189,15 @@ class ContainerAppsAPIClient( :ivar managed_environment_usages: ManagedEnvironmentUsagesOperations operations :vartype managed_environment_usages: azure.mgmt.appcontainers.operations.ManagedEnvironmentUsagesOperations - :ivar java_components: JavaComponentsOperations operations - :vartype java_components: azure.mgmt.appcontainers.operations.JavaComponentsOperations - :ivar dot_net_components: DotNetComponentsOperations operations - :vartype dot_net_components: azure.mgmt.appcontainers.operations.DotNetComponentsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-11-02-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-08-02-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 @@ -169,12 +207,13 @@ class ContainerAppsAPIClient( def __init__( self, credential: "TokenCredential", + session_pool_name: str, subscription_id: str, base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: self._config = ContainerAppsAPIClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, session_pool_name=session_pool_name, subscription_id=subscription_id, **kwargs ) _policies = kwargs.pop("policies", None) if _policies is None: @@ -227,6 +266,15 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.container_apps = ContainerAppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_apps_builds_by_container_app = ContainerAppsBuildsByContainerAppOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_builds = ContainerAppsBuildsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_patches = ContainerAppsPatchesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.container_apps_revisions = ContainerAppsRevisionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -243,8 +291,16 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dot_net_components = DotNetComponentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.functions_extension = FunctionsExtensionOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.java_components = JavaComponentsOperations(self._client, self._config, self._serialize, self._deserialize) self.jobs_executions = JobsExecutionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.logic_apps = LogicAppsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_environments = ManagedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -253,6 +309,12 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_environment_private_endpoint_connections = ManagedEnvironmentPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_environment_private_link_resources = ManagedEnvironmentPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.dapr_component_resiliency_policies = DaprComponentResiliencyPoliciesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -263,6 +325,9 @@ def __init__( self.managed_environments_storages = ManagedEnvironmentsStoragesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.container_apps_session_pools = ContainerAppsSessionPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.container_apps_source_controls = ContainerAppsSourceControlsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -270,10 +335,6 @@ def __init__( self.managed_environment_usages = ManagedEnvironmentUsagesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.java_components = JavaComponentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.dot_net_components = DotNetComponentsOperations( - self._client, self._config, self._serialize, self._deserialize - ) def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -300,7 +361,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "ContainerAppsAPIClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_patch.py index f99e77fef986..17dbc073e01b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_patch.py @@ -25,6 +25,7 @@ # # -------------------------------------------------------------------------- + # This file 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 def patch_sdk(): diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_serialization.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_serialization.py index 2f781d740827..8139854b97bb 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_serialization.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_serialization.py @@ -144,6 +144,8 @@ def _json_attemp(data): # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -1441,7 +1443,7 @@ def _deserialize(self, target_obj, data): elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_vendor.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_vendor.py index 7f8fe378e76c..869b8cac8a5e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_vendor.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import ContainerAppsAPIClientConfiguration if TYPE_CHECKING: @@ -19,14 +17,6 @@ from ._serialization import Deserializer, Serializer -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - class ContainerAppsAPIClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py index 48b05f9c489c..e5754a47ce68 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py index 079bed7fb5be..de4375dbc0a6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py @@ -26,22 +26,29 @@ class ContainerAppsAPIClientConfiguration: # pylint: disable=too-many-instance- :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-11-02-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-08-02-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-11-02-preview") + def __init__( + self, credential: "AsyncTokenCredential", session_pool_name: str, subscription_id: str, **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2024-08-02-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") + if session_pool_name is None: + raise ValueError("Parameter 'session_pool_name' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") self.credential = credential + self.session_pool_name = session_pool_name self.subscription_id = subscription_id self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py index 33a91fe8d5ac..2e0c4c1ca300 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -32,20 +33,28 @@ ConnectedEnvironmentsStoragesOperations, ContainerAppsAPIClientOperationsMixin, ContainerAppsAuthConfigsOperations, + ContainerAppsBuildsByContainerAppOperations, + ContainerAppsBuildsOperations, ContainerAppsDiagnosticsOperations, ContainerAppsOperations, + ContainerAppsPatchesOperations, ContainerAppsRevisionReplicasOperations, ContainerAppsRevisionsOperations, + ContainerAppsSessionPoolsOperations, ContainerAppsSourceControlsOperations, DaprComponentResiliencyPoliciesOperations, DaprComponentsOperations, DaprSubscriptionsOperations, DotNetComponentsOperations, + FunctionsExtensionOperations, JavaComponentsOperations, JobsExecutionsOperations, JobsOperations, + LogicAppsOperations, ManagedCertificatesOperations, ManagedEnvironmentDiagnosticsOperations, + ManagedEnvironmentPrivateEndpointConnectionsOperations, + ManagedEnvironmentPrivateLinkResourcesOperations, ManagedEnvironmentUsagesOperations, ManagedEnvironmentsDiagnosticsOperations, ManagedEnvironmentsOperations, @@ -63,7 +72,9 @@ class ContainerAppsAPIClient( ContainerAppsAPIClientOperationsMixin ): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """ContainerAppsAPIClient. + """Functions is an extension resource to revisions and the api listed is used to proxy the call + from Web RP to the function app's host process, this api is not exposed to users and only Web + RP is allowed to invoke functions extension resource. :ivar app_resiliency: AppResiliencyOperations operations :vartype app_resiliency: azure.mgmt.appcontainers.aio.operations.AppResiliencyOperations @@ -100,6 +111,16 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.aio.operations.ConnectedEnvironmentsStoragesOperations :ivar container_apps: ContainerAppsOperations operations :vartype container_apps: azure.mgmt.appcontainers.aio.operations.ContainerAppsOperations + :ivar container_apps_builds_by_container_app: ContainerAppsBuildsByContainerAppOperations + operations + :vartype container_apps_builds_by_container_app: + azure.mgmt.appcontainers.aio.operations.ContainerAppsBuildsByContainerAppOperations + :ivar container_apps_builds: ContainerAppsBuildsOperations operations + :vartype container_apps_builds: + azure.mgmt.appcontainers.aio.operations.ContainerAppsBuildsOperations + :ivar container_apps_patches: ContainerAppsPatchesOperations operations + :vartype container_apps_patches: + azure.mgmt.appcontainers.aio.operations.ContainerAppsPatchesOperations :ivar container_apps_revisions: ContainerAppsRevisionsOperations operations :vartype container_apps_revisions: azure.mgmt.appcontainers.aio.operations.ContainerAppsRevisionsOperations @@ -117,10 +138,19 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsDiagnosticsOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.appcontainers.aio.operations.JobsOperations + :ivar dot_net_components: DotNetComponentsOperations operations + :vartype dot_net_components: azure.mgmt.appcontainers.aio.operations.DotNetComponentsOperations + :ivar functions_extension: FunctionsExtensionOperations operations + :vartype functions_extension: + azure.mgmt.appcontainers.aio.operations.FunctionsExtensionOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appcontainers.aio.operations.Operations + :ivar java_components: JavaComponentsOperations operations + :vartype java_components: azure.mgmt.appcontainers.aio.operations.JavaComponentsOperations :ivar jobs_executions: JobsExecutionsOperations operations :vartype jobs_executions: azure.mgmt.appcontainers.aio.operations.JobsExecutionsOperations + :ivar logic_apps: LogicAppsOperations operations + :vartype logic_apps: azure.mgmt.appcontainers.aio.operations.LogicAppsOperations :ivar managed_environments: ManagedEnvironmentsOperations operations :vartype managed_environments: azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsOperations @@ -131,6 +161,14 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.aio.operations.ManagedCertificatesOperations :ivar namespaces: NamespacesOperations operations :vartype namespaces: azure.mgmt.appcontainers.aio.operations.NamespacesOperations + :ivar managed_environment_private_endpoint_connections: + ManagedEnvironmentPrivateEndpointConnectionsOperations operations + :vartype managed_environment_private_endpoint_connections: + azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentPrivateEndpointConnectionsOperations + :ivar managed_environment_private_link_resources: + ManagedEnvironmentPrivateLinkResourcesOperations operations + :vartype managed_environment_private_link_resources: + azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentPrivateLinkResourcesOperations :ivar dapr_component_resiliency_policies: DaprComponentResiliencyPoliciesOperations operations :vartype dapr_component_resiliency_policies: azure.mgmt.appcontainers.aio.operations.DaprComponentResiliencyPoliciesOperations @@ -142,6 +180,9 @@ class ContainerAppsAPIClient( :ivar managed_environments_storages: ManagedEnvironmentsStoragesOperations operations :vartype managed_environments_storages: azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsStoragesOperations + :ivar container_apps_session_pools: ContainerAppsSessionPoolsOperations operations + :vartype container_apps_session_pools: + azure.mgmt.appcontainers.aio.operations.ContainerAppsSessionPoolsOperations :ivar container_apps_source_controls: ContainerAppsSourceControlsOperations operations :vartype container_apps_source_controls: azure.mgmt.appcontainers.aio.operations.ContainerAppsSourceControlsOperations @@ -150,17 +191,15 @@ class ContainerAppsAPIClient( :ivar managed_environment_usages: ManagedEnvironmentUsagesOperations operations :vartype managed_environment_usages: azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentUsagesOperations - :ivar java_components: JavaComponentsOperations operations - :vartype java_components: azure.mgmt.appcontainers.aio.operations.JavaComponentsOperations - :ivar dot_net_components: DotNetComponentsOperations operations - :vartype dot_net_components: azure.mgmt.appcontainers.aio.operations.DotNetComponentsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-11-02-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-08-02-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 @@ -170,12 +209,13 @@ class ContainerAppsAPIClient( def __init__( self, credential: "AsyncTokenCredential", + session_pool_name: str, subscription_id: str, base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: self._config = ContainerAppsAPIClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, session_pool_name=session_pool_name, subscription_id=subscription_id, **kwargs ) _policies = kwargs.pop("policies", None) if _policies is None: @@ -228,6 +268,15 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.container_apps = ContainerAppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_apps_builds_by_container_app = ContainerAppsBuildsByContainerAppOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_builds = ContainerAppsBuildsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_patches = ContainerAppsPatchesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.container_apps_revisions = ContainerAppsRevisionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -244,8 +293,16 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dot_net_components = DotNetComponentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.functions_extension = FunctionsExtensionOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.java_components = JavaComponentsOperations(self._client, self._config, self._serialize, self._deserialize) self.jobs_executions = JobsExecutionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.logic_apps = LogicAppsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_environments = ManagedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -254,6 +311,12 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_environment_private_endpoint_connections = ManagedEnvironmentPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_environment_private_link_resources = ManagedEnvironmentPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.dapr_component_resiliency_policies = DaprComponentResiliencyPoliciesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -264,6 +327,9 @@ def __init__( self.managed_environments_storages = ManagedEnvironmentsStoragesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.container_apps_session_pools = ContainerAppsSessionPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.container_apps_source_controls = ContainerAppsSourceControlsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -271,10 +337,6 @@ def __init__( self.managed_environment_usages = ManagedEnvironmentUsagesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.java_components = JavaComponentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.dot_net_components = DotNetComponentsOperations( - self._client, self._config, self._serialize, self._deserialize - ) def _send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any @@ -303,7 +365,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "ContainerAppsAPIClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_patch.py index f99e77fef986..17dbc073e01b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_patch.py @@ -25,6 +25,7 @@ # # -------------------------------------------------------------------------- + # This file 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 def patch_sdk(): diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_vendor.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_vendor.py index e2d7a96f702c..4345e924ce42 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_vendor.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import ContainerAppsAPIClientConfiguration if TYPE_CHECKING: diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py index 27819202ef8e..f105aaf0a686 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py @@ -19,28 +19,38 @@ from ._connected_environments_dapr_components_operations import ConnectedEnvironmentsDaprComponentsOperations from ._connected_environments_storages_operations import ConnectedEnvironmentsStoragesOperations from ._container_apps_operations import ContainerAppsOperations +from ._container_apps_builds_by_container_app_operations import ContainerAppsBuildsByContainerAppOperations +from ._container_apps_builds_operations import ContainerAppsBuildsOperations +from ._container_apps_patches_operations import ContainerAppsPatchesOperations from ._container_apps_revisions_operations import ContainerAppsRevisionsOperations from ._container_apps_revision_replicas_operations import ContainerAppsRevisionReplicasOperations from ._container_apps_diagnostics_operations import ContainerAppsDiagnosticsOperations from ._managed_environment_diagnostics_operations import ManagedEnvironmentDiagnosticsOperations from ._managed_environments_diagnostics_operations import ManagedEnvironmentsDiagnosticsOperations from ._jobs_operations import JobsOperations +from ._dot_net_components_operations import DotNetComponentsOperations +from ._functions_extension_operations import FunctionsExtensionOperations from ._operations import Operations +from ._java_components_operations import JavaComponentsOperations from ._jobs_executions_operations import JobsExecutionsOperations from ._container_apps_api_client_operations import ContainerAppsAPIClientOperationsMixin +from ._logic_apps_operations import LogicAppsOperations from ._managed_environments_operations import ManagedEnvironmentsOperations from ._certificates_operations import CertificatesOperations from ._managed_certificates_operations import ManagedCertificatesOperations from ._namespaces_operations import NamespacesOperations +from ._managed_environment_private_endpoint_connections_operations import ( + ManagedEnvironmentPrivateEndpointConnectionsOperations, +) +from ._managed_environment_private_link_resources_operations import ManagedEnvironmentPrivateLinkResourcesOperations from ._dapr_component_resiliency_policies_operations import DaprComponentResiliencyPoliciesOperations from ._dapr_components_operations import DaprComponentsOperations from ._dapr_subscriptions_operations import DaprSubscriptionsOperations from ._managed_environments_storages_operations import ManagedEnvironmentsStoragesOperations +from ._container_apps_session_pools_operations import ContainerAppsSessionPoolsOperations from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations from ._usages_operations import UsagesOperations from ._managed_environment_usages_operations import ManagedEnvironmentUsagesOperations -from ._java_components_operations import JavaComponentsOperations -from ._dot_net_components_operations import DotNetComponentsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -60,28 +70,36 @@ "ConnectedEnvironmentsDaprComponentsOperations", "ConnectedEnvironmentsStoragesOperations", "ContainerAppsOperations", + "ContainerAppsBuildsByContainerAppOperations", + "ContainerAppsBuildsOperations", + "ContainerAppsPatchesOperations", "ContainerAppsRevisionsOperations", "ContainerAppsRevisionReplicasOperations", "ContainerAppsDiagnosticsOperations", "ManagedEnvironmentDiagnosticsOperations", "ManagedEnvironmentsDiagnosticsOperations", "JobsOperations", + "DotNetComponentsOperations", + "FunctionsExtensionOperations", "Operations", + "JavaComponentsOperations", "JobsExecutionsOperations", "ContainerAppsAPIClientOperationsMixin", + "LogicAppsOperations", "ManagedEnvironmentsOperations", "CertificatesOperations", "ManagedCertificatesOperations", "NamespacesOperations", + "ManagedEnvironmentPrivateEndpointConnectionsOperations", + "ManagedEnvironmentPrivateLinkResourcesOperations", "DaprComponentResiliencyPoliciesOperations", "DaprComponentsOperations", "DaprSubscriptionsOperations", "ManagedEnvironmentsStoragesOperations", + "ContainerAppsSessionPoolsOperations", "ContainerAppsSourceControlsOperations", "UsagesOperations", "ManagedEnvironmentUsagesOperations", - "JavaComponentsOperations", - "DotNetComponentsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_app_resiliency_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_app_resiliency_operations.py index 6e7c5b2e63bd..a9316b0917d0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_app_resiliency_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_app_resiliency_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._app_resiliency_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +37,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -152,7 +155,7 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.AppResiliency :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -187,7 +190,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -202,11 +204,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppResiliency", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppResiliency", pipeline_response) + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -304,7 +302,7 @@ async def update( :rtype: ~azure.mgmt.appcontainers.models.AppResiliency :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -339,7 +337,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +351,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppResiliency", pipeline_response) + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -380,7 +377,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -403,7 +400,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -438,7 +434,7 @@ async def get(self, resource_group_name: str, app_name: str, name: str, **kwargs :rtype: ~azure.mgmt.appcontainers.models.AppResiliency :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -461,7 +457,6 @@ async def get(self, resource_group_name: str, app_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -476,7 +471,7 @@ async def get(self, resource_group_name: str, app_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppResiliency", pipeline_response) + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -504,7 +499,7 @@ def list(self, resource_group_name: str, app_name: str, **kwargs: Any) -> AsyncI api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AppResiliencyCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -523,7 +518,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -539,7 +533,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py index e6c4bdb1ac4d..d4e268c8e17e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,17 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._available_workload_profiles_operations import build_get_request from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +76,7 @@ def get(self, location: str, **kwargs: Any) -> AsyncIterable["_models.AvailableW api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailableWorkloadProfilesCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +94,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -107,7 +109,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_billing_meters_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_billing_meters_operations.py index c4cfa44feb19..5fb56bf3db61 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_billing_meters_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_billing_meters_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,17 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._billing_meters_operations import build_get_request from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +66,7 @@ async def get(self, location: str, **kwargs: Any) -> _models.BillingMeterCollect :rtype: ~azure.mgmt.appcontainers.models.BillingMeterCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -84,7 +87,6 @@ async def get(self, location: str, **kwargs: Any) -> _models.BillingMeterCollect headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -99,7 +101,7 @@ async def get(self, location: str, **kwargs: Any) -> _models.BillingMeterCollect error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BillingMeterCollection", pipeline_response) + deserialized = self._deserialize("BillingMeterCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_build_auth_token_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_build_auth_token_operations.py index 2fb05c7a410f..79ebb981e1b0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_build_auth_token_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_build_auth_token_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,17 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._build_auth_token_operations import build_list_request from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +71,7 @@ async def list( :rtype: ~azure.mgmt.appcontainers.models.BuildToken :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +94,6 @@ async def list( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -106,7 +108,7 @@ async def list( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BuildToken", pipeline_response) + deserialized = self._deserialize("BuildToken", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py index 1caf40d02969..45a9a42625d7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._builders_operations import ( build_create_or_update_request, build_delete_request, @@ -41,6 +42,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +84,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.BuilderR api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,7 +101,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -112,7 +116,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -162,7 +165,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -180,7 +183,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -196,7 +198,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -239,7 +240,7 @@ async def get(self, resource_group_name: str, builder_name: str, **kwargs: Any) :rtype: ~azure.mgmt.appcontainers.models.BuilderResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -261,7 +262,6 @@ async def get(self, resource_group_name: str, builder_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -276,7 +276,7 @@ async def get(self, resource_group_name: str, builder_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BuilderResource", pipeline_response) + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -289,8 +289,8 @@ async def _create_or_update_initial( builder_name: str, builder_envelope: Union[_models.BuilderResource, IO[bytes]], **kwargs: Any - ) -> _models.BuilderResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -303,7 +303,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -324,10 +324,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -335,20 +335,21 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("BuilderResource", pipeline_response) - if response.status_code == 201: response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("BuilderResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -455,10 +456,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response) + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -489,8 +491,8 @@ async def _update_initial( builder_name: str, builder_envelope: Union[_models.BuilderResourceUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.BuilderResource]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -503,7 +505,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.BuilderResource]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -524,10 +526,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -535,18 +537,20 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("BuilderResource", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -652,10 +656,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response) + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -679,10 +684,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, builder_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -694,7 +697,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -704,10 +707,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -715,6 +718,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -723,8 +730,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -748,7 +759,7 @@ async def begin_delete(self, resource_group_name: str, builder_name: str, **kwar lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, builder_name=builder_name, api_version=api_version, @@ -757,6 +768,7 @@ async def begin_delete(self, resource_group_name: str, builder_name: str, **kwar params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_by_builder_resource_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_by_builder_resource_operations.py index ae9dcaa12757..42b6a6f27ac1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_by_builder_resource_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_by_builder_resource_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,17 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._builds_by_builder_resource_operations import build_list_request from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +77,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +96,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -109,7 +111,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py index 7ad0aa009496..2c45f9e053a2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,22 +16,26 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._builds_operations import build_create_or_update_request, build_delete_request, build_get_request from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +76,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.BuildResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -94,7 +99,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +113,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BuildResource", pipeline_response) + deserialized = self._deserialize("BuildResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -123,8 +127,8 @@ async def _create_or_update_initial( build_name: str, build_envelope: Union[_models.BuildResource, IO[bytes]], **kwargs: Any - ) -> _models.BuildResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -137,7 +141,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -159,10 +163,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -170,20 +174,21 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("BuildResource", pipeline_response) - if response.status_code == 201: response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("BuildResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -300,10 +305,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildResource", pipeline_response) + deserialized = self._deserialize("BuildResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -328,10 +334,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -343,7 +349,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -354,10 +360,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -365,6 +371,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -373,8 +383,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -402,7 +416,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, builder_name=builder_name, build_name=build_name, @@ -412,6 +426,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py index 65ea9ecb3f08..08246e05e1fa 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +37,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -168,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -206,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -304,7 +304,7 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -342,7 +342,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -357,7 +356,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -383,7 +382,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -406,7 +405,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -515,7 +513,7 @@ async def update( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -550,7 +548,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -565,7 +562,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_certificates_operations.py index 55f2628d5fd2..b54c47d0ef4a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_certificates_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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, @@ -38,6 +37,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -168,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -206,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -304,7 +304,7 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -342,7 +342,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -357,7 +356,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -383,7 +382,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -406,7 +405,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -515,7 +513,7 @@ async def update( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -550,7 +548,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -565,7 +562,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_dapr_components_operations.py index 811b77b37720..fbf413a22135 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_dapr_components_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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, @@ -38,6 +37,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprComponentsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -168,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -206,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response) + deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -304,7 +304,7 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -339,7 +339,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +353,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response) + deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -380,7 +379,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -403,7 +402,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -440,7 +438,7 @@ async def list_secrets( :rtype: ~azure.mgmt.appcontainers.models.DaprSecretsCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -463,7 +461,6 @@ async def list_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -478,7 +475,7 @@ async def list_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprSecretsCollection", pipeline_response) + deserialized = self._deserialize("DaprSecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py index c10450558429..6191edaee4a3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ 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, @@ -42,6 +43,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +88,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Connecte api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectedEnvironmentCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -116,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -167,7 +170,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectedEnvironmentCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -185,7 +188,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -201,7 +203,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -246,7 +247,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -268,7 +269,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -283,7 +283,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -296,8 +296,8 @@ async def _create_or_update_initial( connected_environment_name: str, environment_envelope: Union[_models.ConnectedEnvironment, IO[bytes]], **kwargs: Any - ) -> _models.ConnectedEnvironment: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -310,7 +310,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConnectedEnvironment] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -331,10 +331,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -342,15 +342,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, 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) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,10 +460,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -488,10 +489,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, connected_environment_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -503,7 +504,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -513,10 +514,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -524,6 +525,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -532,8 +537,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -561,7 +570,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, api_version=api_version, @@ -570,6 +579,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -610,7 +620,7 @@ async def update( :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -632,7 +642,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -647,7 +656,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -740,7 +749,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -774,7 +783,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -789,7 +797,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_storages_operations.py index adb4dbd26349..70da937ebbc0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_storages_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from 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, @@ -34,6 +33,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +77,7 @@ async def list( :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStoragesCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,7 +99,6 @@ async def list( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -111,7 +113,7 @@ async def list( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironmentStoragesCollection", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironmentStoragesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -137,7 +139,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -160,7 +162,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -175,7 +176,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -274,7 +275,7 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -309,7 +310,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -324,7 +324,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -350,7 +350,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -373,7 +373,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_api_client_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_api_client_operations.py index d7aa8aec4ac6..20b35af8390f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_api_client_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_api_client_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,25 +18,28 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._container_apps_api_client_operations import ( build_get_custom_domain_verification_id_request, build_job_execution_request, ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ContainerAppsAPIClientOperationsMixin(ContainerAppsAPIClientMixinABC): + @distributed_trace_async async def job_execution( self, resource_group_name: str, job_name: str, job_execution_name: str, **kwargs: Any @@ -55,7 +59,7 @@ async def job_execution( :rtype: ~azure.mgmt.appcontainers.models.JobExecution :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -78,7 +82,6 @@ async def job_execution( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -93,7 +96,7 @@ async def job_execution( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("JobExecution", pipeline_response) + deserialized = self._deserialize("JobExecution", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -108,7 +111,7 @@ async def get_custom_domain_verification_id(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -128,7 +131,6 @@ async def get_custom_domain_verification_id(self, **kwargs: Any) -> str: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -143,7 +145,7 @@ async def get_custom_domain_verification_id(self, **kwargs: Any) -> str: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py index 8f13f8bbeac3..25573af0b0d6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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_auth_configs_operations import ( build_create_or_update_request, build_delete_request, @@ -37,6 +36,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +86,7 @@ def list_by_container_app( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AuthConfigCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -102,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -167,7 +168,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.AuthConfig :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -190,7 +191,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -205,7 +205,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AuthConfig", pipeline_response) + deserialized = self._deserialize("AuthConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -303,7 +303,7 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.AuthConfig :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -338,7 +338,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -353,7 +352,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AuthConfig", pipeline_response) + deserialized = self._deserialize("AuthConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -379,7 +378,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -402,7 +401,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_by_container_app_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_by_container_app_operations.py new file mode 100644 index 000000000000..3865b0f23855 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_by_container_app_operations.py @@ -0,0 +1,143 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._container_apps_builds_by_container_app_operations import build_list_request +from .._vendor import ContainerAppsAPIClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContainerAppsBuildsByContainerAppOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_builds_by_container_app` 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, container_app_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ContainerAppsBuildResource"]: + """List Container Apps Build resources by Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :return: An iterator like instance of either ContainerAppsBuildResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ContainerAppsBuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsBuildCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ContainerAppsBuildCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_operations.py new file mode 100644 index 000000000000..9e2b02d2b03d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_operations.py @@ -0,0 +1,236 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._container_apps_builds_operations import build_delete_request, build_get_request +from .._vendor import ContainerAppsAPIClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContainerAppsBuildsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_builds` 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( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> _models.ContainerAppsBuildResource: + """Get a Container Apps Build resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: ContainerAppsBuildResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ContainerAppsBuildResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsBuildResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ContainerAppsBuildResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Container Apps Build resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py index b57a2ea40dd9..05113d05b56b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar, cast import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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, @@ -37,6 +36,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +87,7 @@ def list_detectors( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DiagnosticsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -168,7 +169,7 @@ async def get_detector( :rtype: ~azure.mgmt.appcontainers.models.Diagnostics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +192,6 @@ async def get_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -206,7 +206,7 @@ async def get_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Diagnostics", pipeline_response) + deserialized = self._deserialize("Diagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -238,7 +238,7 @@ def list_revisions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RevisionCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +258,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -274,7 +273,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -323,7 +321,7 @@ async def get_revision( :rtype: ~azure.mgmt.appcontainers.models.Revision :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +344,6 @@ async def get_revision( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -361,7 +358,7 @@ async def get_revision( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Revision", pipeline_response) + deserialized = self._deserialize("Revision", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -383,11 +380,14 @@ async def get_root(self, resource_group_name: str, container_app_name: str, **kw :rtype: ~azure.mgmt.appcontainers.models.ContainerApp :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 404: lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + 404: cast( + Type[HttpResponseError], + lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -405,7 +405,6 @@ async def get_root(self, resource_group_name: str, container_app_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -420,7 +419,7 @@ async def get_root(self, resource_group_name: str, container_app_name: str, **kw error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py index 7cc1056bca9f..73af128a7a96 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ 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, build_delete_request, @@ -46,6 +47,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +90,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Containe api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContainerAppCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -102,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -167,7 +170,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContainerAppCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -185,7 +188,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -201,7 +203,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -246,11 +247,14 @@ async def get(self, resource_group_name: str, container_app_name: str, **kwargs: :rtype: ~azure.mgmt.appcontainers.models.ContainerApp :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 404: lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + 404: cast( + Type[HttpResponseError], + lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -268,7 +272,6 @@ async def get(self, resource_group_name: str, container_app_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -283,7 +286,7 @@ async def get(self, resource_group_name: str, container_app_name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -296,8 +299,8 @@ async def _create_or_update_initial( container_app_name: str, container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any - ) -> _models.ContainerApp: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -310,7 +313,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerApp] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -331,10 +334,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -342,15 +345,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -463,10 +466,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -491,10 +495,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, container_app_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -506,7 +510,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -516,10 +520,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -527,6 +531,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -535,8 +543,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -564,7 +576,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, container_app_name=container_app_name, api_version=api_version, @@ -573,6 +585,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -602,8 +615,8 @@ async def _update_initial( container_app_name: str, container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ContainerApp]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -616,7 +629,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ContainerApp]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -637,10 +650,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -648,18 +661,20 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -771,10 +786,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -815,7 +831,7 @@ async def list_custom_host_name_analysis( :rtype: ~azure.mgmt.appcontainers.models.CustomHostnameAnalysisResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -838,7 +854,6 @@ async def list_custom_host_name_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -853,7 +868,7 @@ async def list_custom_host_name_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -877,7 +892,7 @@ async def list_secrets( :rtype: ~azure.mgmt.appcontainers.models.SecretsCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -899,7 +914,6 @@ async def list_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -914,7 +928,7 @@ async def list_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecretsCollection", pipeline_response) + deserialized = self._deserialize("SecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -938,11 +952,14 @@ async def get_auth_token( :rtype: ~azure.mgmt.appcontainers.models.ContainerAppAuthToken :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 404: lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + 404: cast( + Type[HttpResponseError], + lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -960,7 +977,6 @@ async def get_auth_token( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -975,7 +991,7 @@ async def get_auth_token( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContainerAppAuthToken", pipeline_response) + deserialized = self._deserialize("ContainerAppAuthToken", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -984,8 +1000,8 @@ async def get_auth_token( async def _start_initial( self, resource_group_name: str, container_app_name: str, **kwargs: Any - ) -> Optional[_models.ContainerApp]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -997,7 +1013,7 @@ async def _start_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.ContainerApp]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_request( resource_group_name=resource_group_name, @@ -1007,10 +1023,10 @@ async def _start_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1018,18 +1034,20 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1071,10 +1089,11 @@ async def begin_start( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1100,8 +1119,8 @@ def get_long_running_output(pipeline_response): async def _stop_initial( self, resource_group_name: str, container_app_name: str, **kwargs: Any - ) -> Optional[_models.ContainerApp]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1113,7 +1132,7 @@ async def _stop_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.ContainerApp]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_request( resource_group_name=resource_group_name, @@ -1123,10 +1142,10 @@ async def _stop_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1134,18 +1153,20 @@ async def _stop_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1187,10 +1208,11 @@ async def begin_stop( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_patches_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_patches_operations.py new file mode 100644 index 000000000000..fa03c86a9716 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_patches_operations.py @@ -0,0 +1,665 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._container_apps_patches_operations import ( + build_apply_request, + build_delete_request, + build_get_request, + build_list_by_container_app_request, + build_skip_configure_request, +) +from .._vendor import ContainerAppsAPIClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContainerAppsPatchesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_patches` 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_container_app( + self, resource_group_name: str, container_app_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.ContainerAppsPatchResource"]: + """List Container Apps Patch resources by ContainerApp. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param filter: The filter to apply on the operation. For example, + $filter=properties/patchApplyStatus eq 'Succeeded'. Default value is None. + :type filter: str + :return: An iterator like instance of either ContainerAppsPatchResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PatchCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_container_app_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PatchCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> _models.ContainerAppsPatchResource: + """Get details for specific Container Apps Patch by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: ContainerAppsPatchResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ContainerAppsPatchResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsPatchResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ContainerAppsPatchResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete specific Container Apps Patch by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _skip_configure_initial( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: Union[_models.PatchSkipConfig, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(patch_skip_config, (IOBase, bytes)): + _content = patch_skip_config + else: + _json = self._serialize.body(patch_skip_config, "PatchSkipConfig") + + _request = build_skip_configure_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: _models.PatchSkipConfig, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Required. + :type patch_skip_config: ~azure.mgmt.appcontainers.models.PatchSkipConfig + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Required. + :type patch_skip_config: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: Union[_models.PatchSkipConfig, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Is either a PatchSkipConfig + type or a IO[bytes] type. Required. + :type patch_skip_config: ~azure.mgmt.appcontainers.models.PatchSkipConfig or IO[bytes] + :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._skip_configure_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + patch_skip_config=patch_skip_config, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _apply_initial( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_apply_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_apply( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ContainerAppsPatchResource]: + """Apply a Container Apps Patch resource with patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: An instance of AsyncLROPoller that returns either ContainerAppsPatchResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsPatchResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._apply_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ContainerAppsPatchResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ContainerAppsPatchResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ContainerAppsPatchResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py index dfb01b703978..7657e4cccb21 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,20 +18,22 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._container_apps_revision_replicas_operations import ( build_get_replica_request, build_list_replicas_request, ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +78,7 @@ async def get_replica( :rtype: ~azure.mgmt.appcontainers.models.Replica :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -99,7 +102,6 @@ async def get_replica( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -114,7 +116,7 @@ async def get_replica( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Replica", pipeline_response) + deserialized = self._deserialize("Replica", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -140,7 +142,7 @@ async def list_replicas( :rtype: ~azure.mgmt.appcontainers.models.ReplicaCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -163,7 +165,6 @@ async def list_replicas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -178,7 +179,7 @@ async def list_replicas( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ReplicaCollection", pipeline_response) + deserialized = self._deserialize("ReplicaCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py index ef844779c080..08a0379c363c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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_revisions_operations import ( build_activate_revision_request, build_deactivate_revision_request, @@ -37,6 +36,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +88,7 @@ def list_revisions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RevisionCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -105,7 +108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -121,7 +123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -170,7 +171,7 @@ async def get_revision( :rtype: ~azure.mgmt.appcontainers.models.Revision :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -193,7 +194,6 @@ async def get_revision( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -208,7 +208,7 @@ async def get_revision( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Revision", pipeline_response) + deserialized = self._deserialize("Revision", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -234,7 +234,7 @@ async def activate_revision( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -257,7 +257,6 @@ async def activate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -294,7 +293,7 @@ async def deactivate_revision( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -317,7 +316,6 @@ async def deactivate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +352,7 @@ async def restart_revision( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -377,7 +375,6 @@ async def restart_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_session_pools_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_session_pools_operations.py new file mode 100644 index 000000000000..6cad8706bddc --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_session_pools_operations.py @@ -0,0 +1,772 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._container_apps_session_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) +from .._vendor import ContainerAppsAPIClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContainerAppsSessionPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_session_pools` 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.SessionPool"]: + """Get the session pools in a given subscription. + + Get the session pools in a given subscription. + + :return: An iterator like instance of either SessionPool or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionPoolCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SessionPoolCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.SessionPool"]: + """Get the session pools in a given resource group of a subscription. + + Get the session pools in a given resource group of a subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either SessionPool or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionPoolCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SessionPoolCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, resource_group_name: str, **kwargs: Any) -> _models.SessionPool: + """Get the properties of a session pool. + + Get the properties of a session pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: SessionPool or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.SessionPool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionPool] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + session_pool_name=self._config.session_pool_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionPool", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, resource_group_name: str, session_pool_envelope: Union[_models.SessionPool, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_pool_envelope, (IOBase, bytes)): + _content = session_pool_envelope + else: + _json = self._serialize.body(session_pool_envelope, "SessionPool") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + session_pool_name=self._config.session_pool_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + session_pool_envelope: _models.SessionPool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionPool]: + """Create or update a session pool. + + Create or update a session pool with the given properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + session_pool_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionPool]: + """Create or update a session pool. + + Create or update a session pool with the given properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, session_pool_envelope: Union[_models.SessionPool, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.SessionPool]: + """Create or update a session pool. + + Create or update a session pool with the given properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_envelope: Properties used to create a session pool. Is either a SessionPool + type or a IO[bytes] type. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPool or IO[bytes] + :return: An instance of AsyncLROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SessionPool] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + session_pool_envelope=session_pool_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SessionPool", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.SessionPool].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SessionPool]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + session_pool_envelope: Union[_models.SessionPoolUpdatableProperties, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_pool_envelope, (IOBase, bytes)): + _content = session_pool_envelope + else: + _json = self._serialize.body(session_pool_envelope, "SessionPoolUpdatableProperties") + + _request = build_update_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + session_pool_name=self._config.session_pool_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + session_pool_envelope: _models.SessionPoolUpdatableProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionPool]: + """Update properties of a session pool. + + Patches a session pool using JSON merge patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPoolUpdatableProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + session_pool_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionPool]: + """Update properties of a session pool. + + Patches a session pool using JSON merge patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + session_pool_envelope: Union[_models.SessionPoolUpdatableProperties, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionPool]: + """Update properties of a session pool. + + Patches a session pool using JSON merge patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_envelope: Properties used to create a session pool. Is either a + SessionPoolUpdatableProperties type or a IO[bytes] type. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPoolUpdatableProperties or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SessionPool] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + session_pool_envelope=session_pool_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SessionPool", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.SessionPool].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SessionPool]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial(self, resource_group_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + session_pool_name=self._config.session_pool_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a session pool. + + Delete the session pool with the given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py index f478e444bdc1..6df5b2390a13 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._container_apps_source_controls_operations import ( build_create_or_update_request, build_delete_request, @@ -39,6 +40,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +90,7 @@ def list_by_container_app( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControlCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -104,7 +109,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -120,7 +124,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -169,7 +172,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.SourceControl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -192,7 +195,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -207,7 +209,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -219,10 +221,11 @@ async def _create_or_update_initial( resource_group_name: str, container_app_name: str, source_control_name: str, + x_ms_github_auxiliary: str, source_control_envelope: Union[_models.SourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SourceControl: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -235,7 +238,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -250,6 +253,7 @@ async def _create_or_update_initial( container_app_name=container_app_name, source_control_name=source_control_name, subscription_id=self._config.subscription_id, + x_ms_github_auxiliary=x_ms_github_auxiliary, api_version=api_version, content_type=content_type, json=_json, @@ -257,10 +261,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -268,15 +272,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -289,6 +293,7 @@ async def begin_create_or_update( resource_group_name: str, container_app_name: str, source_control_name: str, + x_ms_github_auxiliary: str, source_control_envelope: _models.SourceControl, *, content_type: str = "application/json", @@ -305,6 +310,8 @@ async def begin_create_or_update( :type container_app_name: str :param source_control_name: Name of the Container App SourceControl. Required. :type source_control_name: str + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Required. + :type x_ms_github_auxiliary: str :param source_control_envelope: Properties used to create a Container App SourceControl. Required. :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl @@ -323,6 +330,7 @@ async def begin_create_or_update( resource_group_name: str, container_app_name: str, source_control_name: str, + x_ms_github_auxiliary: str, source_control_envelope: IO[bytes], *, content_type: str = "application/json", @@ -339,6 +347,8 @@ async def begin_create_or_update( :type container_app_name: str :param source_control_name: Name of the Container App SourceControl. Required. :type source_control_name: str + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Required. + :type x_ms_github_auxiliary: str :param source_control_envelope: Properties used to create a Container App SourceControl. Required. :type source_control_envelope: IO[bytes] @@ -357,6 +367,7 @@ async def begin_create_or_update( resource_group_name: str, container_app_name: str, source_control_name: str, + x_ms_github_auxiliary: str, source_control_envelope: Union[_models.SourceControl, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.SourceControl]: @@ -371,6 +382,8 @@ async def begin_create_or_update( :type container_app_name: str :param source_control_name: Name of the Container App SourceControl. Required. :type source_control_name: str + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Required. + :type x_ms_github_auxiliary: str :param source_control_envelope: Properties used to create a Container App SourceControl. Is either a SourceControl type or a IO[bytes] type. Required. :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl or IO[bytes] @@ -393,6 +406,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, + x_ms_github_auxiliary=x_ms_github_auxiliary, source_control_envelope=source_control_envelope, api_version=api_version, content_type=content_type, @@ -401,10 +415,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -426,10 +441,17 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial( + self, + resource_group_name: str, + container_app_name: str, + source_control_name: str, + x_ms_github_auxiliary: str, + ignore_workflow_deletion_failure: Optional[bool] = None, + delete_workflow: Optional[bool] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -441,21 +463,24 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, subscription_id=self._config.subscription_id, + x_ms_github_auxiliary=x_ms_github_auxiliary, + ignore_workflow_deletion_failure=ignore_workflow_deletion_failure, + delete_workflow=delete_workflow, api_version=api_version, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -463,16 +488,31 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( - self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any + self, + resource_group_name: str, + container_app_name: str, + source_control_name: str, + x_ms_github_auxiliary: str, + ignore_workflow_deletion_failure: Optional[bool] = None, + delete_workflow: Optional[bool] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Delete a Container App SourceControl. @@ -485,6 +525,13 @@ async def begin_delete( :type container_app_name: str :param source_control_name: Name of the Container App SourceControl. Required. :type source_control_name: str + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Required. + :type x_ms_github_auxiliary: str + :param ignore_workflow_deletion_failure: Ignore Workflow Deletion Failure. Default value is + None. + :type ignore_workflow_deletion_failure: bool + :param delete_workflow: Delete workflow. Default value is None. + :type delete_workflow: bool :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: @@ -498,16 +545,20 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, + x_ms_github_auxiliary=x_ms_github_auxiliary, + ignore_workflow_deletion_failure=ignore_workflow_deletion_failure, + delete_workflow=delete_workflow, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_component_resiliency_policies_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_component_resiliency_policies_operations.py index 94f079c80704..3b599a169611 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_component_resiliency_policies_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_component_resiliency_policies_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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_component_resiliency_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -37,6 +36,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,7 +90,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprComponentResiliencyPoliciesCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -107,7 +110,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +125,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -174,7 +175,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -198,7 +199,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -213,7 +213,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -325,7 +325,7 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -361,7 +361,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -376,11 +375,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -408,7 +403,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -432,7 +427,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py index e083a4e5b17b..8af3e37345a3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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, @@ -38,6 +37,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprComponentsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -168,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -206,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response) + deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -304,7 +304,7 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -339,7 +339,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +353,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response) + deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -380,7 +379,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -403,7 +402,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -440,7 +438,7 @@ async def list_secrets( :rtype: ~azure.mgmt.appcontainers.models.DaprSecretsCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -463,7 +461,6 @@ async def list_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -478,7 +475,7 @@ async def list_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprSecretsCollection", pipeline_response) + deserialized = self._deserialize("DaprSecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_subscriptions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_subscriptions_operations.py index 54b4c58c6440..3f40065eb492 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_subscriptions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_subscriptions_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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_subscriptions_operations import ( build_create_or_update_request, build_delete_request, @@ -37,6 +36,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprSubscriptionsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -168,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -206,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprSubscription", pipeline_response) + deserialized = self._deserialize("DaprSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -305,7 +305,7 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -340,7 +340,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -355,11 +354,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DaprSubscription", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DaprSubscription", pipeline_response) + deserialized = self._deserialize("DaprSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -385,7 +380,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -408,7 +403,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dot_net_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dot_net_components_operations.py index a2794217eb51..77454a8a65ad 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dot_net_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dot_net_components_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._dot_net_components_operations import ( build_create_or_update_request, build_delete_request, @@ -40,6 +41,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,7 +92,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DotNetComponentsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -106,7 +111,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -122,7 +126,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -171,7 +174,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.DotNetComponent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -194,7 +197,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -209,7 +211,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DotNetComponent", pipeline_response) + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -223,8 +225,8 @@ async def _create_or_update_initial( name: str, dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], **kwargs: Any - ) -> _models.DotNetComponent: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -237,7 +239,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -259,10 +261,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -270,15 +272,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DotNetComponent", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DotNetComponent", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -401,10 +403,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DotNetComponent", pipeline_response) + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -436,8 +439,8 @@ async def _update_initial( name: str, dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], **kwargs: Any - ) -> Optional[_models.DotNetComponent]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -450,7 +453,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.DotNetComponent]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -472,10 +475,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -483,18 +486,20 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("DotNetComponent", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -616,10 +621,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DotNetComponent", pipeline_response) + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -641,10 +647,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -656,7 +662,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -667,10 +673,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -678,6 +684,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -686,8 +696,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -717,7 +731,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, environment_name=environment_name, name=name, @@ -727,6 +741,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_functions_extension_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_functions_extension_operations.py new file mode 100644 index 000000000000..24aebc5f55eb --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_functions_extension_operations.py @@ -0,0 +1,126 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._functions_extension_operations import build_invoke_functions_host_request +from .._vendor import ContainerAppsAPIClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class FunctionsExtensionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`functions_extension` 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 invoke_functions_host( + self, + resource_group_name: str, + container_app_name: str, + revision_name: str, + function_app_name: str, + **kwargs: Any + ) -> str: + """Proxies a Functions host call to the function app backed by the container app. + + Proxies a Functions host call to the function app backed by the container app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param revision_name: Name of the Container App Revision, the parent resource. Required. + :type revision_name: str + :param function_app_name: Name of the Function App, the extension resource. Required. + :type function_app_name: str + :return: str or the result of cls(response) + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_invoke_functions_host_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + revision_name=revision_name, + function_app_name=function_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("str", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py index 3c1d14fee1e5..effd351a0456 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._java_components_operations import ( build_create_or_update_request, build_delete_request, @@ -40,6 +41,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +91,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JavaComponentsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -105,7 +110,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -121,7 +125,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -170,7 +173,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.JavaComponent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -193,7 +196,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -208,7 +210,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("JavaComponent", pipeline_response) + deserialized = self._deserialize("JavaComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -222,8 +224,8 @@ async def _create_or_update_initial( name: str, java_component_envelope: Union[_models.JavaComponent, IO[bytes]], **kwargs: Any - ) -> _models.JavaComponent: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -236,7 +238,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -258,10 +260,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -269,15 +271,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("JavaComponent", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("JavaComponent", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -400,10 +402,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("JavaComponent", pipeline_response) + deserialized = self._deserialize("JavaComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -435,8 +438,8 @@ async def _update_initial( name: str, java_component_envelope: Union[_models.JavaComponent, IO[bytes]], **kwargs: Any - ) -> Optional[_models.JavaComponent]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -449,7 +452,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.JavaComponent]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -471,10 +474,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -482,18 +485,20 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("JavaComponent", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -615,10 +620,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("JavaComponent", pipeline_response) + deserialized = self._deserialize("JavaComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -640,10 +646,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -655,7 +661,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -666,10 +672,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -677,6 +683,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -685,8 +695,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -716,7 +730,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, environment_name=environment_name, name=name, @@ -726,6 +740,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_executions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_executions_operations.py index 772caa7189f7..315e67ddf9b2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_executions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_executions_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,17 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._jobs_executions_operations import build_list_request from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +81,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContainerAppJobExecutions] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +101,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -114,7 +116,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_operations.py index 22276b34a13d..a5df235dabab 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_operations.py @@ -7,7 +7,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, TypeVar, Union, cast, overload +import sys +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._jobs_operations import ( build_create_or_update_request, build_delete_request, @@ -48,6 +63,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,10 +90,10 @@ def __init__(self, *args, **kwargs) -> None: 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( + @distributed_trace + def list_detectors( self, resource_group_name: str, job_name: str, **kwargs: Any - ) -> _models.DiagnosticsCollection: + ) -> AsyncIterable["_models.Diagnostics"]: """Get the list of diagnostics for a given Container App Job. Get the list of diagnostics for a Container App Job. @@ -84,11 +103,17 @@ async def list_detectors( :type resource_group_name: str :param job_name: Job Name. Required. :type job_name: str - :return: DiagnosticsCollection or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DiagnosticsCollection + :return: An iterator like instance of either Diagnostics or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.Diagnostics] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DiagnosticsCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,41 +121,60 @@ async def list_detectors( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DiagnosticsCollection] = kwargs.pop("cls", None) + _request = build_list_detectors_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_list_detectors_request( - resource_group_name=resource_group_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + 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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - response = pipeline_response.http_response + async def get_next(next_link=None): + _request = prepare_request(next_link) - 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) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = self._deserialize("DiagnosticsCollection", pipeline_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) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) @distributed_trace_async async def get_detector( @@ -151,7 +195,7 @@ async def get_detector( :rtype: ~azure.mgmt.appcontainers.models.Diagnostics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -174,7 +218,6 @@ async def get_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -189,7 +232,7 @@ async def get_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Diagnostics", pipeline_response) + deserialized = self._deserialize("Diagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -211,7 +254,7 @@ async def proxy_get(self, resource_group_name: str, job_name: str, **kwargs: Any :rtype: ~azure.mgmt.appcontainers.models.Job :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -235,7 +278,6 @@ async def proxy_get(self, resource_group_name: str, job_name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -250,7 +292,7 @@ async def proxy_get(self, resource_group_name: str, job_name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Job", pipeline_response) + deserialized = self._deserialize("Job", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -273,7 +315,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Job"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -290,7 +332,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -306,7 +347,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -355,7 +395,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -373,7 +413,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -389,7 +428,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -434,7 +472,7 @@ async def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _ :rtype: ~azure.mgmt.appcontainers.models.Job :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -456,7 +494,6 @@ async def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -471,7 +508,7 @@ async def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Job", pipeline_response) + deserialized = self._deserialize("Job", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -480,8 +517,8 @@ async def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _ async def _create_or_update_initial( self, resource_group_name: str, job_name: str, job_envelope: Union[_models.Job, IO[bytes]], **kwargs: Any - ) -> _models.Job: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -494,7 +531,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Job] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -515,10 +552,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -526,15 +563,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Job", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Job", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -640,10 +677,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Job", pipeline_response) + deserialized = self._deserialize("Job", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -668,10 +706,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, job_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, resource_group_name: str, job_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -683,7 +719,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -693,10 +729,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -704,6 +740,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -712,8 +752,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -739,7 +783,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, job_name=job_name, api_version=api_version, @@ -748,6 +792,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -777,8 +822,8 @@ async def _update_initial( job_name: str, job_envelope: Union[_models.JobPatchProperties, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Job]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -791,7 +836,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Job]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -812,10 +857,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -823,18 +868,20 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Job", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -943,10 +990,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Job", pipeline_response) + deserialized = self._deserialize("Job", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -974,8 +1022,8 @@ async def _start_initial( job_name: str, template: Optional[Union[_models.JobExecutionTemplate, IO[bytes]]] = None, **kwargs: Any - ) -> Optional[_models.JobExecutionBase]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -988,7 +1036,7 @@ async def _start_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.JobExecutionBase]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1012,10 +1060,10 @@ async def _start_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1023,18 +1071,20 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("JobExecutionBase", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1146,10 +1196,11 @@ async def begin_start( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("JobExecutionBase", pipeline_response) + deserialized = self._deserialize("JobExecutionBase", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1173,10 +1224,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _stop_execution_initial( # pylint: disable=inconsistent-return-statements + async def _stop_execution_initial( self, resource_group_name: str, job_name: str, job_execution_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1188,7 +1239,7 @@ async def _stop_execution_initial( # pylint: disable=inconsistent-return-statem _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_execution_request( resource_group_name=resource_group_name, @@ -1199,10 +1250,10 @@ async def _stop_execution_initial( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1210,6 +1261,10 @@ async def _stop_execution_initial( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1218,8 +1273,12 @@ async def _stop_execution_initial( # pylint: disable=inconsistent-return-statem if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_stop_execution( @@ -1249,7 +1308,7 @@ async def begin_stop_execution( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._stop_execution_initial( # type: ignore + raw_result = await self._stop_execution_initial( resource_group_name=resource_group_name, job_name=job_name, job_execution_name=job_execution_name, @@ -1259,6 +1318,7 @@ async def begin_stop_execution( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1284,8 +1344,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _stop_multiple_executions_initial( self, resource_group_name: str, job_name: str, **kwargs: Any - ) -> Optional[_models.ContainerAppJobExecutions]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1297,7 +1357,7 @@ async def _stop_multiple_executions_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.ContainerAppJobExecutions]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_multiple_executions_request( resource_group_name=resource_group_name, @@ -1307,10 +1367,10 @@ async def _stop_multiple_executions_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1318,18 +1378,20 @@ async def _stop_multiple_executions_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ContainerAppJobExecutions", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1372,10 +1434,11 @@ async def begin_stop_multiple_executions( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerAppJobExecutions", pipeline_response) + deserialized = self._deserialize("ContainerAppJobExecutions", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1416,7 +1479,7 @@ async def list_secrets( :rtype: ~azure.mgmt.appcontainers.models.JobSecretsCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1438,7 +1501,6 @@ async def list_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1453,7 +1515,7 @@ async def list_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("JobSecretsCollection", pipeline_response) + deserialized = self._deserialize("JobSecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_logic_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_logic_apps_operations.py new file mode 100644 index 000000000000..10c4fd49e67e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_logic_apps_operations.py @@ -0,0 +1,768 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator 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 ...operations._logic_apps_operations import ( + build_create_or_update_request, + build_delete_request, + build_deploy_workflow_artifacts_request, + build_get_request, + build_get_workflow_request, + build_invoke_request, + build_list_workflows_connections_request, + build_list_workflows_request, +) +from .._vendor import ContainerAppsAPIClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class LogicAppsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`logic_apps` 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( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> _models.LogicApp: + """Gets a logic app extension resource. + + Gets a logic app extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LogicApp] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LogicApp", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: _models.LogicApp, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Required. + :type resource: ~azure.mgmt.appcontainers.models.LogicApp + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: Union[_models.LogicApp, IO[bytes]], + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Is either a LogicApp type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.appcontainers.models.LogicApp or IO[bytes] + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LogicApp] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "LogicApp") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + 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("LogicApp", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> None: + """Deletes a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 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, {}) # type: ignore + + @distributed_trace + def list_workflows( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> AsyncIterable["_models.WorkflowEnvelope"]: + """List the workflows for a logic app. + + List the workflows for a logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: An iterator like instance of either WorkflowEnvelope or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.WorkflowEnvelope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelopeCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_workflows_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WorkflowEnvelopeCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_workflow( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, workflow_name: str, **kwargs: Any + ) -> _models.WorkflowEnvelope: + """Get workflow information by its name. + + Get workflow information by its name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_name: Workflow name. Required. + :type workflow_name: str + :return: WorkflowEnvelope or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.WorkflowEnvelope + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelope] = kwargs.pop("cls", None) + + _request = build_get_workflow_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + workflow_name=workflow_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[_models.WorkflowArtifacts] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Default value is + None. + :type workflow_artifacts: ~azure.mgmt.appcontainers.models.WorkflowArtifacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Default value is + None. + :type workflow_artifacts: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[Union[_models.WorkflowArtifacts, IO[bytes]]] = None, + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Is either a + WorkflowArtifacts type or a IO[bytes] type. Default value is None. + :type workflow_artifacts: ~azure.mgmt.appcontainers.models.WorkflowArtifacts or IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workflow_artifacts, (IOBase, bytes)): + _content = workflow_artifacts + else: + if workflow_artifacts is not None: + _json = self._serialize.body(workflow_artifacts, "WorkflowArtifacts") + else: + _json = None + + _request = build_deploy_workflow_artifacts_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def list_workflows_connections( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> _models.WorkflowEnvelope: + """Gets logic app's connections. + + Gets logic app's connections. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: WorkflowEnvelope or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.WorkflowEnvelope + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelope] = kwargs.pop("cls", None) + + _request = build_list_workflows_connections_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def invoke( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + x_ms_logic_apps_proxy_path: str, + x_ms_logic_apps_proxy_method: Union[str, _models.LogicAppsProxyMethod], + **kwargs: Any + ) -> JSON: + """Proxies a the API call to the logic app backed by the container app. + + Proxies a the API call to the logic app backed by the container app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the LogicApp App, the extension resource. Required. + :type logic_app_name: str + :param x_ms_logic_apps_proxy_path: The proxy path for the API call. Required. + :type x_ms_logic_apps_proxy_path: str + :param x_ms_logic_apps_proxy_method: The proxy method for the API call. Known values are: "GET" + and "POST". Required. + :type x_ms_logic_apps_proxy_method: str or + ~azure.mgmt.appcontainers.models.LogicAppsProxyMethod + :return: JSON or the result of cls(response) + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_invoke_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + x_ms_logic_apps_proxy_path=x_ms_logic_apps_proxy_path, + x_ms_logic_apps_proxy_method=x_ms_logic_apps_proxy_method, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("object", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py index 3b252ae030d2..48dd8d1cb147 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._managed_certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -40,6 +41,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,7 +87,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.ManagedCertificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -105,7 +110,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -120,7 +124,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedCertificate", pipeline_response) + deserialized = self._deserialize("ManagedCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -134,13 +138,16 @@ async def _create_or_update_initial( managed_certificate_name: str, managed_certificate_envelope: Optional[Union[_models.ManagedCertificate, IO[bytes]]] = None, **kwargs: Any - ) -> _models.ManagedCertificate: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 400: lambda response: HttpResponseError(response=response, error_format=ARMErrorFormat), + 400: cast( + Type[HttpResponseError], + lambda response: HttpResponseError(response=response, error_format=ARMErrorFormat), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -149,7 +156,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ManagedCertificate] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -174,10 +181,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -185,15 +192,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ManagedCertificate", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ManagedCertificate", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -319,10 +326,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ManagedCertificate", pipeline_response) + deserialized = self._deserialize("ManagedCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -366,7 +374,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -389,7 +397,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -501,7 +508,7 @@ async def update( :rtype: ~azure.mgmt.appcontainers.models.ManagedCertificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -536,7 +543,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -551,7 +557,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedCertificate", pipeline_response) + deserialized = self._deserialize("ManagedCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -582,7 +588,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedCertificateCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -601,7 +607,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -617,7 +622,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_diagnostics_operations.py index 7a7bc78871dc..f7d05ad4b0fc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_diagnostics_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,20 +18,22 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from 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, ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +74,7 @@ async def list_detectors( :rtype: ~azure.mgmt.appcontainers.models.DiagnosticsCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +96,6 @@ async def list_detectors( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -108,7 +110,7 @@ async def list_detectors( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticsCollection", pipeline_response) + deserialized = self._deserialize("DiagnosticsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -134,7 +136,7 @@ async def get_detector( :rtype: ~azure.mgmt.appcontainers.models.Diagnostics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -157,7 +159,6 @@ async def get_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -172,7 +173,7 @@ async def get_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Diagnostics", pipeline_response) + deserialized = self._deserialize("Diagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_endpoint_connections_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..ed90969b7dd6 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_endpoint_connections_operations.py @@ -0,0 +1,558 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._managed_environment_private_endpoint_connections_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) +from .._vendor import ContainerAppsAPIClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ManagedEnvironmentPrivateEndpointConnectionsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`managed_environment_private_endpoint_connections` 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, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnection"]: + """List private endpoint connections for a given managed environment. + + List private endpoint connections for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Get a private endpoint connection for a given managed environment. + + Get a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(private_endpoint_connection_envelope, (IOBase, bytes)): + _content = private_endpoint_connection_envelope + else: + _json = self._serialize.body(private_endpoint_connection_envelope, "PrivateEndpointConnection") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Required. + :type private_endpoint_connection_envelope: + ~azure.mgmt.appcontainers.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Required. + :type private_endpoint_connection_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. + :type private_endpoint_connection_envelope: + ~azure.mgmt.appcontainers.models.PrivateEndpointConnection or IO[bytes] + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection_envelope=private_endpoint_connection_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a private endpoint connection for a given managed environment. + + Delete a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_link_resources_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_link_resources_operations.py new file mode 100644 index 000000000000..411adc2706c7 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_link_resources_operations.py @@ -0,0 +1,144 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._managed_environment_private_link_resources_operations import build_list_request +from .._vendor import ContainerAppsAPIClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ManagedEnvironmentPrivateLinkResourcesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`managed_environment_private_link_resources` 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, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateLinkResource"]: + """List private link resources for a given managed environment. + + List private link resources for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py index bad1c1fbb2c0..32e5aba171df 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,17 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._managed_environment_usages_operations import build_list_request from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +75,7 @@ def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +94,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -107,7 +109,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_diagnostics_operations.py index 898eb2987a58..72e6fae60a64 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_diagnostics_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,17 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from 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 from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +71,7 @@ async def get_root( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -90,7 +93,6 @@ async def get_root( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -105,7 +107,7 @@ async def get_root( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = self._deserialize("ManagedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py index 95cc9648f12f..7cec22ada4f3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ 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, build_delete_request, @@ -43,6 +44,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +88,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ManagedE api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedEnvironmentsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -116,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -168,7 +171,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedEnvironmentsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -186,7 +189,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -202,7 +204,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -247,7 +248,7 @@ async def get(self, resource_group_name: str, environment_name: str, **kwargs: A :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -269,7 +270,6 @@ async def get(self, resource_group_name: str, environment_name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -284,7 +284,7 @@ async def get(self, resource_group_name: str, environment_name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = self._deserialize("ManagedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -297,8 +297,8 @@ async def _create_or_update_initial( environment_name: str, environment_envelope: Union[_models.ManagedEnvironment, IO[bytes]], **kwargs: Any - ) -> _models.ManagedEnvironment: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -311,7 +311,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ManagedEnvironment] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -332,10 +332,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -343,15 +343,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,10 +464,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = self._deserialize("ManagedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -489,10 +490,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, environment_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +505,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -514,10 +515,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -525,12 +526,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -558,7 +567,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, environment_name=environment_name, api_version=api_version, @@ -567,6 +576,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -594,8 +604,8 @@ async def _update_initial( environment_name: str, environment_envelope: Union[_models.ManagedEnvironment, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ManagedEnvironment]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -608,7 +618,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ManagedEnvironment]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -629,10 +639,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -640,13 +650,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -759,10 +771,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = self._deserialize("ManagedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -801,7 +814,7 @@ async def get_auth_token( :rtype: ~azure.mgmt.appcontainers.models.EnvironmentAuthToken :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -823,7 +836,6 @@ async def get_auth_token( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -838,7 +850,7 @@ async def get_auth_token( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EnvironmentAuthToken", pipeline_response) + deserialized = self._deserialize("EnvironmentAuthToken", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -870,7 +882,7 @@ def list_workload_profile_states( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkloadProfileStatesCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -889,7 +901,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -905,7 +916,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py index c70d7e6a5626..6cba2a4bde27 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._managed_environments_storages_operations import ( build_create_or_update_request, build_delete_request, @@ -34,6 +33,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +77,7 @@ async def list( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStoragesCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,7 +99,6 @@ async def list( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -111,7 +113,7 @@ async def list( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedEnvironmentStoragesCollection", pipeline_response) + deserialized = self._deserialize("ManagedEnvironmentStoragesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -137,7 +139,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -160,7 +162,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -175,7 +176,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedEnvironmentStorage", pipeline_response) + deserialized = self._deserialize("ManagedEnvironmentStorage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -273,7 +274,7 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -308,7 +309,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -323,7 +323,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedEnvironmentStorage", pipeline_response) + deserialized = self._deserialize("ManagedEnvironmentStorage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -349,7 +349,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +372,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py index c95740bbf0b1..cc4441b9b104 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,17 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from 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 from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -136,7 +139,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -170,7 +173,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -185,7 +187,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py index 560fc6a10fe1..eede32e9e752 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,17 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._operations import build_list_request from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -84,7 +87,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -100,7 +102,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py index e882d2283742..be6430b54a7c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,17 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._usages_operations import build_list_request from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +73,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Usage"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -88,7 +91,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -104,7 +106,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py index d81009d3ad02..4d5e2e2a67c7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py @@ -66,12 +66,19 @@ from ._models_py3 import ContainerAppProbeHttpGet from ._models_py3 import ContainerAppProbeHttpGetHttpHeadersItem from ._models_py3 import ContainerAppProbeTcpSocket +from ._models_py3 import ContainerAppPropertiesPatchingConfiguration from ._models_py3 import ContainerAppSecret +from ._models_py3 import ContainerAppsBuildCollection +from ._models_py3 import ContainerAppsBuildConfiguration +from ._models_py3 import ContainerAppsBuildResource +from ._models_py3 import ContainerAppsPatchResource +from ._models_py3 import ContainerExecutionStatus from ._models_py3 import ContainerRegistry from ._models_py3 import ContainerRegistryWithCustomImage from ._models_py3 import ContainerResources from ._models_py3 import CookieExpiration from ._models_py3 import CorsPolicy +from ._models_py3 import CustomContainerTemplate from ._models_py3 import CustomDomain from ._models_py3 import CustomDomainConfiguration from ._models_py3 import CustomHostnameAnalysisResult @@ -122,13 +129,16 @@ from ._models_py3 import DotNetComponentConfigurationProperty from ._models_py3 import DotNetComponentServiceBind from ._models_py3 import DotNetComponentsCollection +from ._models_py3 import DynamicPoolConfiguration from ._models_py3 import EncryptionSettings from ._models_py3 import EnvironmentAuthToken from ._models_py3 import EnvironmentVar from ._models_py3 import EnvironmentVariable from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorEntity from ._models_py3 import ErrorResponse +from ._models_py3 import ExecutionStatus from ._models_py3 import ExtendedLocation from ._models_py3 import Facebook from ._models_py3 import ForwardProxy @@ -145,6 +155,7 @@ from ._models_py3 import HttpSettings from ._models_py3 import HttpSettingsRoutes from ._models_py3 import IdentityProviders +from ._models_py3 import IdentitySettings from ._models_py3 import Ingress from ._models_py3 import IngressPortMapping from ._models_py3 import IngressStickySessions @@ -152,6 +163,9 @@ from ._models_py3 import IpSecurityRestrictionRule from ._models_py3 import JavaComponent from ._models_py3 import JavaComponentConfigurationProperty +from ._models_py3 import JavaComponentIngress +from ._models_py3 import JavaComponentProperties +from ._models_py3 import JavaComponentPropertiesScale from ._models_py3 import JavaComponentServiceBind from ._models_py3 import JavaComponentsCollection from ._models_py3 import Job @@ -175,6 +189,8 @@ from ._models_py3 import KedaConfiguration from ._models_py3 import ListUsagesResult from ._models_py3 import LogAnalyticsConfiguration +from ._models_py3 import LoggerSetting +from ._models_py3 import LogicApp from ._models_py3 import Login from ._models_py3 import LoginRoutes from ._models_py3 import LoginScopes @@ -185,6 +201,8 @@ from ._models_py3 import ManagedCertificateProperties from ._models_py3 import ManagedEnvironment from ._models_py3 import ManagedEnvironmentPropertiesPeerAuthentication +from ._models_py3 import ManagedEnvironmentPropertiesPeerTrafficConfiguration +from ._models_py3 import ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption from ._models_py3 import ManagedEnvironmentStorage from ._models_py3 import ManagedEnvironmentStorageProperties from ._models_py3 import ManagedEnvironmentStoragesCollection @@ -192,6 +210,7 @@ from ._models_py3 import ManagedServiceIdentity from ._models_py3 import MetricsConfiguration from ._models_py3 import Mtls +from ._models_py3 import NacosComponent from ._models_py3 import NfsAzureFileProperties from ._models_py3 import Nonce from ._models_py3 import OpenIdConnectClientCredential @@ -202,7 +221,19 @@ from ._models_py3 import OperationDetail from ._models_py3 import OperationDisplay from ._models_py3 import OtlpConfiguration +from ._models_py3 import PatchCollection +from ._models_py3 import PatchDetails +from ._models_py3 import PatchDetailsNewLayer +from ._models_py3 import PatchDetailsOldLayer +from ._models_py3 import PatchProperties +from ._models_py3 import PatchSkipConfig from ._models_py3 import PreBuildStep +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState from ._models_py3 import ProxyResource from ._models_py3 import QueueScaleRule from ._models_py3 import RegistryCredentials @@ -210,19 +241,41 @@ from ._models_py3 import Replica from ._models_py3 import ReplicaCollection from ._models_py3 import ReplicaContainer +from ._models_py3 import ReplicaExecutionStatus from ._models_py3 import Resource from ._models_py3 import Revision from ._models_py3 import RevisionCollection +from ._models_py3 import Runtime +from ._models_py3 import RuntimeDotnet +from ._models_py3 import RuntimeJava +from ._models_py3 import RuntimeJavaAgent +from ._models_py3 import RuntimeJavaAgentLogging from ._models_py3 import Scale +from ._models_py3 import ScaleConfiguration from ._models_py3 import ScaleRule from ._models_py3 import ScaleRuleAuth +from ._models_py3 import ScgRoute from ._models_py3 import Secret from ._models_py3 import SecretVolumeItem from ._models_py3 import SecretsCollection from ._models_py3 import Service from ._models_py3 import ServiceBind +from ._models_py3 import SessionContainer +from ._models_py3 import SessionContainerResources +from ._models_py3 import SessionIngress +from ._models_py3 import SessionNetworkConfiguration +from ._models_py3 import SessionPool +from ._models_py3 import SessionPoolCollection +from ._models_py3 import SessionPoolSecret +from ._models_py3 import SessionPoolUpdatableProperties +from ._models_py3 import SessionRegistryCredentials +from ._models_py3 import SmbStorage from ._models_py3 import SourceControl from ._models_py3 import SourceControlCollection +from ._models_py3 import SpringBootAdminComponent +from ._models_py3 import SpringCloudConfigComponent +from ._models_py3 import SpringCloudEurekaComponent +from ._models_py3 import SpringCloudGatewayComponent from ._models_py3 import SystemData from ._models_py3 import TcpConnectionPool from ._models_py3 import TcpRetryPolicy @@ -241,6 +294,11 @@ from ._models_py3 import VnetConfiguration from ._models_py3 import Volume from ._models_py3 import VolumeMount +from ._models_py3 import WorkflowArtifacts +from ._models_py3 import WorkflowEnvelope +from ._models_py3 import WorkflowEnvelopeCollection +from ._models_py3 import WorkflowEnvelopeProperties +from ._models_py3 import WorkflowHealth from ._models_py3 import WorkloadProfile from ._models_py3 import WorkloadProfileStates from ._models_py3 import WorkloadProfileStatesCollection @@ -263,14 +321,19 @@ from ._container_apps_api_client_enums import ContainerAppContainerRunningState from ._container_apps_api_client_enums import ContainerAppProvisioningState from ._container_apps_api_client_enums import ContainerAppReplicaRunningState +from ._container_apps_api_client_enums import ContainerType from ._container_apps_api_client_enums import CookieExpirationConvention from ._container_apps_api_client_enums import CreatedByType +from ._container_apps_api_client_enums import DetectionStatus from ._container_apps_api_client_enums import DnsVerificationTestResult from ._container_apps_api_client_enums import DotNetComponentProvisioningState from ._container_apps_api_client_enums import DotNetComponentType from ._container_apps_api_client_enums import EnvironmentProvisioningState +from ._container_apps_api_client_enums import ExecutionType from ._container_apps_api_client_enums import ExtendedLocationTypes from ._container_apps_api_client_enums import ForwardProxyConvention +from ._container_apps_api_client_enums import IdentitySettingsLifeCycle +from ._container_apps_api_client_enums import ImageType from ._container_apps_api_client_enums import IngressClientCertificateMode from ._container_apps_api_client_enums import IngressTargetPortHttpScheme from ._container_apps_api_client_enums import IngressTransportMethod @@ -278,18 +341,32 @@ from ._container_apps_api_client_enums import JavaComponentType from ._container_apps_api_client_enums import JobExecutionRunningState from ._container_apps_api_client_enums import JobProvisioningState +from ._container_apps_api_client_enums import Kind +from ._container_apps_api_client_enums import Level from ._container_apps_api_client_enums import LogLevel +from ._container_apps_api_client_enums import LogicAppsProxyMethod from ._container_apps_api_client_enums import ManagedCertificateDomainControlValidation from ._container_apps_api_client_enums import ManagedServiceIdentityType +from ._container_apps_api_client_enums import PatchApplyStatus +from ._container_apps_api_client_enums import PatchType +from ._container_apps_api_client_enums import PatchingMode +from ._container_apps_api_client_enums import PoolManagementType +from ._container_apps_api_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_apps_api_client_enums import PrivateEndpointServiceConnectionStatus +from ._container_apps_api_client_enums import PublicNetworkAccess from ._container_apps_api_client_enums import RevisionHealthState from ._container_apps_api_client_enums import RevisionProvisioningState from ._container_apps_api_client_enums import RevisionRunningState from ._container_apps_api_client_enums import Scheme +from ._container_apps_api_client_enums import SessionNetworkStatus +from ._container_apps_api_client_enums import SessionPoolProvisioningState from ._container_apps_api_client_enums import SourceControlOperationState from ._container_apps_api_client_enums import StorageType from ._container_apps_api_client_enums import TriggerType from ._container_apps_api_client_enums import Type from ._container_apps_api_client_enums import UnauthenticatedClientActionV2 +from ._container_apps_api_client_enums import WorkflowHealthState +from ._container_apps_api_client_enums import WorkflowState from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk @@ -355,12 +432,19 @@ "ContainerAppProbeHttpGet", "ContainerAppProbeHttpGetHttpHeadersItem", "ContainerAppProbeTcpSocket", + "ContainerAppPropertiesPatchingConfiguration", "ContainerAppSecret", + "ContainerAppsBuildCollection", + "ContainerAppsBuildConfiguration", + "ContainerAppsBuildResource", + "ContainerAppsPatchResource", + "ContainerExecutionStatus", "ContainerRegistry", "ContainerRegistryWithCustomImage", "ContainerResources", "CookieExpiration", "CorsPolicy", + "CustomContainerTemplate", "CustomDomain", "CustomDomainConfiguration", "CustomHostnameAnalysisResult", @@ -411,13 +495,16 @@ "DotNetComponentConfigurationProperty", "DotNetComponentServiceBind", "DotNetComponentsCollection", + "DynamicPoolConfiguration", "EncryptionSettings", "EnvironmentAuthToken", "EnvironmentVar", "EnvironmentVariable", "ErrorAdditionalInfo", "ErrorDetail", + "ErrorEntity", "ErrorResponse", + "ExecutionStatus", "ExtendedLocation", "Facebook", "ForwardProxy", @@ -434,6 +521,7 @@ "HttpSettings", "HttpSettingsRoutes", "IdentityProviders", + "IdentitySettings", "Ingress", "IngressPortMapping", "IngressStickySessions", @@ -441,6 +529,9 @@ "IpSecurityRestrictionRule", "JavaComponent", "JavaComponentConfigurationProperty", + "JavaComponentIngress", + "JavaComponentProperties", + "JavaComponentPropertiesScale", "JavaComponentServiceBind", "JavaComponentsCollection", "Job", @@ -464,6 +555,8 @@ "KedaConfiguration", "ListUsagesResult", "LogAnalyticsConfiguration", + "LoggerSetting", + "LogicApp", "Login", "LoginRoutes", "LoginScopes", @@ -474,6 +567,8 @@ "ManagedCertificateProperties", "ManagedEnvironment", "ManagedEnvironmentPropertiesPeerAuthentication", + "ManagedEnvironmentPropertiesPeerTrafficConfiguration", + "ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption", "ManagedEnvironmentStorage", "ManagedEnvironmentStorageProperties", "ManagedEnvironmentStoragesCollection", @@ -481,6 +576,7 @@ "ManagedServiceIdentity", "MetricsConfiguration", "Mtls", + "NacosComponent", "NfsAzureFileProperties", "Nonce", "OpenIdConnectClientCredential", @@ -491,7 +587,19 @@ "OperationDetail", "OperationDisplay", "OtlpConfiguration", + "PatchCollection", + "PatchDetails", + "PatchDetailsNewLayer", + "PatchDetailsOldLayer", + "PatchProperties", + "PatchSkipConfig", "PreBuildStep", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourceListResult", + "PrivateLinkServiceConnectionState", "ProxyResource", "QueueScaleRule", "RegistryCredentials", @@ -499,19 +607,41 @@ "Replica", "ReplicaCollection", "ReplicaContainer", + "ReplicaExecutionStatus", "Resource", "Revision", "RevisionCollection", + "Runtime", + "RuntimeDotnet", + "RuntimeJava", + "RuntimeJavaAgent", + "RuntimeJavaAgentLogging", "Scale", + "ScaleConfiguration", "ScaleRule", "ScaleRuleAuth", + "ScgRoute", "Secret", "SecretVolumeItem", "SecretsCollection", "Service", "ServiceBind", + "SessionContainer", + "SessionContainerResources", + "SessionIngress", + "SessionNetworkConfiguration", + "SessionPool", + "SessionPoolCollection", + "SessionPoolSecret", + "SessionPoolUpdatableProperties", + "SessionRegistryCredentials", + "SmbStorage", "SourceControl", "SourceControlCollection", + "SpringBootAdminComponent", + "SpringCloudConfigComponent", + "SpringCloudEurekaComponent", + "SpringCloudGatewayComponent", "SystemData", "TcpConnectionPool", "TcpRetryPolicy", @@ -530,6 +660,11 @@ "VnetConfiguration", "Volume", "VolumeMount", + "WorkflowArtifacts", + "WorkflowEnvelope", + "WorkflowEnvelopeCollection", + "WorkflowEnvelopeProperties", + "WorkflowHealth", "WorkloadProfile", "WorkloadProfileStates", "WorkloadProfileStatesCollection", @@ -551,14 +686,19 @@ "ContainerAppContainerRunningState", "ContainerAppProvisioningState", "ContainerAppReplicaRunningState", + "ContainerType", "CookieExpirationConvention", "CreatedByType", + "DetectionStatus", "DnsVerificationTestResult", "DotNetComponentProvisioningState", "DotNetComponentType", "EnvironmentProvisioningState", + "ExecutionType", "ExtendedLocationTypes", "ForwardProxyConvention", + "IdentitySettingsLifeCycle", + "ImageType", "IngressClientCertificateMode", "IngressTargetPortHttpScheme", "IngressTransportMethod", @@ -566,18 +706,32 @@ "JavaComponentType", "JobExecutionRunningState", "JobProvisioningState", + "Kind", + "Level", "LogLevel", + "LogicAppsProxyMethod", "ManagedCertificateDomainControlValidation", "ManagedServiceIdentityType", + "PatchApplyStatus", + "PatchType", + "PatchingMode", + "PoolManagementType", + "PrivateEndpointConnectionProvisioningState", + "PrivateEndpointServiceConnectionStatus", + "PublicNetworkAccess", "RevisionHealthState", "RevisionProvisioningState", "RevisionRunningState", "Scheme", + "SessionNetworkStatus", + "SessionPoolProvisioningState", "SourceControlOperationState", "StorageType", "TriggerType", "Type", "UnauthenticatedClientActionV2", + "WorkflowHealthState", + "WorkflowState", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py index 76e21fe999be..c7a65722066f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py @@ -168,6 +168,13 @@ class ContainerAppReplicaRunningState(str, Enum, metaclass=CaseInsensitiveEnumMe UNKNOWN = "Unknown" +class ContainerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The container type of the sessions.""" + + CUSTOM_CONTAINER = "CustomContainer" + PYTHON_LTS = "PythonLTS" + + class CookieExpirationConvention(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The convention used when determining the session cookie's expiration.""" @@ -184,6 +191,14 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" +class DetectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the patch detection.""" + + SUCCEEDED = "Succeeded" + REGISTRY_LOGIN_FAILED = "RegistryLoginFailed" + FAILED = "Failed" + + class DnsVerificationTestResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): """DNS verification test result.""" @@ -206,7 +221,6 @@ class DotNetComponentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of the .NET Component.""" ASPIRE_DASHBOARD = "AspireDashboard" - ASPIRE_RESOURCE_SERVER_API = "AspireResourceServerApi" class EnvironmentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -224,6 +238,12 @@ class EnvironmentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta) UPGRADE_FAILED = "UpgradeFailed" +class ExecutionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The execution type of the session pool.""" + + TIMED = "Timed" + + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of extendedLocation.""" @@ -238,6 +258,26 @@ class ForwardProxyConvention(str, Enum, metaclass=CaseInsensitiveEnumMeta): CUSTOM = "Custom" +class IdentitySettingsLifeCycle(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Use to select the lifecycle stages of a Container App during which the Managed Identity should + be available. + """ + + INIT = "Init" + MAIN = "Main" + NONE = "None" + ALL = "All" + + +class ImageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the image. Set to CloudBuild to let the system manages the image, where user will + not be able to update image through image field. Set to ContainerImage for user provided image. + """ + + CLOUD_BUILD = "CloudBuild" + CONTAINER_IMAGE = "ContainerImage" + + class IngressClientCertificateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Client certificate mode for mTLS authentication. Ignore indicates server drops client certificate on forwarding. Accept indicates server forwards client certificate but does not @@ -281,6 +321,8 @@ class JavaComponentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SPRING_BOOT_ADMIN = "SpringBootAdmin" SPRING_CLOUD_EUREKA = "SpringCloudEureka" SPRING_CLOUD_CONFIG = "SpringCloudConfig" + SPRING_CLOUD_GATEWAY = "SpringCloudGateway" + NACOS = "Nacos" class JobExecutionRunningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -305,6 +347,33 @@ class JobProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETING = "Deleting" +class Kind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Metadata used to render different experiences for resources of the same type; e.g. WorkflowApp + is a kind of Microsoft.App/ContainerApps type. If supported, the resource provider must + validate and persist this value. + """ + + WORKFLOWAPP = "workflowapp" + + +class Level(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The specified logger's log level.""" + + OFF = "off" + ERROR = "error" + INFO = "info" + DEBUG = "debug" + TRACE = "trace" + WARN = "warn" + + +class LogicAppsProxyMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """LogicAppsProxyMethod.""" + + GET = "GET" + POST = "POST" + + class LogLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Sets the log level for the Dapr sidecar. Allowed values are debug, info, warn, error. Default is info. @@ -335,6 +404,76 @@ class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" +class PatchApplyStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the patch once it has been provisioned.""" + + NOT_STARTED = "NotStarted" + REBASE_IN_PROGRESS = "RebaseInProgress" + CREATING_REVISION = "CreatingRevision" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + REBASE_FAILED = "RebaseFailed" + REVISION_CREATION_FAILED = "RevisionCreationFailed" + IMAGE_PUSH_PULL_FAILED = "ImagePushPullFailed" + MANUALLY_SKIPPED = "ManuallySkipped" + + +class PatchingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Patching mode for the container app. Null or default in this field will be interpreted as + Automatic by RP. Automatic mode will automatically apply available patches. Manual mode will + require the user to manually apply patches. Disabled mode will stop patch detection and auto + patching. + """ + + AUTOMATIC = "Automatic" + MANUAL = "Manual" + DISABLED = "Disabled" + + +class PatchType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type for the patch.""" + + FRAMEWORK_SECURITY = "FrameworkSecurity" + OS_SECURITY = "OSSecurity" + FRAMEWORK_AND_OS_SECURITY = "FrameworkAndOSSecurity" + OTHER = "Other" + + +class PoolManagementType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The pool management type of the session pool.""" + + MANUAL = "Manual" + DYNAMIC = "Dynamic" + + +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + WAITING = "Waiting" + UPDATING = "Updating" + DELETING = "Deleting" + PENDING = "Pending" + + +class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The private endpoint connection status.""" + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + + +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Property to allow or block all public traffic. Allowed Values: 'Enabled', 'Disabled'.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + class RevisionHealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Current health State of the revision.""" @@ -371,6 +510,23 @@ class Scheme(str, Enum, metaclass=CaseInsensitiveEnumMeta): HTTPS = "HTTPS" +class SessionNetworkStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Network status for the sessions.""" + + EGRESS_ENABLED = "EgressEnabled" + EGRESS_DISABLED = "EgressDisabled" + + +class SessionPoolProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the session pool.""" + + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + DELETING = "Deleting" + + class SourceControlOperationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Current provisioning State of the operation.""" @@ -387,6 +543,7 @@ class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): EMPTY_DIR = "EmptyDir" SECRET = "Secret" NFS_AZURE_FILE = "NfsAzureFile" + SMB = "Smb" class TriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -412,3 +569,23 @@ class UnauthenticatedClientActionV2(str, Enum, metaclass=CaseInsensitiveEnumMeta ALLOW_ANONYMOUS = "AllowAnonymous" RETURN401 = "Return401" RETURN403 = "Return403" + + +class WorkflowHealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the workflow health state.""" + + NOT_SPECIFIED = "NotSpecified" + HEALTHY = "Healthy" + UNHEALTHY = "Unhealthy" + UNKNOWN = "Unknown" + + +class WorkflowState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The workflow state.""" + + NOT_SPECIFIED = "NotSpecified" + COMPLETED = "Completed" + ENABLED = "Enabled" + DISABLED = "Disabled" + DELETED = "Deleted" + SUSPENDED = "Suspended" diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py index e6f107c1bec7..449af982fe48 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py @@ -233,8 +233,8 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -275,8 +275,8 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -294,8 +294,8 @@ class AppResiliency(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -412,8 +412,8 @@ class AuthConfig(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -606,8 +606,8 @@ class AvailableWorkloadProfile(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1160,6 +1160,10 @@ class BaseContainer(_serialization.Model): :ivar image: Container image tag. :vartype image: str + :ivar image_type: The type of the image. Set to CloudBuild to let the system manages the image, + where user will not be able to update image through image field. Set to ContainerImage for user + provided image. Known values are: "CloudBuild" and "ContainerImage". + :vartype image_type: str or ~azure.mgmt.appcontainers.models.ImageType :ivar name: Custom container name. :vartype name: str :ivar command: Container start command. @@ -1176,6 +1180,7 @@ class BaseContainer(_serialization.Model): _attribute_map = { "image": {"key": "image", "type": "str"}, + "image_type": {"key": "imageType", "type": "str"}, "name": {"key": "name", "type": "str"}, "command": {"key": "command", "type": "[str]"}, "args": {"key": "args", "type": "[str]"}, @@ -1188,6 +1193,7 @@ def __init__( self, *, image: Optional[str] = None, + image_type: Optional[Union[str, "_models.ImageType"]] = None, name: Optional[str] = None, command: Optional[List[str]] = None, args: Optional[List[str]] = None, @@ -1199,6 +1205,10 @@ def __init__( """ :keyword image: Container image tag. :paramtype image: str + :keyword image_type: The type of the image. Set to CloudBuild to let the system manages the + image, where user will not be able to update image through image field. Set to ContainerImage + for user provided image. Known values are: "CloudBuild" and "ContainerImage". + :paramtype image_type: str or ~azure.mgmt.appcontainers.models.ImageType :keyword name: Custom container name. :paramtype name: str :keyword command: Container start command. @@ -1214,6 +1224,7 @@ def __init__( """ super().__init__(**kwargs) self.image = image + self.image_type = image_type self.name = name self.command = command self.args = args @@ -1222,7 +1233,7 @@ def __init__( self.volume_mounts = volume_mounts -class BillingMeter(ProxyResource): +class BillingMeter(_serialization.Model): """Billing meter. Variables are only populated by the server, and will be ignored when sending a request. @@ -1235,9 +1246,6 @@ class BillingMeter(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData :ivar location: Region for the billing meter. :vartype location: str :ivar properties: Revision resource specific properties. @@ -1248,14 +1256,12 @@ class BillingMeter(ProxyResource): "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"}, "location": {"key": "location", "type": "str"}, "properties": {"key": "properties", "type": "BillingMeterProperties"}, } @@ -1274,6 +1280,9 @@ def __init__( :paramtype properties: ~azure.mgmt.appcontainers.models.BillingMeterProperties """ super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None self.location = location self.properties = properties @@ -1500,8 +1509,8 @@ class TrackedResource(Resource): All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1553,8 +1562,8 @@ class BuilderResource(TrackedResource): All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1680,8 +1689,8 @@ class BuildResource(ProxyResource): # pylint: disable=too-many-instance-attribu Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1801,8 +1810,8 @@ class Certificate(TrackedResource): All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2210,10 +2219,15 @@ class Configuration(_serialization.Model): :vartype registries: list[~azure.mgmt.appcontainers.models.RegistryCredentials] :ivar dapr: Dapr configuration for the Container App. :vartype dapr: ~azure.mgmt.appcontainers.models.Dapr + :ivar runtime: App runtime configuration for the Container App. + :vartype runtime: ~azure.mgmt.appcontainers.models.Runtime :ivar max_inactive_revisions: Optional. Max inactive revisions a Container App can have. :vartype max_inactive_revisions: int :ivar service: Container App to be a dev Container App Service. :vartype service: ~azure.mgmt.appcontainers.models.Service + :ivar identity_settings: Optional settings for Managed Identities that are assigned to the + Container App. If a Managed Identity is not specified here, default settings will be used. + :vartype identity_settings: list[~azure.mgmt.appcontainers.models.IdentitySettings] """ _attribute_map = { @@ -2222,8 +2236,10 @@ class Configuration(_serialization.Model): "ingress": {"key": "ingress", "type": "Ingress"}, "registries": {"key": "registries", "type": "[RegistryCredentials]"}, "dapr": {"key": "dapr", "type": "Dapr"}, + "runtime": {"key": "runtime", "type": "Runtime"}, "max_inactive_revisions": {"key": "maxInactiveRevisions", "type": "int"}, "service": {"key": "service", "type": "Service"}, + "identity_settings": {"key": "identitySettings", "type": "[IdentitySettings]"}, } def __init__( @@ -2234,8 +2250,10 @@ def __init__( ingress: Optional["_models.Ingress"] = None, registries: Optional[List["_models.RegistryCredentials"]] = None, dapr: Optional["_models.Dapr"] = None, + runtime: Optional["_models.Runtime"] = None, max_inactive_revisions: Optional[int] = None, service: Optional["_models.Service"] = None, + identity_settings: Optional[List["_models.IdentitySettings"]] = None, **kwargs: Any ) -> None: """ @@ -2258,10 +2276,15 @@ def __init__( :paramtype registries: list[~azure.mgmt.appcontainers.models.RegistryCredentials] :keyword dapr: Dapr configuration for the Container App. :paramtype dapr: ~azure.mgmt.appcontainers.models.Dapr + :keyword runtime: App runtime configuration for the Container App. + :paramtype runtime: ~azure.mgmt.appcontainers.models.Runtime :keyword max_inactive_revisions: Optional. Max inactive revisions a Container App can have. :paramtype max_inactive_revisions: int :keyword service: Container App to be a dev Container App Service. :paramtype service: ~azure.mgmt.appcontainers.models.Service + :keyword identity_settings: Optional settings for Managed Identities that are assigned to the + Container App. If a Managed Identity is not specified here, default settings will be used. + :paramtype identity_settings: list[~azure.mgmt.appcontainers.models.IdentitySettings] """ super().__init__(**kwargs) self.secrets = secrets @@ -2269,8 +2292,10 @@ def __init__( self.ingress = ingress self.registries = registries self.dapr = dapr + self.runtime = runtime self.max_inactive_revisions = max_inactive_revisions self.service = service + self.identity_settings = identity_settings class ConnectedEnvironment(TrackedResource): # pylint: disable=too-many-instance-attributes @@ -2280,8 +2305,8 @@ class ConnectedEnvironment(TrackedResource): # pylint: disable=too-many-instanc All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2418,8 +2443,8 @@ class ConnectedEnvironmentStorage(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2464,19 +2489,31 @@ class ConnectedEnvironmentStorageProperties(_serialization.Model): :ivar azure_file: Azure file properties. :vartype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + :ivar smb: SMB storage properties. + :vartype smb: ~azure.mgmt.appcontainers.models.SmbStorage """ _attribute_map = { "azure_file": {"key": "azureFile", "type": "AzureFileProperties"}, + "smb": {"key": "smb", "type": "SmbStorage"}, } - def __init__(self, *, azure_file: Optional["_models.AzureFileProperties"] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + azure_file: Optional["_models.AzureFileProperties"] = None, + smb: Optional["_models.SmbStorage"] = None, + **kwargs: Any + ) -> None: """ :keyword azure_file: Azure file properties. :paramtype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + :keyword smb: SMB storage properties. + :paramtype smb: ~azure.mgmt.appcontainers.models.SmbStorage """ super().__init__(**kwargs) self.azure_file = azure_file + self.smb = smb class ConnectedEnvironmentStoragesCollection(_serialization.Model): @@ -2510,6 +2547,10 @@ class Container(BaseContainer): :ivar image: Container image tag. :vartype image: str + :ivar image_type: The type of the image. Set to CloudBuild to let the system manages the image, + where user will not be able to update image through image field. Set to ContainerImage for user + provided image. Known values are: "CloudBuild" and "ContainerImage". + :vartype image_type: str or ~azure.mgmt.appcontainers.models.ImageType :ivar name: Custom container name. :vartype name: str :ivar command: Container start command. @@ -2528,6 +2569,7 @@ class Container(BaseContainer): _attribute_map = { "image": {"key": "image", "type": "str"}, + "image_type": {"key": "imageType", "type": "str"}, "name": {"key": "name", "type": "str"}, "command": {"key": "command", "type": "[str]"}, "args": {"key": "args", "type": "[str]"}, @@ -2541,6 +2583,7 @@ def __init__( self, *, image: Optional[str] = None, + image_type: Optional[Union[str, "_models.ImageType"]] = None, name: Optional[str] = None, command: Optional[List[str]] = None, args: Optional[List[str]] = None, @@ -2553,6 +2596,10 @@ def __init__( """ :keyword image: Container image tag. :paramtype image: str + :keyword image_type: The type of the image. Set to CloudBuild to let the system manages the + image, where user will not be able to update image through image field. Set to ContainerImage + for user provided image. Known values are: "CloudBuild" and "ContainerImage". + :paramtype image_type: str or ~azure.mgmt.appcontainers.models.ImageType :keyword name: Custom container name. :paramtype name: str :keyword command: Container start command. @@ -2570,6 +2617,7 @@ def __init__( """ super().__init__( image=image, + image_type=image_type, name=name, command=command, args=args, @@ -2588,8 +2636,8 @@ class ContainerApp(TrackedResource): # pylint: disable=too-many-instance-attrib All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2613,6 +2661,10 @@ class ContainerApp(TrackedResource): # pylint: disable=too-many-instance-attrib mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. :vartype managed_by: str + :ivar kind: Metadata used to render different experiences for resources of the same type; e.g. + WorkflowApp is a kind of Microsoft.App/ContainerApps type. If supported, the resource provider + must validate and persist this value. "workflowapp" + :vartype kind: str or ~azure.mgmt.appcontainers.models.Kind :ivar provisioning_state: Provisioning state of the Container App. Known values are: "InProgress", "Succeeded", "Failed", "Canceled", and "Deleting". :vartype provisioning_state: str or @@ -2623,6 +2675,9 @@ class ContainerApp(TrackedResource): # pylint: disable=too-many-instance-attrib :vartype environment_id: str :ivar workload_profile_name: Workload profile name to pin for container app execution. :vartype workload_profile_name: str + :ivar patching_configuration: Container App auto patch configuration. + :vartype patching_configuration: + ~azure.mgmt.appcontainers.models.ContainerAppPropertiesPatchingConfiguration :ivar latest_revision_name: Name of the latest revision of the Container App. :vartype latest_revision_name: str :ivar latest_ready_revision_name: Name of the latest ready revision of the Container App. @@ -2667,10 +2722,15 @@ class ContainerApp(TrackedResource): # pylint: disable=too-many-instance-attrib "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "managed_by": {"key": "managedBy", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "managed_environment_id": {"key": "properties.managedEnvironmentId", "type": "str"}, "environment_id": {"key": "properties.environmentId", "type": "str"}, "workload_profile_name": {"key": "properties.workloadProfileName", "type": "str"}, + "patching_configuration": { + "key": "properties.patchingConfiguration", + "type": "ContainerAppPropertiesPatchingConfiguration", + }, "latest_revision_name": {"key": "properties.latestRevisionName", "type": "str"}, "latest_ready_revision_name": {"key": "properties.latestReadyRevisionName", "type": "str"}, "latest_revision_fqdn": {"key": "properties.latestRevisionFqdn", "type": "str"}, @@ -2689,9 +2749,11 @@ def __init__( extended_location: Optional["_models.ExtendedLocation"] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, managed_by: Optional[str] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, managed_environment_id: Optional[str] = None, environment_id: Optional[str] = None, workload_profile_name: Optional[str] = None, + patching_configuration: Optional["_models.ContainerAppPropertiesPatchingConfiguration"] = None, configuration: Optional["_models.Configuration"] = None, template: Optional["_models.Template"] = None, **kwargs: Any @@ -2711,12 +2773,19 @@ def __init__( complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. :paramtype managed_by: str + :keyword kind: Metadata used to render different experiences for resources of the same type; + e.g. WorkflowApp is a kind of Microsoft.App/ContainerApps type. If supported, the resource + provider must validate and persist this value. "workflowapp" + :paramtype kind: str or ~azure.mgmt.appcontainers.models.Kind :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 workload_profile_name: Workload profile name to pin for container app execution. :paramtype workload_profile_name: str + :keyword patching_configuration: Container App auto patch configuration. + :paramtype patching_configuration: + ~azure.mgmt.appcontainers.models.ContainerAppPropertiesPatchingConfiguration :keyword configuration: Non versioned Container App configuration properties. :paramtype configuration: ~azure.mgmt.appcontainers.models.Configuration :keyword template: Container App versioned application definition. @@ -2726,10 +2795,12 @@ def __init__( self.extended_location = extended_location self.identity = identity self.managed_by = managed_by + self.kind = kind self.provisioning_state = None self.managed_environment_id = managed_environment_id self.environment_id = environment_id self.workload_profile_name = workload_profile_name + self.patching_configuration = patching_configuration self.latest_revision_name = None self.latest_ready_revision_name = None self.latest_revision_fqdn = None @@ -2747,8 +2818,8 @@ class ContainerAppAuthToken(TrackedResource): All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3113,6 +3184,179 @@ def __init__(self, *, port: int, host: Optional[str] = None, **kwargs: Any) -> N self.port = port +class ContainerAppPropertiesPatchingConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Container App auto patch configuration. + + :ivar patching_mode: Patching mode for the container app. Null or default in this field will be + interpreted as Automatic by RP. Automatic mode will automatically apply available patches. + Manual mode will require the user to manually apply patches. Disabled mode will stop patch + detection and auto patching. Known values are: "Automatic", "Manual", and "Disabled". + :vartype patching_mode: str or ~azure.mgmt.appcontainers.models.PatchingMode + """ + + _attribute_map = { + "patching_mode": {"key": "patchingMode", "type": "str"}, + } + + def __init__(self, *, patching_mode: Optional[Union[str, "_models.PatchingMode"]] = None, **kwargs: Any) -> None: + """ + :keyword patching_mode: Patching mode for the container app. Null or default in this field will + be interpreted as Automatic by RP. Automatic mode will automatically apply available patches. + Manual mode will require the user to manually apply patches. Disabled mode will stop patch + detection and auto patching. Known values are: "Automatic", "Manual", and "Disabled". + :paramtype patching_mode: str or ~azure.mgmt.appcontainers.models.PatchingMode + """ + super().__init__(**kwargs) + self.patching_mode = patching_mode + + +class ContainerAppsBuildCollection(_serialization.Model): + """The response of a Container Apps Build Resource list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The Container Apps Build Resource items on this page. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ContainerAppsBuildResource] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ContainerAppsBuildResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.ContainerAppsBuildResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The Container Apps Build Resource items on this page. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ContainerAppsBuildResource] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ContainerAppsBuildConfiguration(_serialization.Model): + """Configuration of the build. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar base_os: Base OS used to build and run the app. + :vartype base_os: str + :ivar platform: Platform to be used to build and run the app. + :vartype platform: str + :ivar platform_version: Platform version to be used to build and run the app. + :vartype platform_version: str + :ivar environment_variables: List of environment variables to be passed to the build, secrets + should not be used in environment variable. + :vartype environment_variables: list[~azure.mgmt.appcontainers.models.EnvironmentVariable] + :ivar pre_build_steps: List of steps to perform before the build. + :vartype pre_build_steps: list[~azure.mgmt.appcontainers.models.PreBuildStep] + """ + + _validation = { + "base_os": {"readonly": True}, + "platform": {"readonly": True}, + "platform_version": {"readonly": True}, + "environment_variables": {"readonly": True}, + "pre_build_steps": {"readonly": True}, + } + + _attribute_map = { + "base_os": {"key": "baseOs", "type": "str"}, + "platform": {"key": "platform", "type": "str"}, + "platform_version": {"key": "platformVersion", "type": "str"}, + "environment_variables": {"key": "environmentVariables", "type": "[EnvironmentVariable]"}, + "pre_build_steps": {"key": "preBuildSteps", "type": "[PreBuildStep]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.base_os = None + self.platform = None + self.platform_version = None + self.environment_variables = None + self.pre_build_steps = None + + +class ContainerAppsBuildResource(ProxyResource): + """Information pertaining to an individual build. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar provisioning_state: Build provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.BuildProvisioningState + :ivar build_status: Status of the build once it has been provisioned. Known values are: + "NotStarted", "InProgress", "Succeeded", "Canceled", and "Failed". + :vartype build_status: str or ~azure.mgmt.appcontainers.models.BuildStatus + :ivar destination_container_registry: Container registry that the final image will be uploaded + to. + :vartype destination_container_registry: + ~azure.mgmt.appcontainers.models.ContainerRegistryWithCustomImage + :ivar configuration: Configuration of the build. + :vartype configuration: ~azure.mgmt.appcontainers.models.ContainerAppsBuildConfiguration + :ivar log_stream_endpoint: Endpoint from which the build logs can be streamed. + :vartype log_stream_endpoint: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "build_status": {"readonly": True}, + "destination_container_registry": {"readonly": True}, + "configuration": {"readonly": True}, + "log_stream_endpoint": {"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"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "build_status": {"key": "properties.buildStatus", "type": "str"}, + "destination_container_registry": { + "key": "properties.destinationContainerRegistry", + "type": "ContainerRegistryWithCustomImage", + }, + "configuration": {"key": "properties.configuration", "type": "ContainerAppsBuildConfiguration"}, + "log_stream_endpoint": {"key": "properties.logStreamEndpoint", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provisioning_state = None + self.build_status = None + self.destination_container_registry = None + self.configuration = None + self.log_stream_endpoint = None + + class ContainerAppSecret(_serialization.Model): """Container App Secret. @@ -3153,6 +3397,94 @@ def __init__(self, **kwargs: Any) -> None: self.key_vault_url = None +class ContainerAppsPatchResource(ProxyResource): + """Container App Patch. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar properties: Properties that describes current states of the patch resource. + :vartype properties: ~azure.mgmt.appcontainers.models.PatchProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"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": "PatchProperties"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.properties = None + + +class ContainerExecutionStatus(_serialization.Model): + """Container Apps Job execution container status. Contains status code and reason. + + :ivar name: Container Name. + :vartype name: str + :ivar code: Exit code. + :vartype code: int + :ivar additional_information: Additional information for the container status. + :vartype additional_information: str + :ivar status: Status of the container. + :vartype status: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "code": {"key": "code", "type": "int"}, + "additional_information": {"key": "additionalInformation", "type": "str"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + code: Optional[int] = None, + additional_information: Optional[str] = None, + status: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Container Name. + :paramtype name: str + :keyword code: Exit code. + :paramtype code: int + :keyword additional_information: Additional information for the container status. + :paramtype additional_information: str + :keyword status: Status of the container. + :paramtype status: str + """ + super().__init__(**kwargs) + self.name = name + self.code = code + self.additional_information = additional_information + self.status = status + + class ContainerRegistry(_serialization.Model): """Model representing a mapping from a container registry to the identity used to connect to it. @@ -3364,6 +3696,47 @@ def __init__( self.allow_credentials = allow_credentials +class CustomContainerTemplate(_serialization.Model): + """Custom container configuration. + + :ivar registry_credentials: Private container registry credentials for containers used by the + sessions of the session pool. + :vartype registry_credentials: ~azure.mgmt.appcontainers.models.SessionRegistryCredentials + :ivar containers: List of container definitions for the sessions of the session pool. + :vartype containers: list[~azure.mgmt.appcontainers.models.SessionContainer] + :ivar ingress: Session pool ingress configuration. + :vartype ingress: ~azure.mgmt.appcontainers.models.SessionIngress + """ + + _attribute_map = { + "registry_credentials": {"key": "registryCredentials", "type": "SessionRegistryCredentials"}, + "containers": {"key": "containers", "type": "[SessionContainer]"}, + "ingress": {"key": "ingress", "type": "SessionIngress"}, + } + + def __init__( + self, + *, + registry_credentials: Optional["_models.SessionRegistryCredentials"] = None, + containers: Optional[List["_models.SessionContainer"]] = None, + ingress: Optional["_models.SessionIngress"] = None, + **kwargs: Any + ) -> None: + """ + :keyword registry_credentials: Private container registry credentials for containers used by + the sessions of the session pool. + :paramtype registry_credentials: ~azure.mgmt.appcontainers.models.SessionRegistryCredentials + :keyword containers: List of container definitions for the sessions of the session pool. + :paramtype containers: list[~azure.mgmt.appcontainers.models.SessionContainer] + :keyword ingress: Session pool ingress configuration. + :paramtype ingress: ~azure.mgmt.appcontainers.models.SessionIngress + """ + super().__init__(**kwargs) + self.registry_credentials = registry_credentials + self.containers = containers + self.ingress = ingress + + class CustomDomain(_serialization.Model): """Custom Domain of a Container App. @@ -3737,12 +4110,16 @@ class CustomScaleRule(_serialization.Model): :vartype metadata: dict[str, str] :ivar auth: Authentication secrets for the custom scale rule. :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :vartype identity: str """ _attribute_map = { "type": {"key": "type", "type": "str"}, "metadata": {"key": "metadata", "type": "{str}"}, "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "identity": {"key": "identity", "type": "str"}, } def __init__( @@ -3751,6 +4128,7 @@ def __init__( type: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, auth: Optional[List["_models.ScaleRuleAuth"]] = None, + identity: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -3761,11 +4139,15 @@ def __init__( :paramtype metadata: dict[str, str] :keyword auth: Authentication secrets for the custom scale rule. :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :paramtype identity: str """ super().__init__(**kwargs) self.type = type self.metadata = metadata self.auth = auth + self.identity = identity class Dapr(_serialization.Model): @@ -3855,8 +4237,8 @@ class DaprComponent(ProxyResource): # pylint: disable=too-many-instance-attribu Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3997,8 +4379,8 @@ class DaprComponentResiliencyPolicy(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -4463,8 +4845,8 @@ class DaprSubscription(ProxyResource): # pylint: disable=too-many-instance-attr Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -5075,8 +5457,8 @@ class Diagnostics(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -5358,8 +5740,8 @@ class DotNetComponent(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -5369,8 +5751,7 @@ class DotNetComponent(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar component_type: Type of the .NET Component. Known values are: "AspireDashboard" and - "AspireResourceServerApi". + :ivar component_type: Type of the .NET Component. "AspireDashboard" :vartype component_type: str or ~azure.mgmt.appcontainers.models.DotNetComponentType :ivar provisioning_state: Provisioning state of the .NET Component. Known values are: "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". @@ -5411,8 +5792,7 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword component_type: Type of the .NET Component. Known values are: "AspireDashboard" and - "AspireResourceServerApi". + :keyword component_type: Type of the .NET Component. "AspireDashboard" :paramtype component_type: str or ~azure.mgmt.appcontainers.models.DotNetComponentType :keyword configurations: List of .NET Components configuration properties. :paramtype configurations: @@ -5512,6 +5892,38 @@ def __init__(self, *, name: Optional[str] = None, service_id: Optional[str] = No self.service_id = service_id +class DynamicPoolConfiguration(_serialization.Model): + """Dynamic pool configuration. + + :ivar execution_type: The execution type of the session pool. "Timed" + :vartype execution_type: str or ~azure.mgmt.appcontainers.models.ExecutionType + :ivar cooldown_period_in_seconds: The cooldown period of a session in seconds. + :vartype cooldown_period_in_seconds: int + """ + + _attribute_map = { + "execution_type": {"key": "executionType", "type": "str"}, + "cooldown_period_in_seconds": {"key": "cooldownPeriodInSeconds", "type": "int"}, + } + + def __init__( + self, + *, + execution_type: Optional[Union[str, "_models.ExecutionType"]] = None, + cooldown_period_in_seconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword execution_type: The execution type of the session pool. "Timed" + :paramtype execution_type: str or ~azure.mgmt.appcontainers.models.ExecutionType + :keyword cooldown_period_in_seconds: The cooldown period of a session in seconds. + :paramtype cooldown_period_in_seconds: int + """ + super().__init__(**kwargs) + self.execution_type = execution_type + self.cooldown_period_in_seconds = cooldown_period_in_seconds + + class EncryptionSettings(_serialization.Model): """The configuration settings of the secrets references of encryption key and signing key for ContainerApp Service Authentication/Authorization. @@ -5556,8 +5968,8 @@ class EnvironmentAuthToken(TrackedResource): All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -5755,6 +6167,80 @@ def __init__(self, **kwargs: Any) -> None: self.additional_info = None +class ErrorEntity(_serialization.Model): + """Body of the error response returned from the API. + + :ivar extended_code: Type of error. + :vartype extended_code: str + :ivar message_template: Message template. + :vartype message_template: str + :ivar parameters: Parameters for the template. + :vartype parameters: list[str] + :ivar inner_errors: Inner errors. + :vartype inner_errors: list[~azure.mgmt.appcontainers.models.ErrorEntity] + :ivar details: Error Details. + :vartype details: list[~azure.mgmt.appcontainers.models.ErrorEntity] + :ivar target: The error target. + :vartype target: str + :ivar code: Basic error code. + :vartype code: str + :ivar message: Any details of the error. + :vartype message: str + """ + + _attribute_map = { + "extended_code": {"key": "extendedCode", "type": "str"}, + "message_template": {"key": "messageTemplate", "type": "str"}, + "parameters": {"key": "parameters", "type": "[str]"}, + "inner_errors": {"key": "innerErrors", "type": "[ErrorEntity]"}, + "details": {"key": "details", "type": "[ErrorEntity]"}, + "target": {"key": "target", "type": "str"}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__( + self, + *, + extended_code: Optional[str] = None, + message_template: Optional[str] = None, + parameters: Optional[List[str]] = None, + inner_errors: Optional[List["_models.ErrorEntity"]] = None, + details: Optional[List["_models.ErrorEntity"]] = None, + target: Optional[str] = None, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword extended_code: Type of error. + :paramtype extended_code: str + :keyword message_template: Message template. + :paramtype message_template: str + :keyword parameters: Parameters for the template. + :paramtype parameters: list[str] + :keyword inner_errors: Inner errors. + :paramtype inner_errors: list[~azure.mgmt.appcontainers.models.ErrorEntity] + :keyword details: Error Details. + :paramtype details: list[~azure.mgmt.appcontainers.models.ErrorEntity] + :keyword target: The error target. + :paramtype target: str + :keyword code: Basic error code. + :paramtype code: str + :keyword message: Any details of the error. + :paramtype message: str + """ + super().__init__(**kwargs) + self.extended_code = extended_code + self.message_template = message_template + self.parameters = parameters + self.inner_errors = inner_errors + self.details = details + self.target = target + self.code = code + self.message = message + + class ErrorResponse(_serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). @@ -5776,6 +6262,26 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A self.error = error +class ExecutionStatus(_serialization.Model): + """Container Apps Job execution status. + + :ivar replicas: Replicas in the execution. + :vartype replicas: list[~azure.mgmt.appcontainers.models.ReplicaExecutionStatus] + """ + + _attribute_map = { + "replicas": {"key": "replicas", "type": "[ReplicaExecutionStatus]"}, + } + + def __init__(self, *, replicas: Optional[List["_models.ReplicaExecutionStatus"]] = None, **kwargs: Any) -> None: + """ + :keyword replicas: Replicas in the execution. + :paramtype replicas: list[~azure.mgmt.appcontainers.models.ReplicaExecutionStatus] + """ + super().__init__(**kwargs) + self.replicas = replicas + + class ExtendedLocation(_serialization.Model): """The complex type of the extended location. @@ -6357,11 +6863,15 @@ class HttpScaleRule(_serialization.Model): :vartype metadata: dict[str, str] :ivar auth: Authentication secrets for the custom scale rule. :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :vartype identity: str """ _attribute_map = { "metadata": {"key": "metadata", "type": "{str}"}, "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "identity": {"key": "identity", "type": "str"}, } def __init__( @@ -6369,6 +6879,7 @@ def __init__( *, metadata: Optional[Dict[str, str]] = None, auth: Optional[List["_models.ScaleRuleAuth"]] = None, + identity: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -6376,10 +6887,14 @@ def __init__( :paramtype metadata: dict[str, str] :keyword auth: Authentication secrets for the custom scale rule. :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :paramtype identity: str """ super().__init__(**kwargs) self.metadata = metadata self.auth = auth + self.identity = identity class HttpSettings(_serialization.Model): @@ -6532,6 +7047,44 @@ def __init__( self.custom_open_id_connect_providers = custom_open_id_connect_providers +class IdentitySettings(_serialization.Model): + """Optional settings for a Managed Identity that is assigned to the Container App. + + All required parameters must be populated in order to send to server. + + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. Required. + :vartype identity: str + :ivar lifecycle: Use to select the lifecycle stages of a Container App during which the Managed + Identity should be available. Known values are: "Init", "Main", "None", and "All". + :vartype lifecycle: str or ~azure.mgmt.appcontainers.models.IdentitySettingsLifeCycle + """ + + _validation = { + "identity": {"required": True}, + } + + _attribute_map = { + "identity": {"key": "identity", "type": "str"}, + "lifecycle": {"key": "lifecycle", "type": "str"}, + } + + def __init__( + self, *, identity: str, lifecycle: Union[str, "_models.IdentitySettingsLifeCycle"] = "All", **kwargs: Any + ) -> None: + """ + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. Required. + :paramtype identity: str + :keyword lifecycle: Use to select the lifecycle stages of a Container App during which the + Managed Identity should be available. Known values are: "Init", "Main", "None", and "All". + :paramtype lifecycle: str or ~azure.mgmt.appcontainers.models.IdentitySettingsLifeCycle + """ + super().__init__(**kwargs) + self.identity = identity + self.lifecycle = lifecycle + + class Ingress(_serialization.Model): # pylint: disable=too-many-instance-attributes """Container App Ingress configuration. @@ -6737,6 +7290,10 @@ class InitContainer(BaseContainer): :ivar image: Container image tag. :vartype image: str + :ivar image_type: The type of the image. Set to CloudBuild to let the system manages the image, + where user will not be able to update image through image field. Set to ContainerImage for user + provided image. Known values are: "CloudBuild" and "ContainerImage". + :vartype image_type: str or ~azure.mgmt.appcontainers.models.ImageType :ivar name: Custom container name. :vartype name: str :ivar command: Container start command. @@ -6815,8 +7372,8 @@ class JavaComponent(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -6826,8 +7383,96 @@ class JavaComponent(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar component_type: Type of the Java Component. Known values are: "SpringBootAdmin", - "SpringCloudEureka", and "SpringCloudConfig". + :ivar properties: Java Component resource specific properties. + :vartype properties: ~azure.mgmt.appcontainers.models.JavaComponentProperties + """ + + _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": "JavaComponentProperties"}, + } + + def __init__(self, *, properties: Optional["_models.JavaComponentProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Java Component resource specific properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.JavaComponentProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class JavaComponentConfigurationProperty(_serialization.Model): + """Configuration properties for a Java Component. + + :ivar property_name: The name of the property. + :vartype property_name: str + :ivar value: The value of the property. + :vartype value: str + """ + + _attribute_map = { + "property_name": {"key": "propertyName", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, property_name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword property_name: The name of the property. + :paramtype property_name: str + :keyword value: The value of the property. + :paramtype value: str + """ + super().__init__(**kwargs) + self.property_name = property_name + self.value = value + + +class JavaComponentIngress(_serialization.Model): + """Container App Ingress configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar fqdn: Hostname of the Java Component endpoint. + :vartype fqdn: str + """ + + _validation = { + "fqdn": {"readonly": True}, + } + + _attribute_map = { + "fqdn": {"key": "fqdn", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.fqdn = None + + +class JavaComponentProperties(_serialization.Model): + """Java Component common properties. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + NacosComponent, SpringBootAdminComponent, SpringCloudConfigComponent, + SpringCloudEurekaComponent, SpringCloudGatewayComponent + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar component_type: Type of the Java Component. Required. Known values are: + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType :ivar provisioning_state: Provisioning state of the Java Component. Known values are: "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". @@ -6836,78 +7481,88 @@ class JavaComponent(ProxyResource): :ivar configurations: List of Java Components configuration properties. :vartype configurations: list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar scale: Java component scaling configurations. + :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale :ivar service_binds: List of Java Components that are bound to the Java component. :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, + "component_type": {"required": True}, "provisioning_state": {"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"}, - "component_type": {"key": "properties.componentType", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "configurations": {"key": "properties.configurations", "type": "[JavaComponentConfigurationProperty]"}, - "service_binds": {"key": "properties.serviceBinds", "type": "[JavaComponentServiceBind]"}, + "component_type": {"key": "componentType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "configurations": {"key": "configurations", "type": "[JavaComponentConfigurationProperty]"}, + "scale": {"key": "scale", "type": "JavaComponentPropertiesScale"}, + "service_binds": {"key": "serviceBinds", "type": "[JavaComponentServiceBind]"}, + } + + _subtype_map = { + "component_type": { + "Nacos": "NacosComponent", + "SpringBootAdmin": "SpringBootAdminComponent", + "SpringCloudConfig": "SpringCloudConfigComponent", + "SpringCloudEureka": "SpringCloudEurekaComponent", + "SpringCloudGateway": "SpringCloudGatewayComponent", + } } def __init__( self, *, - component_type: Optional[Union[str, "_models.JavaComponentType"]] = None, configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + scale: Optional["_models.JavaComponentPropertiesScale"] = None, service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, **kwargs: Any ) -> None: """ - :keyword component_type: Type of the Java Component. Known values are: "SpringBootAdmin", - "SpringCloudEureka", and "SpringCloudConfig". - :paramtype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType :keyword configurations: List of Java Components configuration properties. :paramtype configurations: list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :keyword scale: Java component scaling configurations. + :paramtype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale :keyword service_binds: List of Java Components that are bound to the Java component. :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] """ super().__init__(**kwargs) - self.component_type = component_type + self.component_type: Optional[str] = None self.provisioning_state = None self.configurations = configurations + self.scale = scale self.service_binds = service_binds -class JavaComponentConfigurationProperty(_serialization.Model): - """Configuration properties for a Java Component. +class JavaComponentPropertiesScale(_serialization.Model): + """Java component scaling configurations. - :ivar property_name: The name of the property. - :vartype property_name: str - :ivar value: The value of the property. - :vartype value: str + :ivar min_replicas: Optional. Minimum number of Java component replicas. Defaults to 1 if not + set. + :vartype min_replicas: int + :ivar max_replicas: Optional. Maximum number of Java component replicas. + :vartype max_replicas: int """ _attribute_map = { - "property_name": {"key": "propertyName", "type": "str"}, - "value": {"key": "value", "type": "str"}, + "min_replicas": {"key": "minReplicas", "type": "int"}, + "max_replicas": {"key": "maxReplicas", "type": "int"}, } - def __init__(self, *, property_name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, *, min_replicas: Optional[int] = None, max_replicas: Optional[int] = None, **kwargs: Any + ) -> None: """ - :keyword property_name: The name of the property. - :paramtype property_name: str - :keyword value: The value of the property. - :paramtype value: str + :keyword min_replicas: Optional. Minimum number of Java component replicas. Defaults to 1 if + not set. + :paramtype min_replicas: int + :keyword max_replicas: Optional. Maximum number of Java component replicas. + :paramtype max_replicas: int """ super().__init__(**kwargs) - self.property_name = property_name - self.value = value + self.min_replicas = min_replicas + self.max_replicas = max_replicas class JavaComponentsCollection(_serialization.Model): @@ -6976,8 +7631,8 @@ class Job(TrackedResource): # pylint: disable=too-many-instance-attributes All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -7104,7 +7759,7 @@ class JobConfiguration(_serialization.Model): Properties replicaCompletionCount and parallelism would be set to 1 by default. :vartype manual_trigger_config: ~azure.mgmt.appcontainers.models.JobConfigurationManualTriggerConfig - :ivar schedule_trigger_config: Cron formatted repeating trigger schedule ("\ * * * * *") for + :ivar schedule_trigger_config: Cron formatted repeating trigger schedule ("\\ * * * * *") for cronjobs. Properties completions and parallelism would be set to 1 by default. :vartype schedule_trigger_config: ~azure.mgmt.appcontainers.models.JobConfigurationScheduleTriggerConfig @@ -7114,6 +7769,9 @@ class JobConfiguration(_serialization.Model): :ivar registries: Collection of private container registry credentials used by a Container apps job. :vartype registries: list[~azure.mgmt.appcontainers.models.RegistryCredentials] + :ivar identity_settings: Optional settings for Managed Identities that are assigned to the + Container App Job. If a Managed Identity is not specified here, default settings will be used. + :vartype identity_settings: list[~azure.mgmt.appcontainers.models.IdentitySettings] """ _validation = { @@ -7130,6 +7788,7 @@ class JobConfiguration(_serialization.Model): "schedule_trigger_config": {"key": "scheduleTriggerConfig", "type": "JobConfigurationScheduleTriggerConfig"}, "event_trigger_config": {"key": "eventTriggerConfig", "type": "JobConfigurationEventTriggerConfig"}, "registries": {"key": "registries", "type": "[RegistryCredentials]"}, + "identity_settings": {"key": "identitySettings", "type": "[IdentitySettings]"}, } def __init__( @@ -7143,6 +7802,7 @@ def __init__( schedule_trigger_config: Optional["_models.JobConfigurationScheduleTriggerConfig"] = None, event_trigger_config: Optional["_models.JobConfigurationEventTriggerConfig"] = None, registries: Optional[List["_models.RegistryCredentials"]] = None, + identity_settings: Optional[List["_models.IdentitySettings"]] = None, **kwargs: Any ) -> None: """ @@ -7159,8 +7819,8 @@ def __init__( Properties replicaCompletionCount and parallelism would be set to 1 by default. :paramtype manual_trigger_config: ~azure.mgmt.appcontainers.models.JobConfigurationManualTriggerConfig - :keyword schedule_trigger_config: Cron formatted repeating trigger schedule ("\ * * * * *") for - cronjobs. Properties completions and parallelism would be set to 1 by default. + :keyword schedule_trigger_config: Cron formatted repeating trigger schedule ("\\ * * * * *") + for cronjobs. Properties completions and parallelism would be set to 1 by default. :paramtype schedule_trigger_config: ~azure.mgmt.appcontainers.models.JobConfigurationScheduleTriggerConfig :keyword event_trigger_config: Trigger configuration of an event driven job. @@ -7169,6 +7829,9 @@ def __init__( :keyword registries: Collection of private container registry credentials used by a Container apps job. :paramtype registries: list[~azure.mgmt.appcontainers.models.RegistryCredentials] + :keyword identity_settings: Optional settings for Managed Identities that are assigned to the + Container App Job. If a Managed Identity is not specified here, default settings will be used. + :paramtype identity_settings: list[~azure.mgmt.appcontainers.models.IdentitySettings] """ super().__init__(**kwargs) self.secrets = secrets @@ -7179,6 +7842,7 @@ def __init__( self.schedule_trigger_config = schedule_trigger_config self.event_trigger_config = event_trigger_config self.registries = registries + self.identity_settings = identity_settings class JobConfigurationEventTriggerConfig(_serialization.Model): @@ -7254,7 +7918,7 @@ def __init__( class JobConfigurationScheduleTriggerConfig(_serialization.Model): - """Cron formatted repeating trigger schedule ("\ * * * * *") for cronjobs. Properties completions + """Cron formatted repeating trigger schedule ("\\ * * * * *") for cronjobs. Properties completions and parallelism would be set to 1 by default. All required parameters must be populated in order to send to server. @@ -7262,7 +7926,7 @@ class JobConfigurationScheduleTriggerConfig(_serialization.Model): :ivar replica_completion_count: Minimum number of successful replica completions before overall job completion. :vartype replica_completion_count: int - :ivar cron_expression: Cron formatted repeating schedule ("\ * * * * *") of a Cron Job. + :ivar cron_expression: Cron formatted repeating schedule ("\\ * * * * *") of a Cron Job. Required. :vartype cron_expression: str :ivar parallelism: Number of parallel replicas of a job that can run at a given time. @@ -7291,7 +7955,7 @@ def __init__( :keyword replica_completion_count: Minimum number of successful replica completions before overall job completion. :paramtype replica_completion_count: int - :keyword cron_expression: Cron formatted repeating schedule ("\ * * * * *") of a Cron Job. + :keyword cron_expression: Cron formatted repeating schedule ("\\ * * * * *") of a Cron Job. Required. :paramtype cron_expression: str :keyword parallelism: Number of parallel replicas of a job that can run at a given time. @@ -7323,6 +7987,8 @@ class JobExecution(_serialization.Model): :vartype end_time: ~datetime.datetime :ivar template: Job's execution container. :vartype template: ~azure.mgmt.appcontainers.models.JobExecutionTemplate + :ivar detailed_status: Detailed status of the job execution. + :vartype detailed_status: ~azure.mgmt.appcontainers.models.ExecutionStatus """ _validation = { @@ -7337,6 +8003,7 @@ class JobExecution(_serialization.Model): "start_time": {"key": "properties.startTime", "type": "iso-8601"}, "end_time": {"key": "properties.endTime", "type": "iso-8601"}, "template": {"key": "properties.template", "type": "JobExecutionTemplate"}, + "detailed_status": {"key": "properties.detailedStatus", "type": "ExecutionStatus"}, } def __init__( @@ -7348,6 +8015,7 @@ def __init__( start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, template: Optional["_models.JobExecutionTemplate"] = None, + detailed_status: Optional["_models.ExecutionStatus"] = None, **kwargs: Any ) -> None: """ @@ -7363,6 +8031,8 @@ def __init__( :paramtype end_time: ~datetime.datetime :keyword template: Job's execution container. :paramtype template: ~azure.mgmt.appcontainers.models.JobExecutionTemplate + :keyword detailed_status: Detailed status of the job execution. + :paramtype detailed_status: ~azure.mgmt.appcontainers.models.ExecutionStatus """ super().__init__(**kwargs) self.name = name @@ -7372,6 +8042,7 @@ def __init__( self.start_time = start_time self.end_time = end_time self.template = template + self.detailed_status = detailed_status class JobExecutionBase(_serialization.Model): @@ -7687,6 +8358,9 @@ class JobScaleRule(_serialization.Model): :vartype metadata: JSON :ivar auth: Authentication secrets for the scale rule. :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + job, or 'system' for system-assigned identity. + :vartype identity: str """ _attribute_map = { @@ -7694,6 +8368,7 @@ class JobScaleRule(_serialization.Model): "type": {"key": "type", "type": "str"}, "metadata": {"key": "metadata", "type": "object"}, "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "identity": {"key": "identity", "type": "str"}, } def __init__( @@ -7703,6 +8378,7 @@ def __init__( type: Optional[str] = None, metadata: Optional[JSON] = None, auth: Optional[List["_models.ScaleRuleAuth"]] = None, + identity: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -7715,12 +8391,16 @@ def __init__( :paramtype metadata: JSON :keyword auth: Authentication secrets for the scale rule. :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + job, or 'system' for system-assigned identity. + :paramtype identity: str """ super().__init__(**kwargs) self.name = name self.type = type self.metadata = metadata self.auth = auth + self.identity = identity class JobsCollection(_serialization.Model): @@ -7949,52 +8629,131 @@ def __init__( self.dynamic_json_columns = dynamic_json_columns -class Login(_serialization.Model): - """The configuration settings of the login flow of users using ContainerApp Service - Authentication/Authorization. +class LoggerSetting(_serialization.Model): + """Logger settings for java workloads. - :ivar routes: The routes that specify the endpoints used for login and logout requests. - :vartype routes: ~azure.mgmt.appcontainers.models.LoginRoutes - :ivar token_store: The configuration settings of the token store. - :vartype token_store: ~azure.mgmt.appcontainers.models.TokenStore - :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 - :ivar allowed_external_redirect_urls: External URLs that can be redirected to as part of - logging in or logging out of the app. Note that the query string part of the URL is ignored. - This is an advanced setting typically only needed by Windows Store application backends. - 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: ~azure.mgmt.appcontainers.models.CookieExpiration - :ivar nonce: The configuration settings of the nonce used in the login flow. - :vartype nonce: ~azure.mgmt.appcontainers.models.Nonce + All required parameters must be populated in order to send to server. + + :ivar logger: Logger name. Required. + :vartype logger: str + :ivar level: The specified logger's log level. Required. Known values are: "off", "error", + "info", "debug", "trace", and "warn". + :vartype level: str or ~azure.mgmt.appcontainers.models.Level """ + _validation = { + "logger": {"required": True}, + "level": {"required": True}, + } + _attribute_map = { - "routes": {"key": "routes", "type": "LoginRoutes"}, - "token_store": {"key": "tokenStore", "type": "TokenStore"}, - "preserve_url_fragments_for_logins": {"key": "preserveUrlFragmentsForLogins", "type": "bool"}, - "allowed_external_redirect_urls": {"key": "allowedExternalRedirectUrls", "type": "[str]"}, - "cookie_expiration": {"key": "cookieExpiration", "type": "CookieExpiration"}, - "nonce": {"key": "nonce", "type": "Nonce"}, + "logger": {"key": "logger", "type": "str"}, + "level": {"key": "level", "type": "str"}, } - def __init__( - self, - *, - routes: Optional["_models.LoginRoutes"] = None, - token_store: Optional["_models.TokenStore"] = None, - preserve_url_fragments_for_logins: Optional[bool] = None, - allowed_external_redirect_urls: Optional[List[str]] = None, - cookie_expiration: Optional["_models.CookieExpiration"] = None, - nonce: Optional["_models.Nonce"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, logger: str, level: Union[str, "_models.Level"], **kwargs: Any) -> None: """ - :keyword routes: The routes that specify the endpoints used for login and logout requests. - :paramtype routes: ~azure.mgmt.appcontainers.models.LoginRoutes - :keyword token_store: The configuration settings of the token store. + :keyword logger: Logger name. Required. + :paramtype logger: str + :keyword level: The specified logger's log level. Required. Known values are: "off", "error", + "info", "debug", "trace", and "warn". + :paramtype level: str or ~azure.mgmt.appcontainers.models.Level + """ + super().__init__(**kwargs) + self.logger = logger + self.level = level + + +class LogicApp(ProxyResource): + """A logic app extension 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: JSON + """ + + _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": "object"}, + } + + def __init__(self, *, properties: Optional[JSON] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: JSON + """ + super().__init__(**kwargs) + self.properties = properties + + +class Login(_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: ~azure.mgmt.appcontainers.models.LoginRoutes + :ivar token_store: The configuration settings of the token store. + :vartype token_store: ~azure.mgmt.appcontainers.models.TokenStore + :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 + :ivar allowed_external_redirect_urls: External URLs that can be redirected to as part of + logging in or logging out of the app. Note that the query string part of the URL is ignored. + This is an advanced setting typically only needed by Windows Store application backends. + 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: ~azure.mgmt.appcontainers.models.CookieExpiration + :ivar nonce: The configuration settings of the nonce used in the login flow. + :vartype nonce: ~azure.mgmt.appcontainers.models.Nonce + """ + + _attribute_map = { + "routes": {"key": "routes", "type": "LoginRoutes"}, + "token_store": {"key": "tokenStore", "type": "TokenStore"}, + "preserve_url_fragments_for_logins": {"key": "preserveUrlFragmentsForLogins", "type": "bool"}, + "allowed_external_redirect_urls": {"key": "allowedExternalRedirectUrls", "type": "[str]"}, + "cookie_expiration": {"key": "cookieExpiration", "type": "CookieExpiration"}, + "nonce": {"key": "nonce", "type": "Nonce"}, + } + + def __init__( + self, + *, + routes: Optional["_models.LoginRoutes"] = None, + token_store: Optional["_models.TokenStore"] = None, + preserve_url_fragments_for_logins: Optional[bool] = None, + allowed_external_redirect_urls: Optional[List[str]] = None, + cookie_expiration: Optional["_models.CookieExpiration"] = None, + nonce: Optional["_models.Nonce"] = None, + **kwargs: Any + ) -> None: + """ + :keyword routes: The routes that specify the endpoints used for login and logout requests. + :paramtype routes: ~azure.mgmt.appcontainers.models.LoginRoutes + :keyword token_store: The configuration settings of the token store. :paramtype token_store: ~azure.mgmt.appcontainers.models.TokenStore :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`. @@ -8086,8 +8845,8 @@ class ManagedCertificate(TrackedResource): All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -8262,8 +9021,8 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -8330,6 +9089,15 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- :ivar peer_authentication: Peer authentication settings for the Managed Environment. :vartype peer_authentication: ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerAuthentication + :ivar peer_traffic_configuration: Peer traffic settings for the Managed Environment. + :vartype peer_traffic_configuration: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfiguration + :ivar private_endpoint_connections: Private endpoint connections to the resource. + :vartype private_endpoint_connections: + list[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :ivar public_network_access: Property to allow or block all public traffic. Allowed Values: + 'Enabled', 'Disabled'. Known values are: "Enabled" and "Disabled". + :vartype public_network_access: str or ~azure.mgmt.appcontainers.models.PublicNetworkAccess """ _validation = { @@ -8343,6 +9111,7 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- "default_domain": {"readonly": True}, "static_ip": {"readonly": True}, "event_stream_endpoint": {"readonly": True}, + "private_endpoint_connections": {"readonly": True}, } _attribute_map = { @@ -8384,6 +9153,15 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- "key": "properties.peerAuthentication", "type": "ManagedEnvironmentPropertiesPeerAuthentication", }, + "peer_traffic_configuration": { + "key": "properties.peerTrafficConfiguration", + "type": "ManagedEnvironmentPropertiesPeerTrafficConfiguration", + }, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[PrivateEndpointConnection]", + }, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, } def __init__( # pylint: disable=too-many-locals @@ -8406,6 +9184,8 @@ def __init__( # pylint: disable=too-many-locals dapr_configuration: Optional["_models.DaprConfiguration"] = None, infrastructure_resource_group: Optional[str] = None, peer_authentication: Optional["_models.ManagedEnvironmentPropertiesPeerAuthentication"] = None, + peer_traffic_configuration: Optional["_models.ManagedEnvironmentPropertiesPeerTrafficConfiguration"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs: Any ) -> None: """ @@ -8454,6 +9234,12 @@ def __init__( # pylint: disable=too-many-locals :keyword peer_authentication: Peer authentication settings for the Managed Environment. :paramtype peer_authentication: ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerAuthentication + :keyword peer_traffic_configuration: Peer traffic settings for the Managed Environment. + :paramtype peer_traffic_configuration: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfiguration + :keyword public_network_access: Property to allow or block all public traffic. Allowed Values: + 'Enabled', 'Disabled'. Known values are: "Enabled" and "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.appcontainers.models.PublicNetworkAccess """ super().__init__(tags=tags, location=location, **kwargs) self.kind = kind @@ -8476,6 +9262,9 @@ def __init__( # pylint: disable=too-many-locals self.dapr_configuration = dapr_configuration self.infrastructure_resource_group = infrastructure_resource_group self.peer_authentication = peer_authentication + self.peer_traffic_configuration = peer_traffic_configuration + self.private_endpoint_connections = None + self.public_network_access = public_network_access class ManagedEnvironmentPropertiesPeerAuthentication(_serialization.Model): # pylint: disable=name-too-long @@ -8498,6 +9287,55 @@ def __init__(self, *, mtls: Optional["_models.Mtls"] = None, **kwargs: Any) -> N self.mtls = mtls +class ManagedEnvironmentPropertiesPeerTrafficConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Peer traffic settings for the Managed Environment. + + :ivar encryption: Peer traffic encryption settings for the Managed Environment. + :vartype encryption: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption + """ + + _attribute_map = { + "encryption": {"key": "encryption", "type": "ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption"}, + } + + def __init__( + self, + *, + encryption: Optional["_models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption"] = None, + **kwargs: Any + ) -> None: + """ + :keyword encryption: Peer traffic encryption settings for the Managed Environment. + :paramtype encryption: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption + """ + super().__init__(**kwargs) + self.encryption = encryption + + +class ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption( + _serialization.Model +): # pylint: disable=name-too-long + """Peer traffic encryption settings for the Managed Environment. + + :ivar enabled: Boolean indicating whether the peer traffic encryption is enabled. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Boolean indicating whether the peer traffic encryption is enabled. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + class ManagedEnvironmentsCollection(_serialization.Model): """Collection of Environments. @@ -8536,8 +9374,8 @@ class ManagedEnvironmentStorage(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -8739,6 +9577,70 @@ def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: self.enabled = enabled +class NacosComponent(JavaComponentProperties): + """Nacos properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar component_type: Type of the Java Component. Required. Known values are: + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :ivar provisioning_state: Provisioning state of the Java Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState + :ivar configurations: List of Java Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar scale: Java component scaling configurations. + :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :ivar service_binds: List of Java Components that are bound to the Java component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :ivar ingress: Java Component Ingress configurations. + :vartype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress + """ + + _validation = { + "component_type": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "component_type": {"key": "componentType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "configurations": {"key": "configurations", "type": "[JavaComponentConfigurationProperty]"}, + "scale": {"key": "scale", "type": "JavaComponentPropertiesScale"}, + "service_binds": {"key": "serviceBinds", "type": "[JavaComponentServiceBind]"}, + "ingress": {"key": "ingress", "type": "JavaComponentIngress"}, + } + + def __init__( + self, + *, + configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + scale: Optional["_models.JavaComponentPropertiesScale"] = None, + service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, + ingress: Optional["_models.JavaComponentIngress"] = None, + **kwargs: Any + ) -> None: + """ + :keyword configurations: List of Java Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :keyword scale: Java component scaling configurations. + :paramtype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :keyword service_binds: List of Java Components that are bound to the Java component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :keyword ingress: Java Component Ingress configurations. + :paramtype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress + """ + super().__init__(configurations=configurations, scale=scale, service_binds=service_binds, **kwargs) + self.component_type: str = "Nacos" + self.ingress = ingress + + class NfsAzureFileProperties(_serialization.Model): """NFS Azure File Properties. @@ -9157,180 +10059,342 @@ def __init__( self.headers = headers -class PreBuildStep(_serialization.Model): - """Model representing a pre-build step. +class PatchCollection(_serialization.Model): + """Container App patch collection. - :ivar description: Description of the pre-build step. - :vartype description: str - :ivar scripts: List of custom commands to run. - :vartype scripts: list[str] - :ivar http_get: Http get request to send before the build. - :vartype http_get: ~azure.mgmt.appcontainers.models.HttpGet + All required parameters must be populated in order to send to server. + + :ivar value: Collection of patch resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :ivar next_link: the link to the next page of items. + :vartype next_link: str """ + _validation = { + "value": {"required": True}, + } + _attribute_map = { - "description": {"key": "description", "type": "str"}, - "scripts": {"key": "scripts", "type": "[str]"}, - "http_get": {"key": "httpGet", "type": "HttpGet"}, + "value": {"key": "value", "type": "[ContainerAppsPatchResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - description: Optional[str] = None, - scripts: Optional[List[str]] = None, - http_get: Optional["_models.HttpGet"] = None, - **kwargs: Any + self, *, value: List["_models.ContainerAppsPatchResource"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword description: Description of the pre-build step. - :paramtype description: str - :keyword scripts: List of custom commands to run. - :paramtype scripts: list[str] - :keyword http_get: Http get request to send before the build. - :paramtype http_get: ~azure.mgmt.appcontainers.models.HttpGet + :keyword value: Collection of patch resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :keyword next_link: the link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) - self.description = description - self.scripts = scripts - self.http_get = http_get + self.value = value + self.next_link = next_link -class QueueScaleRule(_serialization.Model): - """Container App container Azure Queue based scaling rule. +class PatchDetails(_serialization.Model): + """The detailed info of patch operation performing when applying a patch. - :ivar queue_name: Queue name. - :vartype queue_name: str - :ivar queue_length: Queue length. - :vartype queue_length: int - :ivar auth: Authentication secrets for the queue scale rule. - :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar target_container_name: The name of the target container for the patch. Required. + :vartype target_container_name: str + :ivar target_image: The name of the target image for the patch. Required. + :vartype target_image: str + :ivar last_detection_time: The UTC timestamp that describes the latest detection was done. + Required. + :vartype last_detection_time: ~datetime.datetime + :ivar detection_status: The status of the patch detection. Required. Known values are: + "Succeeded", "RegistryLoginFailed", and "Failed". + :vartype detection_status: str or ~azure.mgmt.appcontainers.models.DetectionStatus + :ivar new_image_name: The name of the new image created by the patch. + :vartype new_image_name: str + :ivar new_layer: New layer update details in the target image. + :vartype new_layer: ~azure.mgmt.appcontainers.models.PatchDetailsNewLayer + :ivar old_layer: The old layer details in the target image. + :vartype old_layer: ~azure.mgmt.appcontainers.models.PatchDetailsOldLayer + :ivar patch_type: The type for the patch. Known values are: "FrameworkSecurity", "OSSecurity", + "FrameworkAndOSSecurity", and "Other". + :vartype patch_type: str or ~azure.mgmt.appcontainers.models.PatchType """ + _validation = { + "target_container_name": {"required": True, "readonly": True}, + "target_image": {"required": True, "readonly": True}, + "last_detection_time": {"required": True, "readonly": True}, + "detection_status": {"required": True, "readonly": True}, + "new_image_name": {"readonly": True}, + "new_layer": {"readonly": True}, + "old_layer": {"readonly": True}, + "patch_type": {"readonly": True}, + } + _attribute_map = { - "queue_name": {"key": "queueName", "type": "str"}, - "queue_length": {"key": "queueLength", "type": "int"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "target_container_name": {"key": "targetContainerName", "type": "str"}, + "target_image": {"key": "targetImage", "type": "str"}, + "last_detection_time": {"key": "lastDetectionTime", "type": "iso-8601"}, + "detection_status": {"key": "detectionStatus", "type": "str"}, + "new_image_name": {"key": "newImageName", "type": "str"}, + "new_layer": {"key": "newLayer", "type": "PatchDetailsNewLayer"}, + "old_layer": {"key": "oldLayer", "type": "PatchDetailsOldLayer"}, + "patch_type": {"key": "patchType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.target_container_name = None + self.target_image = None + self.last_detection_time = None + self.detection_status = None + self.new_image_name = None + self.new_layer = None + self.old_layer = None + self.patch_type = None + + +class PatchDetailsNewLayer(_serialization.Model): + """New layer update details in the target image. + + :ivar name: The details of the new layer for the target image. + :vartype name: str + :ivar framework_and_version: The framework and its version in the new run image for the target + image. + :vartype framework_and_version: str + :ivar os_and_version: The OS name and its version in the new run image for the target image. + :vartype os_and_version: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "framework_and_version": {"key": "frameworkAndVersion", "type": "str"}, + "os_and_version": {"key": "osAndVersion", "type": "str"}, } def __init__( self, *, - queue_name: Optional[str] = None, - queue_length: Optional[int] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, + name: Optional[str] = None, + framework_and_version: Optional[str] = None, + os_and_version: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword queue_name: Queue name. - :paramtype queue_name: str - :keyword queue_length: Queue length. - :paramtype queue_length: int - :keyword auth: Authentication secrets for the queue scale rule. - :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword name: The details of the new layer for the target image. + :paramtype name: str + :keyword framework_and_version: The framework and its version in the new run image for the + target image. + :paramtype framework_and_version: str + :keyword os_and_version: The OS name and its version in the new run image for the target image. + :paramtype os_and_version: str """ super().__init__(**kwargs) - self.queue_name = queue_name - self.queue_length = queue_length - self.auth = auth + self.name = name + self.framework_and_version = framework_and_version + self.os_and_version = os_and_version -class RegistryCredentials(_serialization.Model): - """Container App Private Registry. +class PatchDetailsOldLayer(_serialization.Model): + """The old layer details in the target image. - :ivar server: Container Registry Server. - :vartype server: str - :ivar username: Container Registry Username. - :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 + :ivar name: The details of the old layer for the target image. + :vartype name: str + :ivar framework_and_version: The framework and its version in the old run image for the target + image. + :vartype framework_and_version: str + :ivar os_and_version: The OS name and its version in the old run image for the target image. + :vartype os_and_version: 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"}, + "name": {"key": "name", "type": "str"}, + "framework_and_version": {"key": "frameworkAndVersion", "type": "str"}, + "os_and_version": {"key": "osAndVersion", "type": "str"}, } def __init__( self, *, - server: Optional[str] = None, - username: Optional[str] = None, - password_secret_ref: Optional[str] = None, - identity: Optional[str] = None, + name: Optional[str] = None, + framework_and_version: Optional[str] = None, + os_and_version: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword server: Container Registry Server. - :paramtype server: str - :keyword username: Container Registry Username. - :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 + :keyword name: The details of the old layer for the target image. + :paramtype name: str + :keyword framework_and_version: The framework and its version in the old run image for the + target image. + :paramtype framework_and_version: str + :keyword os_and_version: The OS name and its version in the old run image for the target image. + :paramtype os_and_version: str """ super().__init__(**kwargs) - self.server = server - self.username = username - self.password_secret_ref = password_secret_ref - self.identity = identity + self.name = name + self.framework_and_version = framework_and_version + self.os_and_version = os_and_version -class RegistryInfo(_serialization.Model): - """Container App registry information. +class PatchProperties(_serialization.Model): + """Top level properties that describes current states of the patch resource. - :ivar registry_url: registry server Url. - :vartype registry_url: str - :ivar registry_user_name: registry username. - :vartype registry_user_name: str - :ivar registry_password: registry secret. - :vartype registry_password: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar target_environment_id: The Azure resource id of the target environment for the patch. + :vartype target_environment_id: str + :ivar target_container_app_id: The Azure resource id of the target container app for the patch. + :vartype target_container_app_id: str + :ivar target_revision_id: The Azure resource id of the target revision for the patch. + :vartype target_revision_id: str + :ivar patch_apply_status: The status of the patch operation. Known values are: "NotStarted", + "RebaseInProgress", "CreatingRevision", "Succeeded", "Canceled", "RebaseFailed", + "RevisionCreationFailed", "ImagePushPullFailed", and "ManuallySkipped". + :vartype patch_apply_status: str or ~azure.mgmt.appcontainers.models.PatchApplyStatus + :ivar created_at: The UTC timestamp that describes when the patch object was created. + :vartype created_at: ~datetime.datetime + :ivar last_modified_at: The UTC timestamp that describes when the patch object was last + updated. + :vartype last_modified_at: ~datetime.datetime + :ivar patch_details: Detailed info describes the patch operation for the target container app. + :vartype patch_details: list[~azure.mgmt.appcontainers.models.PatchDetails] """ + _validation = { + "patch_apply_status": {"readonly": True}, + "created_at": {"readonly": True}, + "last_modified_at": {"readonly": True}, + "patch_details": {"readonly": True}, + } + _attribute_map = { - "registry_url": {"key": "registryUrl", "type": "str"}, - "registry_user_name": {"key": "registryUserName", "type": "str"}, - "registry_password": {"key": "registryPassword", "type": "str"}, + "target_environment_id": {"key": "targetEnvironmentId", "type": "str"}, + "target_container_app_id": {"key": "targetContainerAppId", "type": "str"}, + "target_revision_id": {"key": "targetRevisionId", "type": "str"}, + "patch_apply_status": {"key": "patchApplyStatus", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + "patch_details": {"key": "patchDetails", "type": "[PatchDetails]"}, } def __init__( self, *, - registry_url: Optional[str] = None, - registry_user_name: Optional[str] = None, - registry_password: Optional[str] = None, + target_environment_id: Optional[str] = None, + target_container_app_id: Optional[str] = None, + target_revision_id: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword registry_url: registry server Url. - :paramtype registry_url: str - :keyword registry_user_name: registry username. - :paramtype registry_user_name: str - :keyword registry_password: registry secret. - :paramtype registry_password: str + :keyword target_environment_id: The Azure resource id of the target environment for the patch. + :paramtype target_environment_id: str + :keyword target_container_app_id: The Azure resource id of the target container app for the + patch. + :paramtype target_container_app_id: str + :keyword target_revision_id: The Azure resource id of the target revision for the patch. + :paramtype target_revision_id: str """ super().__init__(**kwargs) - self.registry_url = registry_url - self.registry_user_name = registry_user_name - self.registry_password = registry_password + self.target_environment_id = target_environment_id + self.target_container_app_id = target_container_app_id + self.target_revision_id = target_revision_id + self.patch_apply_status = None + self.created_at = None + self.last_modified_at = None + self.patch_details = None -class Replica(ProxyResource): - """Container App Revision Replica. +class PatchSkipConfig(_serialization.Model): + """The configuration for patcher to skip a patch or not. + + :ivar skip: The flag to indicate whether to skip the patch or not. + :vartype skip: bool + """ + + _attribute_map = { + "skip": {"key": "skip", "type": "bool"}, + } + + def __init__(self, *, skip: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword skip: The flag to indicate whether to skip the patch or not. + :paramtype skip: bool + """ + super().__init__(**kwargs) + self.skip = skip + + +class PreBuildStep(_serialization.Model): + """Model representing a pre-build step. + + :ivar description: Description of the pre-build step. + :vartype description: str + :ivar scripts: List of custom commands to run. + :vartype scripts: list[str] + :ivar http_get: Http get request to send before the build. + :vartype http_get: ~azure.mgmt.appcontainers.models.HttpGet + """ + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "scripts": {"key": "scripts", "type": "[str]"}, + "http_get": {"key": "httpGet", "type": "HttpGet"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + scripts: Optional[List[str]] = None, + http_get: Optional["_models.HttpGet"] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: Description of the pre-build step. + :paramtype description: str + :keyword scripts: List of custom commands to run. + :paramtype scripts: list[str] + :keyword http_get: Http get request to send before the build. + :paramtype http_get: ~azure.mgmt.appcontainers.models.HttpGet + """ + super().__init__(**kwargs) + self.description = description + self.scripts = scripts + self.http_get = http_get + + +class PrivateEndpoint(_serialization.Model): + """The Private Endpoint resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str + """ + + _validation = { + "id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(Resource): + """The Private Endpoint Connection 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -9340,17 +10404,19 @@ class Replica(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar created_time: Timestamp describing when the pod was created by controller. - :vartype created_time: ~datetime.datetime - :ivar running_state: Current running state of the replica. Known values are: "Running", - "NotRunning", and "Unknown". - :vartype running_state: str or ~azure.mgmt.appcontainers.models.ContainerAppReplicaRunningState - :ivar running_state_details: The details of replica current running state. - :vartype running_state_details: str - :ivar containers: The containers collection under a replica. - :vartype containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] - :ivar init_containers: The init containers collection under a replica. - :vartype init_containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] + :ivar group_ids: The group ids for the private endpoint resource. + :vartype group_ids: list[str] + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.appcontainers.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: + ~azure.mgmt.appcontainers.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Known values are: "Succeeded", "Failed", "Canceled", "Waiting", "Updating", "Deleting", and + "Pending". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.PrivateEndpointConnectionProvisioningState """ _validation = { @@ -9358,9 +10424,8 @@ class Replica(ProxyResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "created_time": {"readonly": True}, - "running_state": {"readonly": True}, - "running_state_details": {"readonly": True}, + "group_ids": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -9368,147 +10433,1351 @@ class Replica(ProxyResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "created_time": {"key": "properties.createdTime", "type": "iso-8601"}, - "running_state": {"key": "properties.runningState", "type": "str"}, - "running_state_details": {"key": "properties.runningStateDetails", "type": "str"}, - "containers": {"key": "properties.containers", "type": "[ReplicaContainer]"}, - "init_containers": {"key": "properties.initContainers", "type": "[ReplicaContainer]"}, + "group_ids": {"key": "properties.groupIds", "type": "[str]"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } def __init__( self, *, - containers: Optional[List["_models.ReplicaContainer"]] = None, - init_containers: Optional[List["_models.ReplicaContainer"]] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs: Any ) -> None: """ - :keyword containers: The containers collection under a replica. - :paramtype containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] - :keyword init_containers: The init containers collection under a replica. - :paramtype init_containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.appcontainers.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.appcontainers.models.PrivateLinkServiceConnectionState """ super().__init__(**kwargs) - self.created_time = None - self.running_state = None - self.running_state_details = None - self.containers = containers - self.init_containers = init_containers + self.group_ids = None + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None -class ReplicaCollection(_serialization.Model): - """Container App Revision Replicas collection ARM resource. +class PrivateEndpointConnectionListResult(_serialization.Model): + """List of private endpoint connection associated with the specified resource. - All required parameters must be populated in order to send to server. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.Replica] + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str """ _validation = { - "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[Replica]"}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.Replica"], **kwargs: Any) -> None: + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.Replica] + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] """ super().__init__(**kwargs) self.value = value + self.next_link = None -class ReplicaContainer(_serialization.Model): - """Container object under Container App Revision Replica. +class PrivateLinkResource(Resource): + """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: The Name of the Container. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. :vartype name: str - :ivar container_id: The Id of the Container. - :vartype container_id: str - :ivar ready: The container ready status. - :vartype ready: bool - :ivar started: The container start status. - :vartype started: bool - :ivar restart_count: The container restart count. - :vartype restart_count: int - :ivar running_state: Current running state of the container. Known values are: "Running", - "Terminated", and "Waiting". - :vartype running_state: str or - ~azure.mgmt.appcontainers.models.ContainerAppContainerRunningState - :ivar running_state_details: The details of container current running state. - :vartype running_state_details: str - :ivar log_stream_endpoint: Log Stream endpoint. - :vartype log_stream_endpoint: str - :ivar exec_endpoint: Container exec endpoint. - :vartype exec_endpoint: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { - "running_state": {"readonly": True}, - "running_state_details": {"readonly": True}, - "log_stream_endpoint": {"readonly": True}, - "exec_endpoint": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "group_id": {"readonly": True}, + "required_members": {"readonly": True}, } _attribute_map = { + "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, - "container_id": {"key": "containerId", "type": "str"}, - "ready": {"key": "ready", "type": "bool"}, - "started": {"key": "started", "type": "bool"}, - "restart_count": {"key": "restartCount", "type": "int"}, - "running_state": {"key": "runningState", "type": "str"}, - "running_state_details": {"key": "runningStateDetails", "type": "str"}, - "log_stream_endpoint": {"key": "logStreamEndpoint", "type": "str"}, - "exec_endpoint": {"key": "execEndpoint", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "group_id": {"key": "properties.groupId", "type": "str"}, + "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, + "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, } - def __init__( - self, - *, - name: Optional[str] = None, - container_id: Optional[str] = None, - ready: Optional[bool] = None, - started: Optional[bool] = None, - restart_count: Optional[int] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs: Any) -> None: """ - :keyword name: The Name of the Container. - :paramtype name: str - :keyword container_id: The Id of the Container. - :paramtype container_id: str - :keyword ready: The container ready status. - :paramtype ready: bool - :keyword started: The container start status. + :keyword required_zone_names: The private link resource private link DNS zone name. + :paramtype required_zone_names: list[str] + """ + super().__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names + + +class PrivateLinkResourceListResult(_serialization.Model): + """A list of private link resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.appcontainers.models.PrivateLinkResource] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[PrivateLinkResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs: Any) -> None: + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.appcontainers.models.PrivateLinkResource] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class PrivateLinkServiceConnectionState(_serialization.Model): + """A collection of information about the state of the connection between service consumer and + provider. + + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". + :vartype status: str or ~azure.mgmt.appcontainers.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype actions_required: str + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "actions_required": {"key": "actionsRequired", "type": "str"}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". + :paramtype status: str or + ~azure.mgmt.appcontainers.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str + """ + super().__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class QueueScaleRule(_serialization.Model): + """Container App container Azure Queue based scaling rule. + + :ivar account_name: Storage account name. required if using managed identity to authenticate. + :vartype account_name: str + :ivar queue_name: Queue name. + :vartype queue_name: str + :ivar queue_length: Queue length. + :vartype queue_length: int + :ivar auth: Authentication secrets for the queue scale rule. + :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :vartype identity: str + """ + + _attribute_map = { + "account_name": {"key": "accountName", "type": "str"}, + "queue_name": {"key": "queueName", "type": "str"}, + "queue_length": {"key": "queueLength", "type": "int"}, + "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "identity": {"key": "identity", "type": "str"}, + } + + def __init__( + self, + *, + account_name: Optional[str] = None, + queue_name: Optional[str] = None, + queue_length: Optional[int] = None, + auth: Optional[List["_models.ScaleRuleAuth"]] = None, + identity: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword account_name: Storage account name. required if using managed identity to + authenticate. + :paramtype account_name: str + :keyword queue_name: Queue name. + :paramtype queue_name: str + :keyword queue_length: Queue length. + :paramtype queue_length: int + :keyword auth: Authentication secrets for the queue scale rule. + :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :paramtype identity: str + """ + super().__init__(**kwargs) + self.account_name = account_name + self.queue_name = queue_name + self.queue_length = queue_length + self.auth = auth + self.identity = identity + + +class RegistryCredentials(_serialization.Model): + """Container App Private Registry. + + :ivar server: Container Registry Server. + :vartype server: str + :ivar username: Container Registry Username. + :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__( + self, + *, + server: Optional[str] = None, + username: Optional[str] = None, + password_secret_ref: Optional[str] = None, + identity: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword server: Container Registry Server. + :paramtype server: str + :keyword username: Container Registry Username. + :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().__init__(**kwargs) + self.server = server + self.username = username + self.password_secret_ref = password_secret_ref + self.identity = identity + + +class RegistryInfo(_serialization.Model): + """Container App registry information. + + :ivar registry_url: registry server Url. + :vartype registry_url: str + :ivar registry_user_name: registry username. + :vartype registry_user_name: str + :ivar registry_password: registry secret. + :vartype registry_password: str + """ + + _attribute_map = { + "registry_url": {"key": "registryUrl", "type": "str"}, + "registry_user_name": {"key": "registryUserName", "type": "str"}, + "registry_password": {"key": "registryPassword", "type": "str"}, + } + + def __init__( + self, + *, + registry_url: Optional[str] = None, + registry_user_name: Optional[str] = None, + registry_password: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword registry_url: registry server Url. + :paramtype registry_url: str + :keyword registry_user_name: registry username. + :paramtype registry_user_name: str + :keyword registry_password: registry secret. + :paramtype registry_password: str + """ + super().__init__(**kwargs) + self.registry_url = registry_url + self.registry_user_name = registry_user_name + self.registry_password = registry_password + + +class Replica(ProxyResource): + """Container App Revision Replica. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar created_time: Timestamp describing when the pod was created by controller. + :vartype created_time: ~datetime.datetime + :ivar running_state: Current running state of the replica. Known values are: "Running", + "NotRunning", and "Unknown". + :vartype running_state: str or ~azure.mgmt.appcontainers.models.ContainerAppReplicaRunningState + :ivar running_state_details: The details of replica current running state. + :vartype running_state_details: str + :ivar containers: The containers collection under a replica. + :vartype containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] + :ivar init_containers: The init containers collection under a replica. + :vartype init_containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "created_time": {"readonly": True}, + "running_state": {"readonly": True}, + "running_state_details": {"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"}, + "created_time": {"key": "properties.createdTime", "type": "iso-8601"}, + "running_state": {"key": "properties.runningState", "type": "str"}, + "running_state_details": {"key": "properties.runningStateDetails", "type": "str"}, + "containers": {"key": "properties.containers", "type": "[ReplicaContainer]"}, + "init_containers": {"key": "properties.initContainers", "type": "[ReplicaContainer]"}, + } + + def __init__( + self, + *, + containers: Optional[List["_models.ReplicaContainer"]] = None, + init_containers: Optional[List["_models.ReplicaContainer"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword containers: The containers collection under a replica. + :paramtype containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] + :keyword init_containers: The init containers collection under a replica. + :paramtype init_containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] + """ + super().__init__(**kwargs) + self.created_time = None + self.running_state = None + self.running_state_details = None + self.containers = containers + self.init_containers = init_containers + + +class ReplicaCollection(_serialization.Model): + """Container App Revision Replicas collection ARM resource. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.Replica] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Replica]"}, + } + + def __init__(self, *, value: List["_models.Replica"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.Replica] + """ + super().__init__(**kwargs) + self.value = value + + +class ReplicaContainer(_serialization.Model): + """Container object under Container App Revision Replica. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The Name of the Container. + :vartype name: str + :ivar container_id: The Id of the Container. + :vartype container_id: str + :ivar ready: The container ready status. + :vartype ready: bool + :ivar started: The container start status. + :vartype started: bool + :ivar restart_count: The container restart count. + :vartype restart_count: int + :ivar running_state: Current running state of the container. Known values are: "Running", + "Terminated", and "Waiting". + :vartype running_state: str or + ~azure.mgmt.appcontainers.models.ContainerAppContainerRunningState + :ivar running_state_details: The details of container current running state. + :vartype running_state_details: str + :ivar log_stream_endpoint: Log Stream endpoint. + :vartype log_stream_endpoint: str + :ivar exec_endpoint: Container exec endpoint. + :vartype exec_endpoint: str + :ivar debug_endpoint: Container debug endpoint. + :vartype debug_endpoint: str + """ + + _validation = { + "running_state": {"readonly": True}, + "running_state_details": {"readonly": True}, + "log_stream_endpoint": {"readonly": True}, + "exec_endpoint": {"readonly": True}, + "debug_endpoint": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "container_id": {"key": "containerId", "type": "str"}, + "ready": {"key": "ready", "type": "bool"}, + "started": {"key": "started", "type": "bool"}, + "restart_count": {"key": "restartCount", "type": "int"}, + "running_state": {"key": "runningState", "type": "str"}, + "running_state_details": {"key": "runningStateDetails", "type": "str"}, + "log_stream_endpoint": {"key": "logStreamEndpoint", "type": "str"}, + "exec_endpoint": {"key": "execEndpoint", "type": "str"}, + "debug_endpoint": {"key": "debugEndpoint", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + container_id: Optional[str] = None, + ready: Optional[bool] = None, + started: Optional[bool] = None, + restart_count: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The Name of the Container. + :paramtype name: str + :keyword container_id: The Id of the Container. + :paramtype container_id: str + :keyword ready: The container ready status. + :paramtype ready: bool + :keyword started: The container start status. :paramtype started: bool :keyword restart_count: The container restart count. :paramtype restart_count: int """ super().__init__(**kwargs) - self.name = name - self.container_id = container_id - self.ready = ready - self.started = started - self.restart_count = restart_count - self.running_state = None - self.running_state_details = None - self.log_stream_endpoint = None - self.exec_endpoint = None + self.name = name + self.container_id = container_id + self.ready = ready + self.started = started + self.restart_count = restart_count + self.running_state = None + self.running_state_details = None + self.log_stream_endpoint = None + self.exec_endpoint = None + self.debug_endpoint = None + + +class ReplicaExecutionStatus(_serialization.Model): + """Container Apps Job execution replica status. + + :ivar name: Replica Name. + :vartype name: str + :ivar containers: Containers in the execution replica. + :vartype containers: list[~azure.mgmt.appcontainers.models.ContainerExecutionStatus] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "containers": {"key": "containers", "type": "[ContainerExecutionStatus]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + containers: Optional[List["_models.ContainerExecutionStatus"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Replica Name. + :paramtype name: str + :keyword containers: Containers in the execution replica. + :paramtype containers: list[~azure.mgmt.appcontainers.models.ContainerExecutionStatus] + """ + super().__init__(**kwargs) + self.name = name + self.containers = containers + + +class Revision(ProxyResource): # pylint: disable=too-many-instance-attributes + """Container App Revision. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar created_time: Timestamp describing when the revision was created + by controller. + :vartype created_time: ~datetime.datetime + :ivar last_active_time: Timestamp describing when the revision was last active. Only meaningful + when revision is inactive. + :vartype last_active_time: ~datetime.datetime + :ivar fqdn: Fully qualified domain name of the revision. + :vartype fqdn: str + :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: ~azure.mgmt.appcontainers.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 provisioning_error: Optional Field - Platform Error Message. + :vartype provisioning_error: str + :ivar health_state: Current health State of the revision. Known values are: "Healthy", + "Unhealthy", and "None". + :vartype health_state: str or ~azure.mgmt.appcontainers.models.RevisionHealthState + :ivar provisioning_state: Current provisioning State of the revision. Known values are: + "Provisioning", "Provisioned", "Failed", "Deprovisioning", and "Deprovisioned". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.RevisionProvisioningState + :ivar running_state: Current running state of the revision. Known values are: "Running", + "Processing", "Stopped", "Degraded", "Failed", and "Unknown". + :vartype running_state: str or ~azure.mgmt.appcontainers.models.RevisionRunningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "created_time": {"readonly": True}, + "last_active_time": {"readonly": True}, + "fqdn": {"readonly": True}, + "template": {"readonly": True}, + "active": {"readonly": True}, + "replicas": {"readonly": True}, + "traffic_weight": {"readonly": True}, + "provisioning_error": {"readonly": True}, + "health_state": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "running_state": {"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"}, + "created_time": {"key": "properties.createdTime", "type": "iso-8601"}, + "last_active_time": {"key": "properties.lastActiveTime", "type": "iso-8601"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "template": {"key": "properties.template", "type": "Template"}, + "active": {"key": "properties.active", "type": "bool"}, + "replicas": {"key": "properties.replicas", "type": "int"}, + "traffic_weight": {"key": "properties.trafficWeight", "type": "int"}, + "provisioning_error": {"key": "properties.provisioningError", "type": "str"}, + "health_state": {"key": "properties.healthState", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "running_state": {"key": "properties.runningState", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.created_time = None + self.last_active_time = None + self.fqdn = None + self.template = None + self.active = None + self.replicas = None + self.traffic_weight = None + self.provisioning_error = None + self.health_state = None + self.provisioning_state = None + self.running_state = None + + +class RevisionCollection(_serialization.Model): + """Container App Revisions collection 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 server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.Revision] + :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": "[Revision]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Revision"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.Revision] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class Runtime(_serialization.Model): + """Container App Runtime configuration. + + :ivar java: Java app configuration. + :vartype java: ~azure.mgmt.appcontainers.models.RuntimeJava + :ivar dotnet: .NET app configuration. + :vartype dotnet: ~azure.mgmt.appcontainers.models.RuntimeDotnet + """ + + _attribute_map = { + "java": {"key": "java", "type": "RuntimeJava"}, + "dotnet": {"key": "dotnet", "type": "RuntimeDotnet"}, + } + + def __init__( + self, + *, + java: Optional["_models.RuntimeJava"] = None, + dotnet: Optional["_models.RuntimeDotnet"] = None, + **kwargs: Any + ) -> None: + """ + :keyword java: Java app configuration. + :paramtype java: ~azure.mgmt.appcontainers.models.RuntimeJava + :keyword dotnet: .NET app configuration. + :paramtype dotnet: ~azure.mgmt.appcontainers.models.RuntimeDotnet + """ + super().__init__(**kwargs) + self.java = java + self.dotnet = dotnet + + +class RuntimeDotnet(_serialization.Model): + """.NET app configuration. + + :ivar auto_configure_data_protection: Auto configure the ASP.NET Core Data Protection feature. + :vartype auto_configure_data_protection: bool + """ + + _attribute_map = { + "auto_configure_data_protection": {"key": "autoConfigureDataProtection", "type": "bool"}, + } + + def __init__(self, *, auto_configure_data_protection: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword auto_configure_data_protection: Auto configure the ASP.NET Core Data Protection + feature. + :paramtype auto_configure_data_protection: bool + """ + super().__init__(**kwargs) + self.auto_configure_data_protection = auto_configure_data_protection + + +class RuntimeJava(_serialization.Model): + """Java app configuration. + + :ivar enable_metrics: Enable jmx core metrics for the java app. + :vartype enable_metrics: bool + :ivar java_agent: Diagnostic capabilities achieved by java agent. + :vartype java_agent: ~azure.mgmt.appcontainers.models.RuntimeJavaAgent + """ + + _attribute_map = { + "enable_metrics": {"key": "enableMetrics", "type": "bool"}, + "java_agent": {"key": "javaAgent", "type": "RuntimeJavaAgent"}, + } + + def __init__( + self, + *, + enable_metrics: Optional[bool] = None, + java_agent: Optional["_models.RuntimeJavaAgent"] = None, + **kwargs: Any + ) -> None: + """ + :keyword enable_metrics: Enable jmx core metrics for the java app. + :paramtype enable_metrics: bool + :keyword java_agent: Diagnostic capabilities achieved by java agent. + :paramtype java_agent: ~azure.mgmt.appcontainers.models.RuntimeJavaAgent + """ + super().__init__(**kwargs) + self.enable_metrics = enable_metrics + self.java_agent = java_agent + + +class RuntimeJavaAgent(_serialization.Model): + """Diagnostic capabilities achieved by java agent. + + :ivar enabled: Enable java agent injection for the java app. + :vartype enabled: bool + :ivar logging: Capabilities on the java logging scenario. + :vartype logging: ~azure.mgmt.appcontainers.models.RuntimeJavaAgentLogging + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "logging": {"key": "logging", "type": "RuntimeJavaAgentLogging"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + logging: Optional["_models.RuntimeJavaAgentLogging"] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled: Enable java agent injection for the java app. + :paramtype enabled: bool + :keyword logging: Capabilities on the java logging scenario. + :paramtype logging: ~azure.mgmt.appcontainers.models.RuntimeJavaAgentLogging + """ + super().__init__(**kwargs) + self.enabled = enabled + self.logging = logging + + +class RuntimeJavaAgentLogging(_serialization.Model): + """Capabilities on the java logging scenario. + + :ivar logger_settings: Settings of the logger for the java app. + :vartype logger_settings: list[~azure.mgmt.appcontainers.models.LoggerSetting] + """ + + _attribute_map = { + "logger_settings": {"key": "loggerSettings", "type": "[LoggerSetting]"}, + } + + def __init__(self, *, logger_settings: Optional[List["_models.LoggerSetting"]] = None, **kwargs: Any) -> None: + """ + :keyword logger_settings: Settings of the logger for the java app. + :paramtype logger_settings: list[~azure.mgmt.appcontainers.models.LoggerSetting] + """ + super().__init__(**kwargs) + self.logger_settings = logger_settings + + +class Scale(_serialization.Model): + """Container App scaling configurations. + + :ivar min_replicas: Optional. Minimum number of container replicas. + :vartype min_replicas: int + :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[~azure.mgmt.appcontainers.models.ScaleRule] + """ + + _attribute_map = { + "min_replicas": {"key": "minReplicas", "type": "int"}, + "max_replicas": {"key": "maxReplicas", "type": "int"}, + "rules": {"key": "rules", "type": "[ScaleRule]"}, + } + + def __init__( + self, + *, + min_replicas: Optional[int] = None, + max_replicas: int = 10, + rules: Optional[List["_models.ScaleRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword min_replicas: Optional. Minimum number of container replicas. + :paramtype min_replicas: int + :keyword max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not + set. + :paramtype max_replicas: int + :keyword rules: Scaling rules. + :paramtype rules: list[~azure.mgmt.appcontainers.models.ScaleRule] + """ + super().__init__(**kwargs) + self.min_replicas = min_replicas + self.max_replicas = max_replicas + self.rules = rules + + +class ScaleConfiguration(_serialization.Model): + """Scale configuration. + + :ivar max_concurrent_sessions: The maximum count of sessions at the same time. + :vartype max_concurrent_sessions: int + :ivar ready_session_instances: The minimum count of ready session instances. + :vartype ready_session_instances: int + """ + + _attribute_map = { + "max_concurrent_sessions": {"key": "maxConcurrentSessions", "type": "int"}, + "ready_session_instances": {"key": "readySessionInstances", "type": "int"}, + } + + def __init__( + self, + *, + max_concurrent_sessions: Optional[int] = None, + ready_session_instances: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword max_concurrent_sessions: The maximum count of sessions at the same time. + :paramtype max_concurrent_sessions: int + :keyword ready_session_instances: The minimum count of ready session instances. + :paramtype ready_session_instances: int + """ + super().__init__(**kwargs) + self.max_concurrent_sessions = max_concurrent_sessions + self.ready_session_instances = ready_session_instances + + +class ScaleRule(_serialization.Model): + """Container App container scaling rule. + + :ivar name: Scale Rule Name. + :vartype name: str + :ivar azure_queue: Azure Queue based scaling. + :vartype azure_queue: ~azure.mgmt.appcontainers.models.QueueScaleRule + :ivar custom: Custom scale rule. + :vartype custom: ~azure.mgmt.appcontainers.models.CustomScaleRule + :ivar http: HTTP requests based scaling. + :vartype http: ~azure.mgmt.appcontainers.models.HttpScaleRule + :ivar tcp: Tcp requests based scaling. + :vartype tcp: ~azure.mgmt.appcontainers.models.TcpScaleRule + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "azure_queue": {"key": "azureQueue", "type": "QueueScaleRule"}, + "custom": {"key": "custom", "type": "CustomScaleRule"}, + "http": {"key": "http", "type": "HttpScaleRule"}, + "tcp": {"key": "tcp", "type": "TcpScaleRule"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + azure_queue: Optional["_models.QueueScaleRule"] = None, + custom: Optional["_models.CustomScaleRule"] = None, + http: Optional["_models.HttpScaleRule"] = None, + tcp: Optional["_models.TcpScaleRule"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Scale Rule Name. + :paramtype name: str + :keyword azure_queue: Azure Queue based scaling. + :paramtype azure_queue: ~azure.mgmt.appcontainers.models.QueueScaleRule + :keyword custom: Custom scale rule. + :paramtype custom: ~azure.mgmt.appcontainers.models.CustomScaleRule + :keyword http: HTTP requests based scaling. + :paramtype http: ~azure.mgmt.appcontainers.models.HttpScaleRule + :keyword tcp: Tcp requests based scaling. + :paramtype tcp: ~azure.mgmt.appcontainers.models.TcpScaleRule + """ + super().__init__(**kwargs) + self.name = name + self.azure_queue = azure_queue + self.custom = custom + self.http = http + self.tcp = tcp + + +class ScaleRuleAuth(_serialization.Model): + """Auth Secrets for Scale Rule. + + :ivar secret_ref: Name of the secret from which to pull the auth params. + :vartype secret_ref: str + :ivar trigger_parameter: Trigger Parameter that uses the secret. + :vartype trigger_parameter: str + """ + + _attribute_map = { + "secret_ref": {"key": "secretRef", "type": "str"}, + "trigger_parameter": {"key": "triggerParameter", "type": "str"}, + } + + def __init__( + self, *, secret_ref: Optional[str] = None, trigger_parameter: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword secret_ref: Name of the secret from which to pull the auth params. + :paramtype secret_ref: str + :keyword trigger_parameter: Trigger Parameter that uses the secret. + :paramtype trigger_parameter: str + """ + super().__init__(**kwargs) + self.secret_ref = secret_ref + self.trigger_parameter = trigger_parameter + + +class ScgRoute(_serialization.Model): + """Spring Cloud Gateway route definition. + + All required parameters must be populated in order to send to server. + + :ivar id: Id of the route. Required. + :vartype id: str + :ivar uri: Uri of the route. Required. + :vartype uri: str + :ivar predicates: Predicates of the route. + :vartype predicates: list[str] + :ivar filters: Filters of the route. + :vartype filters: list[str] + :ivar order: Order of the route. + :vartype order: int + """ + + _validation = { + "id": {"required": True}, + "uri": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, + "predicates": {"key": "predicates", "type": "[str]"}, + "filters": {"key": "filters", "type": "[str]"}, + "order": {"key": "order", "type": "int"}, + } + + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + uri: str, + predicates: Optional[List[str]] = None, + filters: Optional[List[str]] = None, + order: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Id of the route. Required. + :paramtype id: str + :keyword uri: Uri of the route. Required. + :paramtype uri: str + :keyword predicates: Predicates of the route. + :paramtype predicates: list[str] + :keyword filters: Filters of the route. + :paramtype filters: list[str] + :keyword order: Order of the route. + :paramtype order: int + """ + super().__init__(**kwargs) + self.id = id + self.uri = uri + self.predicates = predicates + self.filters = filters + self.order = order + + +class Secret(_serialization.Model): + """Secret definition. + + :ivar name: Secret Name. + :vartype name: str + :ivar value: Secret Value. + :vartype value: str + :ivar identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or + System to use a system-assigned identity. + :vartype identity: str + :ivar key_vault_url: Azure Key Vault URL pointing to the secret referenced by the container + app. + :vartype key_vault_url: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + "identity": {"key": "identity", "type": "str"}, + "key_vault_url": {"key": "keyVaultUrl", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + identity: Optional[str] = None, + key_vault_url: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Secret Name. + :paramtype name: str + :keyword value: Secret Value. + :paramtype value: str + :keyword identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or + System to use a system-assigned identity. + :paramtype identity: str + :keyword key_vault_url: Azure Key Vault URL pointing to the secret referenced by the container + app. + :paramtype key_vault_url: str + """ + super().__init__(**kwargs) + self.name = name + self.value = value + self.identity = identity + self.key_vault_url = key_vault_url + + +class SecretsCollection(_serialization.Model): + """Container App Secrets Collection ARM resource. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ContainerAppSecret] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ContainerAppSecret]"}, + } + + def __init__(self, *, value: List["_models.ContainerAppSecret"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ContainerAppSecret] + """ + super().__init__(**kwargs) + self.value = value + + +class SecretVolumeItem(_serialization.Model): + """Secret to be added to volume. + + :ivar secret_ref: Name of the Container App secret from which to pull the secret value. + :vartype secret_ref: str + :ivar path: Path to project secret to. If no path is provided, path defaults to name of secret + listed in secretRef. + :vartype path: str + """ + + _attribute_map = { + "secret_ref": {"key": "secretRef", "type": "str"}, + "path": {"key": "path", "type": "str"}, + } + + def __init__(self, *, secret_ref: Optional[str] = None, path: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword secret_ref: Name of the Container App secret from which to pull the secret value. + :paramtype secret_ref: str + :keyword path: Path to project secret to. If no path is provided, path defaults to name of + secret listed in secretRef. + :paramtype path: str + """ + super().__init__(**kwargs) + self.secret_ref = secret_ref + self.path = path + + +class Service(_serialization.Model): + """Container App to be a dev service. + + All required parameters must be populated in order to send to server. + + :ivar type: Dev ContainerApp service type. Required. + :vartype type: str + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, type: str, **kwargs: Any) -> None: + """ + :keyword type: Dev ContainerApp service type. Required. + :paramtype type: str + """ + super().__init__(**kwargs) + self.type = type + + +class ServiceBind(_serialization.Model): + """Configuration to bind a ContainerApp to a dev ContainerApp Service. + + :ivar service_id: Resource id of the target service. + :vartype service_id: str + :ivar name: Name of the service bind. + :vartype name: str + :ivar client_type: Type of the client to be used to connect to the service. + :vartype client_type: str + :ivar customized_keys: Customized keys for customizing injected values to the app. + :vartype customized_keys: dict[str, str] + """ + + _attribute_map = { + "service_id": {"key": "serviceId", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "client_type": {"key": "clientType", "type": "str"}, + "customized_keys": {"key": "customizedKeys", "type": "{str}"}, + } + + def __init__( + self, + *, + service_id: Optional[str] = None, + name: Optional[str] = None, + client_type: Optional[str] = None, + customized_keys: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword service_id: Resource id of the target service. + :paramtype service_id: str + :keyword name: Name of the service bind. + :paramtype name: str + :keyword client_type: Type of the client to be used to connect to the service. + :paramtype client_type: str + :keyword customized_keys: Customized keys for customizing injected values to the app. + :paramtype customized_keys: dict[str, str] + """ + super().__init__(**kwargs) + self.service_id = service_id + self.name = name + self.client_type = client_type + self.customized_keys = customized_keys + + +class SessionContainer(_serialization.Model): + """Container definitions for the sessions of the session pool. + + :ivar image: Container image tag. + :vartype image: str + :ivar name: Custom container name. + :vartype name: str + :ivar command: Container start command. + :vartype command: list[str] + :ivar args: Container start command arguments. + :vartype args: list[str] + :ivar env: Container environment variables. + :vartype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] + :ivar resources: Container resource requirements. + :vartype resources: ~azure.mgmt.appcontainers.models.SessionContainerResources + """ + + _attribute_map = { + "image": {"key": "image", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "command": {"key": "command", "type": "[str]"}, + "args": {"key": "args", "type": "[str]"}, + "env": {"key": "env", "type": "[EnvironmentVar]"}, + "resources": {"key": "resources", "type": "SessionContainerResources"}, + } + + def __init__( + self, + *, + image: Optional[str] = None, + name: Optional[str] = None, + command: Optional[List[str]] = None, + args: Optional[List[str]] = None, + env: Optional[List["_models.EnvironmentVar"]] = None, + resources: Optional["_models.SessionContainerResources"] = None, + **kwargs: Any + ) -> None: + """ + :keyword image: Container image tag. + :paramtype image: str + :keyword name: Custom container name. + :paramtype name: str + :keyword command: Container start command. + :paramtype command: list[str] + :keyword args: Container start command arguments. + :paramtype args: list[str] + :keyword env: Container environment variables. + :paramtype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] + :keyword resources: Container resource requirements. + :paramtype resources: ~azure.mgmt.appcontainers.models.SessionContainerResources + """ + super().__init__(**kwargs) + self.image = image + self.name = name + self.command = command + self.args = args + self.env = env + self.resources = resources + + +class SessionContainerResources(_serialization.Model): + """Container resource requirements for sessions of the session pool. + + :ivar cpu: Required CPU in cores, e.g. 0.5. + :vartype cpu: float + :ivar memory: Required memory, e.g. "250Mb". + :vartype memory: str + """ + + _attribute_map = { + "cpu": {"key": "cpu", "type": "float"}, + "memory": {"key": "memory", "type": "str"}, + } + + def __init__(self, *, cpu: Optional[float] = None, memory: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword cpu: Required CPU in cores, e.g. 0.5. + :paramtype cpu: float + :keyword memory: Required memory, e.g. "250Mb". + :paramtype memory: str + """ + super().__init__(**kwargs) + self.cpu = cpu + self.memory = memory + + +class SessionIngress(_serialization.Model): + """Session pool ingress configuration. + + :ivar target_port: Target port in containers for traffic from ingress. + :vartype target_port: int + """ + + _attribute_map = { + "target_port": {"key": "targetPort", "type": "int"}, + } + + def __init__(self, *, target_port: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword target_port: Target port in containers for traffic from ingress. + :paramtype target_port: int + """ + super().__init__(**kwargs) + self.target_port = target_port -class Revision(ProxyResource): # pylint: disable=too-many-instance-attributes - """Container App Revision. +class SessionNetworkConfiguration(_serialization.Model): + """Session network configuration. + + :ivar status: Network status for the sessions. Known values are: "EgressEnabled" and + "EgressDisabled". + :vartype status: str or ~azure.mgmt.appcontainers.models.SessionNetworkStatus + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, *, status: Optional[Union[str, "_models.SessionNetworkStatus"]] = None, **kwargs: Any) -> None: + """ + :keyword status: Network status for the sessions. Known values are: "EgressEnabled" and + "EgressDisabled". + :paramtype status: str or ~azure.mgmt.appcontainers.models.SessionNetworkStatus + """ + super().__init__(**kwargs) + self.status = status + + +class SessionPool(TrackedResource): # pylint: disable=too-many-instance-attributes + """Container App session pool. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -9518,35 +11787,39 @@ class Revision(ProxyResource): # pylint: disable=too-many-instance-attributes :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar created_time: Timestamp describing when the revision was created - by controller. - :vartype created_time: ~datetime.datetime - :ivar last_active_time: Timestamp describing when the revision was last active. Only meaningful - when revision is inactive. - :vartype last_active_time: ~datetime.datetime - :ivar fqdn: Fully qualified domain name of the revision. - :vartype fqdn: str - :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: ~azure.mgmt.appcontainers.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 provisioning_error: Optional Field - Platform Error Message. - :vartype provisioning_error: str - :ivar health_state: Current health State of the revision. Known values are: "Healthy", - "Unhealthy", and "None". - :vartype health_state: str or ~azure.mgmt.appcontainers.models.RevisionHealthState - :ivar provisioning_state: Current provisioning State of the revision. Known values are: - "Provisioning", "Provisioned", "Failed", "Deprovisioning", and "Deprovisioned". - :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.RevisionProvisioningState - :ivar running_state: Current running state of the revision. Known values are: "Running", - "Processing", "Stopped", "Degraded", "Failed", and "Unknown". - :vartype running_state: str or ~azure.mgmt.appcontainers.models.RevisionRunningState + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar environment_id: Resource ID of the session pool's environment. + :vartype environment_id: str + :ivar container_type: The container type of the sessions. Known values are: "CustomContainer" + and "PythonLTS". + :vartype container_type: str or ~azure.mgmt.appcontainers.models.ContainerType + :ivar pool_management_type: The pool management type of the session pool. Known values are: + "Manual" and "Dynamic". + :vartype pool_management_type: str or ~azure.mgmt.appcontainers.models.PoolManagementType + :ivar node_count: The number of nodes the session pool is using. + :vartype node_count: int + :ivar scale_configuration: The scale configuration of the session pool. + :vartype scale_configuration: ~azure.mgmt.appcontainers.models.ScaleConfiguration + :ivar secrets: The secrets of the session pool. + :vartype secrets: list[~azure.mgmt.appcontainers.models.SessionPoolSecret] + :ivar dynamic_pool_configuration: The pool configuration if the poolManagementType is dynamic. + :vartype dynamic_pool_configuration: ~azure.mgmt.appcontainers.models.DynamicPoolConfiguration + :ivar custom_container_template: The custom container configuration if the containerType is + CustomContainer. + :vartype custom_container_template: ~azure.mgmt.appcontainers.models.CustomContainerTemplate + :ivar session_network_configuration: The network configuration of the sessions in the session + pool. + :vartype session_network_configuration: + ~azure.mgmt.appcontainers.models.SessionNetworkConfiguration + :ivar pool_management_endpoint: The endpoint to manage the pool. + :vartype pool_management_endpoint: str + :ivar provisioning_state: Provisioning state of the session pool. Known values are: + "InProgress", "Succeeded", "Failed", "Canceled", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.SessionPoolProvisioningState """ _validation = { @@ -9554,17 +11827,10 @@ class Revision(ProxyResource): # pylint: disable=too-many-instance-attributes "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "created_time": {"readonly": True}, - "last_active_time": {"readonly": True}, - "fqdn": {"readonly": True}, - "template": {"readonly": True}, - "active": {"readonly": True}, - "replicas": {"readonly": True}, - "traffic_weight": {"readonly": True}, - "provisioning_error": {"readonly": True}, - "health_state": {"readonly": True}, + "location": {"required": True}, + "node_count": {"readonly": True}, + "pool_management_endpoint": {"readonly": True}, "provisioning_state": {"readonly": True}, - "running_state": {"readonly": True}, } _attribute_map = { @@ -9572,44 +11838,94 @@ class Revision(ProxyResource): # pylint: disable=too-many-instance-attributes "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "created_time": {"key": "properties.createdTime", "type": "iso-8601"}, - "last_active_time": {"key": "properties.lastActiveTime", "type": "iso-8601"}, - "fqdn": {"key": "properties.fqdn", "type": "str"}, - "template": {"key": "properties.template", "type": "Template"}, - "active": {"key": "properties.active", "type": "bool"}, - "replicas": {"key": "properties.replicas", "type": "int"}, - "traffic_weight": {"key": "properties.trafficWeight", "type": "int"}, - "provisioning_error": {"key": "properties.provisioningError", "type": "str"}, - "health_state": {"key": "properties.healthState", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "environment_id": {"key": "properties.environmentId", "type": "str"}, + "container_type": {"key": "properties.containerType", "type": "str"}, + "pool_management_type": {"key": "properties.poolManagementType", "type": "str"}, + "node_count": {"key": "properties.nodeCount", "type": "int"}, + "scale_configuration": {"key": "properties.scaleConfiguration", "type": "ScaleConfiguration"}, + "secrets": {"key": "properties.secrets", "type": "[SessionPoolSecret]"}, + "dynamic_pool_configuration": { + "key": "properties.dynamicPoolConfiguration", + "type": "DynamicPoolConfiguration", + }, + "custom_container_template": {"key": "properties.customContainerTemplate", "type": "CustomContainerTemplate"}, + "session_network_configuration": { + "key": "properties.sessionNetworkConfiguration", + "type": "SessionNetworkConfiguration", + }, + "pool_management_endpoint": {"key": "properties.poolManagementEndpoint", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "running_state": {"key": "properties.runningState", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.created_time = None - self.last_active_time = None - self.fqdn = None - self.template = None - self.active = None - self.replicas = None - self.traffic_weight = None - self.provisioning_error = None - self.health_state = None + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + environment_id: Optional[str] = None, + container_type: Optional[Union[str, "_models.ContainerType"]] = None, + pool_management_type: Optional[Union[str, "_models.PoolManagementType"]] = None, + scale_configuration: Optional["_models.ScaleConfiguration"] = None, + secrets: Optional[List["_models.SessionPoolSecret"]] = None, + dynamic_pool_configuration: Optional["_models.DynamicPoolConfiguration"] = None, + custom_container_template: Optional["_models.CustomContainerTemplate"] = None, + session_network_configuration: Optional["_models.SessionNetworkConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword environment_id: Resource ID of the session pool's environment. + :paramtype environment_id: str + :keyword container_type: The container type of the sessions. Known values are: + "CustomContainer" and "PythonLTS". + :paramtype container_type: str or ~azure.mgmt.appcontainers.models.ContainerType + :keyword pool_management_type: The pool management type of the session pool. Known values are: + "Manual" and "Dynamic". + :paramtype pool_management_type: str or ~azure.mgmt.appcontainers.models.PoolManagementType + :keyword scale_configuration: The scale configuration of the session pool. + :paramtype scale_configuration: ~azure.mgmt.appcontainers.models.ScaleConfiguration + :keyword secrets: The secrets of the session pool. + :paramtype secrets: list[~azure.mgmt.appcontainers.models.SessionPoolSecret] + :keyword dynamic_pool_configuration: The pool configuration if the poolManagementType is + dynamic. + :paramtype dynamic_pool_configuration: + ~azure.mgmt.appcontainers.models.DynamicPoolConfiguration + :keyword custom_container_template: The custom container configuration if the containerType is + CustomContainer. + :paramtype custom_container_template: ~azure.mgmt.appcontainers.models.CustomContainerTemplate + :keyword session_network_configuration: The network configuration of the sessions in the + session pool. + :paramtype session_network_configuration: + ~azure.mgmt.appcontainers.models.SessionNetworkConfiguration + """ + super().__init__(tags=tags, location=location, **kwargs) + self.environment_id = environment_id + self.container_type = container_type + self.pool_management_type = pool_management_type + self.node_count = None + self.scale_configuration = scale_configuration + self.secrets = secrets + self.dynamic_pool_configuration = dynamic_pool_configuration + self.custom_container_template = custom_container_template + self.session_network_configuration = session_network_configuration + self.pool_management_endpoint = None self.provisioning_state = None - self.running_state = None -class RevisionCollection(_serialization.Model): - """Container App Revisions collection ARM resource. +class SessionPoolCollection(_serialization.Model): + """Session pool collection Azure 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 server. :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.Revision] + :vartype value: list[~azure.mgmt.appcontainers.models.SessionPool] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -9620,428 +11936,579 @@ class RevisionCollection(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[Revision]"}, + "value": {"key": "value", "type": "[SessionPool]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.Revision"], **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.SessionPool"], **kwargs: Any) -> None: """ :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.Revision] + :paramtype value: list[~azure.mgmt.appcontainers.models.SessionPool] """ super().__init__(**kwargs) self.value = value self.next_link = None -class Scale(_serialization.Model): - """Container App scaling configurations. +class SessionPoolSecret(_serialization.Model): + """Secret definition. - :ivar min_replicas: Optional. Minimum number of container replicas. - :vartype min_replicas: int - :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[~azure.mgmt.appcontainers.models.ScaleRule] + :ivar name: Secret Name. + :vartype name: str + :ivar value: Secret Value. + :vartype value: str """ _attribute_map = { - "min_replicas": {"key": "minReplicas", "type": "int"}, - "max_replicas": {"key": "maxReplicas", "type": "int"}, - "rules": {"key": "rules", "type": "[ScaleRule]"}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Secret Name. + :paramtype name: str + :keyword value: Secret Value. + :paramtype value: str + """ + super().__init__(**kwargs) + self.name = name + self.value = value + + +class SessionPoolUpdatableProperties(_serialization.Model): + """Container App session pool updatable properties. + + :ivar scale_configuration: The scale configuration of the session pool. + :vartype scale_configuration: ~azure.mgmt.appcontainers.models.ScaleConfiguration + :ivar secrets: The secrets of the session pool. + :vartype secrets: list[~azure.mgmt.appcontainers.models.SessionPoolSecret] + :ivar dynamic_pool_configuration: The pool configuration if the poolManagementType is dynamic. + :vartype dynamic_pool_configuration: ~azure.mgmt.appcontainers.models.DynamicPoolConfiguration + :ivar custom_container_template: The custom container configuration if the containerType is + CustomContainer. + :vartype custom_container_template: ~azure.mgmt.appcontainers.models.CustomContainerTemplate + :ivar session_network_configuration: The network configuration of the sessions in the session + pool. + :vartype session_network_configuration: + ~azure.mgmt.appcontainers.models.SessionNetworkConfiguration + """ + + _attribute_map = { + "scale_configuration": {"key": "properties.scaleConfiguration", "type": "ScaleConfiguration"}, + "secrets": {"key": "properties.secrets", "type": "[SessionPoolSecret]"}, + "dynamic_pool_configuration": { + "key": "properties.dynamicPoolConfiguration", + "type": "DynamicPoolConfiguration", + }, + "custom_container_template": {"key": "properties.customContainerTemplate", "type": "CustomContainerTemplate"}, + "session_network_configuration": { + "key": "properties.sessionNetworkConfiguration", + "type": "SessionNetworkConfiguration", + }, } def __init__( self, *, - min_replicas: Optional[int] = None, - max_replicas: int = 10, - rules: Optional[List["_models.ScaleRule"]] = None, + scale_configuration: Optional["_models.ScaleConfiguration"] = None, + secrets: Optional[List["_models.SessionPoolSecret"]] = None, + dynamic_pool_configuration: Optional["_models.DynamicPoolConfiguration"] = None, + custom_container_template: Optional["_models.CustomContainerTemplate"] = None, + session_network_configuration: Optional["_models.SessionNetworkConfiguration"] = None, **kwargs: Any ) -> None: """ - :keyword min_replicas: Optional. Minimum number of container replicas. - :paramtype min_replicas: int - :keyword max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not - set. - :paramtype max_replicas: int - :keyword rules: Scaling rules. - :paramtype rules: list[~azure.mgmt.appcontainers.models.ScaleRule] + :keyword scale_configuration: The scale configuration of the session pool. + :paramtype scale_configuration: ~azure.mgmt.appcontainers.models.ScaleConfiguration + :keyword secrets: The secrets of the session pool. + :paramtype secrets: list[~azure.mgmt.appcontainers.models.SessionPoolSecret] + :keyword dynamic_pool_configuration: The pool configuration if the poolManagementType is + dynamic. + :paramtype dynamic_pool_configuration: + ~azure.mgmt.appcontainers.models.DynamicPoolConfiguration + :keyword custom_container_template: The custom container configuration if the containerType is + CustomContainer. + :paramtype custom_container_template: ~azure.mgmt.appcontainers.models.CustomContainerTemplate + :keyword session_network_configuration: The network configuration of the sessions in the + session pool. + :paramtype session_network_configuration: + ~azure.mgmt.appcontainers.models.SessionNetworkConfiguration """ super().__init__(**kwargs) - self.min_replicas = min_replicas - self.max_replicas = max_replicas - self.rules = rules + self.scale_configuration = scale_configuration + self.secrets = secrets + self.dynamic_pool_configuration = dynamic_pool_configuration + self.custom_container_template = custom_container_template + self.session_network_configuration = session_network_configuration -class ScaleRule(_serialization.Model): - """Container App container scaling rule. +class SessionRegistryCredentials(_serialization.Model): + """Session pool private registry credentials. - :ivar name: Scale Rule Name. - :vartype name: str - :ivar azure_queue: Azure Queue based scaling. - :vartype azure_queue: ~azure.mgmt.appcontainers.models.QueueScaleRule - :ivar custom: Custom scale rule. - :vartype custom: ~azure.mgmt.appcontainers.models.CustomScaleRule - :ivar http: HTTP requests based scaling. - :vartype http: ~azure.mgmt.appcontainers.models.HttpScaleRule - :ivar tcp: Tcp requests based scaling. - :vartype tcp: ~azure.mgmt.appcontainers.models.TcpScaleRule + :ivar registry_server: Container registry server. + :vartype registry_server: str + :ivar username: Container registry username. + :vartype username: str + :ivar password_secret_ref: The name of the secret that contains the registry login password. + :vartype password_secret_ref: str """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "azure_queue": {"key": "azureQueue", "type": "QueueScaleRule"}, - "custom": {"key": "custom", "type": "CustomScaleRule"}, - "http": {"key": "http", "type": "HttpScaleRule"}, - "tcp": {"key": "tcp", "type": "TcpScaleRule"}, + "registry_server": {"key": "registryServer", "type": "str"}, + "username": {"key": "username", "type": "str"}, + "password_secret_ref": {"key": "passwordSecretRef", "type": "str"}, } def __init__( self, *, - name: Optional[str] = None, - azure_queue: Optional["_models.QueueScaleRule"] = None, - custom: Optional["_models.CustomScaleRule"] = None, - http: Optional["_models.HttpScaleRule"] = None, - tcp: Optional["_models.TcpScaleRule"] = None, + registry_server: Optional[str] = None, + username: Optional[str] = None, + password_secret_ref: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword name: Scale Rule Name. - :paramtype name: str - :keyword azure_queue: Azure Queue based scaling. - :paramtype azure_queue: ~azure.mgmt.appcontainers.models.QueueScaleRule - :keyword custom: Custom scale rule. - :paramtype custom: ~azure.mgmt.appcontainers.models.CustomScaleRule - :keyword http: HTTP requests based scaling. - :paramtype http: ~azure.mgmt.appcontainers.models.HttpScaleRule - :keyword tcp: Tcp requests based scaling. - :paramtype tcp: ~azure.mgmt.appcontainers.models.TcpScaleRule + :keyword registry_server: Container registry server. + :paramtype registry_server: str + :keyword username: Container registry username. + :paramtype username: str + :keyword password_secret_ref: The name of the secret that contains the registry login password. + :paramtype password_secret_ref: str """ super().__init__(**kwargs) - self.name = name - self.azure_queue = azure_queue - self.custom = custom - self.http = http - self.tcp = tcp + self.registry_server = registry_server + self.username = username + self.password_secret_ref = password_secret_ref -class ScaleRuleAuth(_serialization.Model): - """Auth Secrets for Scale Rule. +class SmbStorage(_serialization.Model): + """SMB storage properties. - :ivar secret_ref: Name of the secret from which to pull the auth params. - :vartype secret_ref: str - :ivar trigger_parameter: Trigger Parameter that uses the secret. - :vartype trigger_parameter: str + :ivar host: The host name or IP address of the SMB server. + :vartype host: str + :ivar share_name: The path to the SMB shared folder. + :vartype share_name: str + :ivar username: The user to log on to the SMB server. + :vartype username: str + :ivar domain: The domain name for the user. + :vartype domain: str + :ivar password: The password for the user. + :vartype password: str + :ivar access_mode: Access mode for storage. Known values are: "ReadOnly" and "ReadWrite". + :vartype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode """ _attribute_map = { - "secret_ref": {"key": "secretRef", "type": "str"}, - "trigger_parameter": {"key": "triggerParameter", "type": "str"}, + "host": {"key": "host", "type": "str"}, + "share_name": {"key": "shareName", "type": "str"}, + "username": {"key": "username", "type": "str"}, + "domain": {"key": "domain", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "access_mode": {"key": "accessMode", "type": "str"}, } def __init__( - self, *, secret_ref: Optional[str] = None, trigger_parameter: Optional[str] = None, **kwargs: Any + self, + *, + host: Optional[str] = None, + share_name: Optional[str] = None, + username: Optional[str] = None, + domain: Optional[str] = None, + password: Optional[str] = None, + access_mode: Optional[Union[str, "_models.AccessMode"]] = None, + **kwargs: Any ) -> None: """ - :keyword secret_ref: Name of the secret from which to pull the auth params. - :paramtype secret_ref: str - :keyword trigger_parameter: Trigger Parameter that uses the secret. - :paramtype trigger_parameter: str + :keyword host: The host name or IP address of the SMB server. + :paramtype host: str + :keyword share_name: The path to the SMB shared folder. + :paramtype share_name: str + :keyword username: The user to log on to the SMB server. + :paramtype username: str + :keyword domain: The domain name for the user. + :paramtype domain: str + :keyword password: The password for the user. + :paramtype password: str + :keyword access_mode: Access mode for storage. Known values are: "ReadOnly" and "ReadWrite". + :paramtype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode """ super().__init__(**kwargs) - self.secret_ref = secret_ref - self.trigger_parameter = trigger_parameter + self.host = host + self.share_name = share_name + self.username = username + self.domain = domain + self.password = password + self.access_mode = access_mode -class Secret(_serialization.Model): - """Secret definition. +class SourceControl(ProxyResource): + """Container App SourceControl. - :ivar name: Secret Name. + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. :vartype name: str - :ivar value: Secret Value. - :vartype value: str - :ivar identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or - System to use a system-assigned identity. - :vartype identity: str - :ivar key_vault_url: Azure Key Vault URL pointing to the secret referenced by the container - app. - :vartype key_vault_url: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar operation_state: Current provisioning State of the operation. Known values are: + "InProgress", "Succeeded", "Failed", and "Canceled". + :vartype operation_state: str or ~azure.mgmt.appcontainers.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. + :vartype branch: str + :ivar github_action_configuration: 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 github_action_configuration: + ~azure.mgmt.appcontainers.models.GithubActionConfiguration """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "operation_state": {"readonly": True}, + } + _attribute_map = { + "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, - "identity": {"key": "identity", "type": "str"}, - "key_vault_url": {"key": "keyVaultUrl", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "operation_state": {"key": "properties.operationState", "type": "str"}, + "repo_url": {"key": "properties.repoUrl", "type": "str"}, + "branch": {"key": "properties.branch", "type": "str"}, + "github_action_configuration": { + "key": "properties.githubActionConfiguration", + "type": "GithubActionConfiguration", + }, } def __init__( self, *, - name: Optional[str] = None, - value: Optional[str] = None, - identity: Optional[str] = None, - key_vault_url: Optional[str] = None, + repo_url: Optional[str] = None, + branch: Optional[str] = None, + github_action_configuration: Optional["_models.GithubActionConfiguration"] = None, **kwargs: Any ) -> None: """ - :keyword name: Secret Name. - :paramtype name: str - :keyword value: Secret Value. - :paramtype value: str - :keyword identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or - System to use a system-assigned identity. - :paramtype identity: str - :keyword key_vault_url: Azure Key Vault URL pointing to the secret referenced by the container - app. - :paramtype key_vault_url: str + :keyword repo_url: The repo url which will be integrated to ContainerApp. + :paramtype repo_url: str + :keyword branch: The branch which will trigger the auto deployment. + :paramtype branch: str + :keyword github_action_configuration: 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. + :paramtype github_action_configuration: + ~azure.mgmt.appcontainers.models.GithubActionConfiguration """ super().__init__(**kwargs) - self.name = name - self.value = value - self.identity = identity - self.key_vault_url = key_vault_url + self.operation_state = None + self.repo_url = repo_url + self.branch = branch + self.github_action_configuration = github_action_configuration -class SecretsCollection(_serialization.Model): - """Container App Secrets Collection ARM resource. +class SourceControlCollection(_serialization.Model): + """SourceControl collection 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 server. :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.ContainerAppSecret] + :vartype value: list[~azure.mgmt.appcontainers.models.SourceControl] + :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": "[ContainerAppSecret]"}, + "value": {"key": "value", "type": "[SourceControl]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.ContainerAppSecret"], **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.SourceControl"], **kwargs: Any) -> None: """ :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.ContainerAppSecret] + :paramtype value: list[~azure.mgmt.appcontainers.models.SourceControl] """ super().__init__(**kwargs) self.value = value + self.next_link = None -class SecretVolumeItem(_serialization.Model): - """Secret to be added to volume. - - :ivar secret_ref: Name of the Container App secret from which to pull the secret value. - :vartype secret_ref: str - :ivar path: Path to project secret to. If no path is provided, path defaults to name of secret - listed in secretRef. - :vartype path: str - """ - - _attribute_map = { - "secret_ref": {"key": "secretRef", "type": "str"}, - "path": {"key": "path", "type": "str"}, - } - - def __init__(self, *, secret_ref: Optional[str] = None, path: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword secret_ref: Name of the Container App secret from which to pull the secret value. - :paramtype secret_ref: str - :keyword path: Path to project secret to. If no path is provided, path defaults to name of - secret listed in secretRef. - :paramtype path: str - """ - super().__init__(**kwargs) - self.secret_ref = secret_ref - self.path = path - +class SpringBootAdminComponent(JavaComponentProperties): + """Spring Boot Admin properties. -class Service(_serialization.Model): - """Container App to be a dev 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 server. - :ivar type: Dev ContainerApp service type. Required. - :vartype type: str + :ivar component_type: Type of the Java Component. Required. Known values are: + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :ivar provisioning_state: Provisioning state of the Java Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState + :ivar configurations: List of Java Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar scale: Java component scaling configurations. + :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :ivar service_binds: List of Java Components that are bound to the Java component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :ivar ingress: Java Component Ingress configurations. + :vartype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress """ _validation = { - "type": {"required": True}, + "component_type": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - "type": {"key": "type", "type": "str"}, + "component_type": {"key": "componentType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "configurations": {"key": "configurations", "type": "[JavaComponentConfigurationProperty]"}, + "scale": {"key": "scale", "type": "JavaComponentPropertiesScale"}, + "service_binds": {"key": "serviceBinds", "type": "[JavaComponentServiceBind]"}, + "ingress": {"key": "ingress", "type": "JavaComponentIngress"}, } - def __init__(self, *, type: str, **kwargs: Any) -> None: + def __init__( + self, + *, + configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + scale: Optional["_models.JavaComponentPropertiesScale"] = None, + service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, + ingress: Optional["_models.JavaComponentIngress"] = None, + **kwargs: Any + ) -> None: """ - :keyword type: Dev ContainerApp service type. Required. - :paramtype type: str + :keyword configurations: List of Java Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :keyword scale: Java component scaling configurations. + :paramtype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :keyword service_binds: List of Java Components that are bound to the Java component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :keyword ingress: Java Component Ingress configurations. + :paramtype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress """ - super().__init__(**kwargs) - self.type = type + super().__init__(configurations=configurations, scale=scale, service_binds=service_binds, **kwargs) + self.component_type: str = "SpringBootAdmin" + self.ingress = ingress -class ServiceBind(_serialization.Model): - """Configuration to bind a ContainerApp to a dev ContainerApp Service. +class SpringCloudConfigComponent(JavaComponentProperties): + """Spring Cloud Config properties. - :ivar service_id: Resource id of the target service. - :vartype service_id: str - :ivar name: Name of the service bind. - :vartype name: str - :ivar client_type: Type of the client to be used to connect to the service. - :vartype client_type: str - :ivar customized_keys: Customized keys for customizing injected values to the app. - :vartype customized_keys: dict[str, str] + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar component_type: Type of the Java Component. Required. Known values are: + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :ivar provisioning_state: Provisioning state of the Java Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState + :ivar configurations: List of Java Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar scale: Java component scaling configurations. + :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :ivar service_binds: List of Java Components that are bound to the Java component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] """ + _validation = { + "component_type": {"required": True}, + "provisioning_state": {"readonly": True}, + } + _attribute_map = { - "service_id": {"key": "serviceId", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "client_type": {"key": "clientType", "type": "str"}, - "customized_keys": {"key": "customizedKeys", "type": "{str}"}, + "component_type": {"key": "componentType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "configurations": {"key": "configurations", "type": "[JavaComponentConfigurationProperty]"}, + "scale": {"key": "scale", "type": "JavaComponentPropertiesScale"}, + "service_binds": {"key": "serviceBinds", "type": "[JavaComponentServiceBind]"}, } def __init__( self, *, - service_id: Optional[str] = None, - name: Optional[str] = None, - client_type: Optional[str] = None, - customized_keys: Optional[Dict[str, str]] = None, + configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + scale: Optional["_models.JavaComponentPropertiesScale"] = None, + service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, **kwargs: Any ) -> None: """ - :keyword service_id: Resource id of the target service. - :paramtype service_id: str - :keyword name: Name of the service bind. - :paramtype name: str - :keyword client_type: Type of the client to be used to connect to the service. - :paramtype client_type: str - :keyword customized_keys: Customized keys for customizing injected values to the app. - :paramtype customized_keys: dict[str, str] - """ - super().__init__(**kwargs) - self.service_id = service_id - self.name = name - self.client_type = client_type - self.customized_keys = customized_keys + :keyword configurations: List of Java Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :keyword scale: Java component scaling configurations. + :paramtype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :keyword service_binds: List of Java Components that are bound to the Java component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + """ + super().__init__(configurations=configurations, scale=scale, service_binds=service_binds, **kwargs) + self.component_type: str = "SpringCloudConfig" -class SourceControl(ProxyResource): - """Container App SourceControl. +class SpringCloudEurekaComponent(JavaComponentProperties): + """Spring Cloud Eureka properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar operation_state: Current provisioning State of the operation. Known values are: - "InProgress", "Succeeded", "Failed", and "Canceled". - :vartype operation_state: str or ~azure.mgmt.appcontainers.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. - :vartype branch: str - :ivar github_action_configuration: 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 github_action_configuration: - ~azure.mgmt.appcontainers.models.GithubActionConfiguration + All required parameters must be populated in order to send to server. + + :ivar component_type: Type of the Java Component. Required. Known values are: + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :ivar provisioning_state: Provisioning state of the Java Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState + :ivar configurations: List of Java Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar scale: Java component scaling configurations. + :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :ivar service_binds: List of Java Components that are bound to the Java component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :ivar ingress: Java Component Ingress configurations. + :vartype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "operation_state": {"readonly": True}, + "component_type": {"required": True}, + "provisioning_state": {"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"}, - "operation_state": {"key": "properties.operationState", "type": "str"}, - "repo_url": {"key": "properties.repoUrl", "type": "str"}, - "branch": {"key": "properties.branch", "type": "str"}, - "github_action_configuration": { - "key": "properties.githubActionConfiguration", - "type": "GithubActionConfiguration", - }, + "component_type": {"key": "componentType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "configurations": {"key": "configurations", "type": "[JavaComponentConfigurationProperty]"}, + "scale": {"key": "scale", "type": "JavaComponentPropertiesScale"}, + "service_binds": {"key": "serviceBinds", "type": "[JavaComponentServiceBind]"}, + "ingress": {"key": "ingress", "type": "JavaComponentIngress"}, } def __init__( self, *, - repo_url: Optional[str] = None, - branch: Optional[str] = None, - github_action_configuration: Optional["_models.GithubActionConfiguration"] = None, + configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + scale: Optional["_models.JavaComponentPropertiesScale"] = None, + service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, + ingress: Optional["_models.JavaComponentIngress"] = None, **kwargs: Any ) -> None: """ - :keyword repo_url: The repo url which will be integrated to ContainerApp. - :paramtype repo_url: str - :keyword branch: The branch which will trigger the auto deployment. - :paramtype branch: str - :keyword github_action_configuration: 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. - :paramtype github_action_configuration: - ~azure.mgmt.appcontainers.models.GithubActionConfiguration + :keyword configurations: List of Java Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :keyword scale: Java component scaling configurations. + :paramtype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :keyword service_binds: List of Java Components that are bound to the Java component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :keyword ingress: Java Component Ingress configurations. + :paramtype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress """ - super().__init__(**kwargs) - self.operation_state = None - self.repo_url = repo_url - self.branch = branch - self.github_action_configuration = github_action_configuration + super().__init__(configurations=configurations, scale=scale, service_binds=service_binds, **kwargs) + self.component_type: str = "SpringCloudEureka" + self.ingress = ingress -class SourceControlCollection(_serialization.Model): - """SourceControl collection ARM resource. +class SpringCloudGatewayComponent(JavaComponentProperties): + """Spring Cloud Gateway properties. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.SourceControl] - :ivar next_link: Link to next page of resources. - :vartype next_link: str + :ivar component_type: Type of the Java Component. Required. Known values are: + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :ivar provisioning_state: Provisioning state of the Java Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState + :ivar configurations: List of Java Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar scale: Java component scaling configurations. + :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :ivar service_binds: List of Java Components that are bound to the Java component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :ivar ingress: Java Component Ingress configurations. + :vartype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress + :ivar spring_cloud_gateway_routes: Gateway route definition. + :vartype spring_cloud_gateway_routes: list[~azure.mgmt.appcontainers.models.ScgRoute] """ _validation = { - "value": {"required": True}, - "next_link": {"readonly": True}, + "component_type": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[SourceControl]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "component_type": {"key": "componentType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "configurations": {"key": "configurations", "type": "[JavaComponentConfigurationProperty]"}, + "scale": {"key": "scale", "type": "JavaComponentPropertiesScale"}, + "service_binds": {"key": "serviceBinds", "type": "[JavaComponentServiceBind]"}, + "ingress": {"key": "ingress", "type": "JavaComponentIngress"}, + "spring_cloud_gateway_routes": {"key": "springCloudGatewayRoutes", "type": "[ScgRoute]"}, } - def __init__(self, *, value: List["_models.SourceControl"], **kwargs: Any) -> None: + def __init__( + self, + *, + configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + scale: Optional["_models.JavaComponentPropertiesScale"] = None, + service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, + ingress: Optional["_models.JavaComponentIngress"] = None, + spring_cloud_gateway_routes: Optional[List["_models.ScgRoute"]] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.SourceControl] + :keyword configurations: List of Java Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :keyword scale: Java component scaling configurations. + :paramtype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :keyword service_binds: List of Java Components that are bound to the Java component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :keyword ingress: Java Component Ingress configurations. + :paramtype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress + :keyword spring_cloud_gateway_routes: Gateway route definition. + :paramtype spring_cloud_gateway_routes: list[~azure.mgmt.appcontainers.models.ScgRoute] """ - super().__init__(**kwargs) - self.value = value - self.next_link = None + super().__init__(configurations=configurations, scale=scale, service_binds=service_binds, **kwargs) + self.component_type: str = "SpringCloudGateway" + self.ingress = ingress + self.spring_cloud_gateway_routes = spring_cloud_gateway_routes class SystemData(_serialization.Model): @@ -10155,11 +12622,15 @@ class TcpScaleRule(_serialization.Model): :vartype metadata: dict[str, str] :ivar auth: Authentication secrets for the tcp scale rule. :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :vartype identity: str """ _attribute_map = { "metadata": {"key": "metadata", "type": "{str}"}, "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "identity": {"key": "identity", "type": "str"}, } def __init__( @@ -10167,6 +12638,7 @@ def __init__( *, metadata: Optional[Dict[str, str]] = None, auth: Optional[List["_models.ScaleRuleAuth"]] = None, + identity: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -10174,10 +12646,14 @@ def __init__( :paramtype metadata: dict[str, str] :keyword auth: Authentication secrets for the tcp scale rule. :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :paramtype identity: str """ super().__init__(**kwargs) self.metadata = metadata self.auth = auth + self.identity = identity class Template(_serialization.Model): @@ -10653,7 +13129,7 @@ class Volume(_serialization.Model): :ivar name: Volume name. :vartype name: str :ivar storage_type: Storage type for the volume. If not provided, use EmptyDir. Known values - are: "AzureFile", "EmptyDir", "Secret", and "NfsAzureFile". + are: "AzureFile", "EmptyDir", "Secret", "NfsAzureFile", and "Smb". :vartype storage_type: str or ~azure.mgmt.appcontainers.models.StorageType :ivar storage_name: Name of storage resource. No need to provide for EmptyDir and Secret. :vartype storage_name: str @@ -10687,7 +13163,7 @@ def __init__( :keyword name: Volume name. :paramtype name: str :keyword storage_type: Storage type for the volume. If not provided, use EmptyDir. Known values - are: "AzureFile", "EmptyDir", "Secret", and "NfsAzureFile". + are: "AzureFile", "EmptyDir", "Secret", "NfsAzureFile", and "Smb". :paramtype storage_type: str or ~azure.mgmt.appcontainers.models.StorageType :keyword storage_name: Name of storage resource. No need to provide for EmptyDir and Secret. :paramtype storage_name: str @@ -10749,6 +13225,218 @@ def __init__( self.sub_path = sub_path +class WorkflowArtifacts(_serialization.Model): + """The workflow filter. + + :ivar app_settings: Application settings of the workflow. + :vartype app_settings: JSON + :ivar files: Files of the app. + :vartype files: JSON + :ivar files_to_delete: Files of the app to delete. + :vartype files_to_delete: list[str] + """ + + _attribute_map = { + "app_settings": {"key": "appSettings", "type": "object"}, + "files": {"key": "files", "type": "object"}, + "files_to_delete": {"key": "filesToDelete", "type": "[str]"}, + } + + def __init__( + self, + *, + app_settings: Optional[JSON] = None, + files: Optional[JSON] = None, + files_to_delete: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword app_settings: Application settings of the workflow. + :paramtype app_settings: JSON + :keyword files: Files of the app. + :paramtype files: JSON + :keyword files_to_delete: Files of the app to delete. + :paramtype files_to_delete: list[str] + """ + super().__init__(**kwargs) + self.app_settings = app_settings + self.files = files + self.files_to_delete = files_to_delete + + +class WorkflowEnvelope(_serialization.Model): + """Workflow properties definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource id. + :vartype id: str + :ivar name: Gets the resource name. + :vartype name: str + :ivar type: Gets the resource type. + :vartype type: str + :ivar kind: The resource kind. + :vartype kind: str + :ivar location: The resource location. + :vartype location: str + :ivar properties: Additional workflow properties. + :vartype properties: ~azure.mgmt.appcontainers.models.WorkflowEnvelopeProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "WorkflowEnvelopeProperties"}, + } + + def __init__( + self, + *, + kind: Optional[str] = None, + location: Optional[str] = None, + properties: Optional["_models.WorkflowEnvelopeProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword kind: The resource kind. + :paramtype kind: str + :keyword location: The resource location. + :paramtype location: str + :keyword properties: Additional workflow properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.WorkflowEnvelopeProperties + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.kind = kind + self.location = location + self.properties = properties + + +class WorkflowEnvelopeCollection(_serialization.Model): + """Collection of workflow information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.WorkflowEnvelope] + :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": "[WorkflowEnvelope]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.WorkflowEnvelope"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.WorkflowEnvelope] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class WorkflowEnvelopeProperties(_serialization.Model): + """Additional workflow properties. + + :ivar files: Gets or sets the files. + :vartype files: JSON + :ivar flow_state: Gets or sets the state of the workflow. Known values are: "NotSpecified", + "Completed", "Enabled", "Disabled", "Deleted", and "Suspended". + :vartype flow_state: str or ~azure.mgmt.appcontainers.models.WorkflowState + :ivar health: Gets or sets workflow health. + :vartype health: ~azure.mgmt.appcontainers.models.WorkflowHealth + """ + + _attribute_map = { + "files": {"key": "files", "type": "object"}, + "flow_state": {"key": "flowState", "type": "str"}, + "health": {"key": "health", "type": "WorkflowHealth"}, + } + + def __init__( + self, + *, + files: Optional[JSON] = None, + flow_state: Optional[Union[str, "_models.WorkflowState"]] = None, + health: Optional["_models.WorkflowHealth"] = None, + **kwargs: Any + ) -> None: + """ + :keyword files: Gets or sets the files. + :paramtype files: JSON + :keyword flow_state: Gets or sets the state of the workflow. Known values are: "NotSpecified", + "Completed", "Enabled", "Disabled", "Deleted", and "Suspended". + :paramtype flow_state: str or ~azure.mgmt.appcontainers.models.WorkflowState + :keyword health: Gets or sets workflow health. + :paramtype health: ~azure.mgmt.appcontainers.models.WorkflowHealth + """ + super().__init__(**kwargs) + self.files = files + self.flow_state = flow_state + self.health = health + + +class WorkflowHealth(_serialization.Model): + """Represents the workflow health. + + All required parameters must be populated in order to send to server. + + :ivar state: Gets or sets the workflow health state. Required. Known values are: + "NotSpecified", "Healthy", "Unhealthy", and "Unknown". + :vartype state: str or ~azure.mgmt.appcontainers.models.WorkflowHealthState + :ivar error: Gets or sets the workflow error. + :vartype error: ~azure.mgmt.appcontainers.models.ErrorEntity + """ + + _validation = { + "state": {"required": True}, + } + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + "error": {"key": "error", "type": "ErrorEntity"}, + } + + def __init__( + self, + *, + state: Union[str, "_models.WorkflowHealthState"], + error: Optional["_models.ErrorEntity"] = None, + **kwargs: Any + ) -> None: + """ + :keyword state: Gets or sets the workflow health state. Required. Known values are: + "NotSpecified", "Healthy", "Unhealthy", and "Unknown". + :paramtype state: str or ~azure.mgmt.appcontainers.models.WorkflowHealthState + :keyword error: Gets or sets the workflow error. + :paramtype error: ~azure.mgmt.appcontainers.models.ErrorEntity + """ + super().__init__(**kwargs) + self.state = state + self.error = error + + class WorkloadProfile(_serialization.Model): """Workload profile to scope container app execution. @@ -10807,8 +13495,8 @@ class WorkloadProfileStates(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py index 27819202ef8e..f105aaf0a686 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py @@ -19,28 +19,38 @@ from ._connected_environments_dapr_components_operations import ConnectedEnvironmentsDaprComponentsOperations from ._connected_environments_storages_operations import ConnectedEnvironmentsStoragesOperations from ._container_apps_operations import ContainerAppsOperations +from ._container_apps_builds_by_container_app_operations import ContainerAppsBuildsByContainerAppOperations +from ._container_apps_builds_operations import ContainerAppsBuildsOperations +from ._container_apps_patches_operations import ContainerAppsPatchesOperations from ._container_apps_revisions_operations import ContainerAppsRevisionsOperations from ._container_apps_revision_replicas_operations import ContainerAppsRevisionReplicasOperations from ._container_apps_diagnostics_operations import ContainerAppsDiagnosticsOperations from ._managed_environment_diagnostics_operations import ManagedEnvironmentDiagnosticsOperations from ._managed_environments_diagnostics_operations import ManagedEnvironmentsDiagnosticsOperations from ._jobs_operations import JobsOperations +from ._dot_net_components_operations import DotNetComponentsOperations +from ._functions_extension_operations import FunctionsExtensionOperations from ._operations import Operations +from ._java_components_operations import JavaComponentsOperations from ._jobs_executions_operations import JobsExecutionsOperations from ._container_apps_api_client_operations import ContainerAppsAPIClientOperationsMixin +from ._logic_apps_operations import LogicAppsOperations from ._managed_environments_operations import ManagedEnvironmentsOperations from ._certificates_operations import CertificatesOperations from ._managed_certificates_operations import ManagedCertificatesOperations from ._namespaces_operations import NamespacesOperations +from ._managed_environment_private_endpoint_connections_operations import ( + ManagedEnvironmentPrivateEndpointConnectionsOperations, +) +from ._managed_environment_private_link_resources_operations import ManagedEnvironmentPrivateLinkResourcesOperations from ._dapr_component_resiliency_policies_operations import DaprComponentResiliencyPoliciesOperations from ._dapr_components_operations import DaprComponentsOperations from ._dapr_subscriptions_operations import DaprSubscriptionsOperations from ._managed_environments_storages_operations import ManagedEnvironmentsStoragesOperations +from ._container_apps_session_pools_operations import ContainerAppsSessionPoolsOperations from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations from ._usages_operations import UsagesOperations from ._managed_environment_usages_operations import ManagedEnvironmentUsagesOperations -from ._java_components_operations import JavaComponentsOperations -from ._dot_net_components_operations import DotNetComponentsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -60,28 +70,36 @@ "ConnectedEnvironmentsDaprComponentsOperations", "ConnectedEnvironmentsStoragesOperations", "ContainerAppsOperations", + "ContainerAppsBuildsByContainerAppOperations", + "ContainerAppsBuildsOperations", + "ContainerAppsPatchesOperations", "ContainerAppsRevisionsOperations", "ContainerAppsRevisionReplicasOperations", "ContainerAppsDiagnosticsOperations", "ManagedEnvironmentDiagnosticsOperations", "ManagedEnvironmentsDiagnosticsOperations", "JobsOperations", + "DotNetComponentsOperations", + "FunctionsExtensionOperations", "Operations", + "JavaComponentsOperations", "JobsExecutionsOperations", "ContainerAppsAPIClientOperationsMixin", + "LogicAppsOperations", "ManagedEnvironmentsOperations", "CertificatesOperations", "ManagedCertificatesOperations", "NamespacesOperations", + "ManagedEnvironmentPrivateEndpointConnectionsOperations", + "ManagedEnvironmentPrivateLinkResourcesOperations", "DaprComponentResiliencyPoliciesOperations", "DaprComponentsOperations", "DaprSubscriptionsOperations", "ManagedEnvironmentsStoragesOperations", + "ContainerAppsSessionPoolsOperations", "ContainerAppsSourceControlsOperations", "UsagesOperations", "ManagedEnvironmentUsagesOperations", - "JavaComponentsOperations", - "DotNetComponentsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_app_resiliency_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_app_resiliency_operations.py index 335c0f80f99e..be32fedbb1ee 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_app_resiliency_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_app_resiliency_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,19 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +47,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -80,7 +84,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -117,7 +121,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -151,7 +155,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,7 +187,7 @@ def build_list_request(resource_group_name: str, app_name: str, subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -320,7 +324,7 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.AppResiliency :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -355,7 +359,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -370,11 +373,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppResiliency", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppResiliency", pipeline_response) + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -472,7 +471,7 @@ def update( :rtype: ~azure.mgmt.appcontainers.models.AppResiliency :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -507,7 +506,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -522,7 +520,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppResiliency", pipeline_response) + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -548,7 +546,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -571,7 +569,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -606,7 +603,7 @@ def get(self, resource_group_name: str, app_name: str, name: str, **kwargs: Any) :rtype: ~azure.mgmt.appcontainers.models.AppResiliency :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -629,7 +626,6 @@ def get(self, resource_group_name: str, app_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -644,7 +640,7 @@ def get(self, resource_group_name: str, app_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppResiliency", pipeline_response) + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -672,7 +668,7 @@ def list(self, resource_group_name: str, app_name: str, **kwargs: Any) -> Iterab api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AppResiliencyCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -691,7 +687,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -707,7 +702,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_available_workload_profiles_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_available_workload_profiles_operations.py index b5b3325841ae..4a47203625c6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_available_workload_profiles_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_available_workload_profiles_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +44,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +106,7 @@ def get(self, location: str, **kwargs: Any) -> Iterable["_models.AvailableWorklo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailableWorkloadProfilesCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -120,7 +124,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -136,7 +139,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_billing_meters_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_billing_meters_operations.py index cc656256a0da..6b8afead8a5f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_billing_meters_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_billing_meters_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +42,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +96,7 @@ def get(self, location: str, **kwargs: Any) -> _models.BillingMeterCollection: :rtype: ~azure.mgmt.appcontainers.models.BillingMeterCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +117,6 @@ def get(self, location: str, **kwargs: Any) -> _models.BillingMeterCollection: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -128,7 +131,7 @@ def get(self, location: str, **kwargs: Any) -> _models.BillingMeterCollection: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BillingMeterCollection", pipeline_response) + deserialized = self._deserialize("BillingMeterCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_build_auth_token_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_build_auth_token_operations.py index 03f255159915..3cd9a7362204 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_build_auth_token_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_build_auth_token_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +44,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,7 +110,7 @@ def list(self, resource_group_name: str, builder_name: str, build_name: str, **k :rtype: ~azure.mgmt.appcontainers.models.BuildToken :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -129,7 +133,6 @@ def list(self, resource_group_name: str, builder_name: str, build_name: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -144,7 +147,7 @@ def list(self, resource_group_name: str, builder_name: str, build_name: str, **k error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BuildToken", pipeline_response) + deserialized = self._deserialize("BuildToken", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py index 2ee9ea5294f4..4f762440425f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +49,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +73,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +103,7 @@ def build_get_request(resource_group_name: str, builder_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +138,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -170,7 +176,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -208,7 +214,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +276,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.BuilderResour api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -287,7 +293,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -303,7 +308,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -350,7 +354,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -368,7 +372,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -384,7 +387,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -427,7 +429,7 @@ def get(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> _mo :rtype: ~azure.mgmt.appcontainers.models.BuilderResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -449,7 +451,6 @@ def get(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> _mo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -464,7 +465,7 @@ def get(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BuilderResource", pipeline_response) + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -477,8 +478,8 @@ def _create_or_update_initial( builder_name: str, builder_envelope: Union[_models.BuilderResource, IO[bytes]], **kwargs: Any - ) -> _models.BuilderResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -491,7 +492,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -512,10 +513,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -523,20 +524,21 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("BuilderResource", pipeline_response) - if response.status_code == 201: response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("BuilderResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -643,10 +645,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response) + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -676,8 +679,8 @@ def _update_initial( builder_name: str, builder_envelope: Union[_models.BuilderResourceUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.BuilderResource]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -690,7 +693,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.BuilderResource]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -711,10 +714,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -722,18 +725,20 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("BuilderResource", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -839,10 +844,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response) + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -866,10 +872,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, builder_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -881,7 +885,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -891,10 +895,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -902,6 +906,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -910,8 +918,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> LROPoller[None]: @@ -935,7 +947,7 @@ def begin_delete(self, resource_group_name: str, builder_name: str, **kwargs: An lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, builder_name=builder_name, api_version=api_version, @@ -944,6 +956,7 @@ def begin_delete(self, resource_group_name: str, builder_name: str, **kwargs: An params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_by_builder_resource_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_by_builder_resource_operations.py index b1a3d7ef324f..9c686d39de32 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_by_builder_resource_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_by_builder_resource_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +44,7 @@ def build_list_request(resource_group_name: str, builder_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +111,7 @@ def list(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -126,7 +130,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -142,7 +145,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py index 8007534cc4ae..a7e2e7596747 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +16,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,8 +30,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +49,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +87,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -122,7 +128,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,7 +194,7 @@ def get(self, resource_group_name: str, builder_name: str, build_name: str, **kw :rtype: ~azure.mgmt.appcontainers.models.BuildResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -211,7 +217,6 @@ def get(self, resource_group_name: str, builder_name: str, build_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -226,7 +231,7 @@ def get(self, resource_group_name: str, builder_name: str, build_name: str, **kw error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BuildResource", pipeline_response) + deserialized = self._deserialize("BuildResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -240,8 +245,8 @@ def _create_or_update_initial( build_name: str, build_envelope: Union[_models.BuildResource, IO[bytes]], **kwargs: Any - ) -> _models.BuildResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,7 +259,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -276,10 +281,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -287,20 +292,21 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("BuildResource", pipeline_response) - if response.status_code == 201: response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("BuildResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -417,10 +423,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildResource", pipeline_response) + deserialized = self._deserialize("BuildResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -444,10 +451,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -459,7 +466,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -470,10 +477,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -481,6 +488,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -489,8 +500,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -518,7 +533,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, builder_name=builder_name, build_name=build_name, @@ -528,6 +543,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py index 2739382988f7..9b457d917c5f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,19 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +114,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -147,7 +151,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -181,7 +185,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -252,7 +256,7 @@ def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -271,7 +275,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -287,7 +290,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -336,7 +338,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -359,7 +361,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -374,7 +375,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -472,7 +473,7 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -510,7 +511,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -525,7 +525,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -551,7 +551,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -574,7 +574,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -683,7 +682,7 @@ def update( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -718,7 +717,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -733,7 +731,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_certificates_operations.py index e06b5f9cbd78..b10af3ef7e97 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_certificates_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,19 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,7 +84,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -118,7 +122,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -159,7 +163,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -197,7 +201,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -270,7 +274,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -289,7 +293,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -305,7 +308,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -354,7 +356,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -377,7 +379,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -392,7 +393,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -490,7 +491,7 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -528,7 +529,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -543,7 +543,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -569,7 +569,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -592,7 +592,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -701,7 +700,7 @@ def update( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -736,7 +735,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -751,7 +749,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_dapr_components_operations.py index db1d06c8ffd3..eb633380a8ad 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_dapr_components_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,19 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +114,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -147,7 +151,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -181,7 +185,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -251,7 +255,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprComponentsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -270,7 +274,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -286,7 +289,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -335,7 +337,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -358,7 +360,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -373,7 +374,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response) + deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -471,7 +472,7 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -506,7 +507,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -521,7 +521,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response) + deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -547,7 +547,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -570,7 +570,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -607,7 +606,7 @@ def list_secrets( :rtype: ~azure.mgmt.appcontainers.models.DaprSecretsCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -630,7 +629,6 @@ def list_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -645,7 +643,7 @@ def list_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprSecretsCollection", pipeline_response) + deserialized = self._deserialize("DaprSecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_operations.py index 8bc2e4540fbc..8ac6a1053656 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +49,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +73,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +105,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +138,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -168,7 +174,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -201,7 +207,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -234,7 +240,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -300,7 +306,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ConnectedEnvi api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectedEnvironmentCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -317,7 +323,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -333,7 +338,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -383,7 +387,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectedEnvironmentCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -401,7 +405,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -417,7 +420,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -462,7 +464,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -484,7 +486,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -499,7 +500,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -512,8 +513,8 @@ def _create_or_update_initial( connected_environment_name: str, environment_envelope: Union[_models.ConnectedEnvironment, IO[bytes]], **kwargs: Any - ) -> _models.ConnectedEnvironment: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -526,7 +527,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConnectedEnvironment] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -547,10 +548,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -558,15 +559,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, 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) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -673,10 +674,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -700,10 +702,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, connected_environment_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -715,7 +717,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -725,10 +727,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -736,6 +738,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -744,8 +750,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, connected_environment_name: str, **kwargs: Any) -> LROPoller[None]: @@ -771,7 +781,7 @@ def begin_delete(self, resource_group_name: str, connected_environment_name: str lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, api_version=api_version, @@ -780,6 +790,7 @@ def begin_delete(self, resource_group_name: str, connected_environment_name: str params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -820,7 +831,7 @@ def update( :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -842,7 +853,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -857,7 +867,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -950,7 +960,7 @@ def check_name_availability( :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -984,7 +994,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -999,7 +1008,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_storages_operations.py index 084b50d04075..baea46cebb95 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_storages_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +112,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -145,7 +149,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -209,7 +213,7 @@ def list( :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStoragesCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,7 +235,6 @@ def list( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -246,7 +249,7 @@ def list( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironmentStoragesCollection", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironmentStoragesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -272,7 +275,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -295,7 +298,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -310,7 +312,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -409,7 +411,7 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -444,7 +446,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -459,7 +460,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -485,7 +486,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -508,7 +509,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py index b959732eef68..42a17070e70f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +44,7 @@ def build_job_execution_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +80,7 @@ def build_get_custom_domain_verification_id_request( # pylint: disable=name-too _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,6 +103,7 @@ def build_get_custom_domain_verification_id_request( # pylint: disable=name-too class ContainerAppsAPIClientOperationsMixin(ContainerAppsAPIClientMixinABC): + @distributed_trace def job_execution( self, resource_group_name: str, job_name: str, job_execution_name: str, **kwargs: Any @@ -118,7 +123,7 @@ def job_execution( :rtype: ~azure.mgmt.appcontainers.models.JobExecution :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -141,7 +146,6 @@ def job_execution( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -156,7 +160,7 @@ def job_execution( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("JobExecution", pipeline_response) + deserialized = self._deserialize("JobExecution", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -171,7 +175,7 @@ def get_custom_domain_verification_id(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +195,6 @@ def get_custom_domain_verification_id(self, **kwargs: Any) -> str: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -206,7 +209,7 @@ def get_custom_domain_verification_id(self, **kwargs: Any) -> str: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py index 6d16ff0bbc57..127c410254bb 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,19 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +47,7 @@ def build_list_by_container_app_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +114,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -147,7 +151,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -217,7 +221,7 @@ def list_by_container_app( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AuthConfigCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -236,7 +240,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -252,7 +255,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -301,7 +303,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.AuthConfig :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -324,7 +326,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -339,7 +340,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AuthConfig", pipeline_response) + deserialized = self._deserialize("AuthConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -437,7 +438,7 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.AuthConfig :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -472,7 +473,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -487,7 +487,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AuthConfig", pipeline_response) + deserialized = self._deserialize("AuthConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -513,7 +513,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -536,7 +536,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_by_container_app_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_by_container_app_operations.py new file mode 100644 index 000000000000..03fb5f627546 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_by_container_app_operations.py @@ -0,0 +1,181 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, container_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/builds", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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", pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ContainerAppsBuildsByContainerAppOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_builds_by_container_app` 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, container_app_name: str, **kwargs: Any + ) -> Iterable["_models.ContainerAppsBuildResource"]: + """List Container Apps Build resources by Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :return: An iterator like instance of either ContainerAppsBuildResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ContainerAppsBuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsBuildCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ContainerAppsBuildCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_operations.py new file mode 100644 index 000000000000..c4f6013eff60 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_operations.py @@ -0,0 +1,315 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterator, Optional, Type, TypeVar, Union, cast + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, container_app_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/builds/{buildName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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", pattern=r"^[-\w\._\(\)]+$" + ), + "buildName": _SERIALIZER.url( + "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, container_app_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/builds/{buildName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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", pattern=r"^[-\w\._\(\)]+$" + ), + "buildName": _SERIALIZER.url( + "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ContainerAppsBuildsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_builds` 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( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> _models.ContainerAppsBuildResource: + """Get a Container Apps Build resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: ContainerAppsBuildResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ContainerAppsBuildResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsBuildResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ContainerAppsBuildResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a Container Apps Build resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_diagnostics_operations.py index 5014cf298b1b..0524c81f5fd2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_diagnostics_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar, cast import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +46,7 @@ def build_list_detectors_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +79,7 @@ def build_get_detector_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +118,7 @@ def build_list_revisions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,7 +153,7 @@ def build_get_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,7 +187,7 @@ def build_get_root_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -253,7 +257,7 @@ def list_detectors( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DiagnosticsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -272,7 +276,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -288,7 +291,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -337,7 +339,7 @@ def get_detector( :rtype: ~azure.mgmt.appcontainers.models.Diagnostics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,7 +362,6 @@ def get_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -375,7 +376,7 @@ def get_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Diagnostics", pipeline_response) + deserialized = self._deserialize("Diagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -407,7 +408,7 @@ def list_revisions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RevisionCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +428,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -443,7 +443,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -492,7 +491,7 @@ def get_revision( :rtype: ~azure.mgmt.appcontainers.models.Revision :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -515,7 +514,6 @@ def get_revision( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -530,7 +528,7 @@ def get_revision( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Revision", pipeline_response) + deserialized = self._deserialize("Revision", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -552,11 +550,14 @@ def get_root(self, resource_group_name: str, container_app_name: str, **kwargs: :rtype: ~azure.mgmt.appcontainers.models.ContainerApp :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 404: lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + 404: cast( + Type[HttpResponseError], + lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -574,7 +575,6 @@ def get_root(self, resource_group_name: str, container_app_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -589,7 +589,7 @@ def get_root(self, resource_group_name: str, container_app_name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py index c4bec66f23ce..6e2e596382cd 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +49,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +73,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +105,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +138,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -168,7 +174,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -201,7 +207,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -242,7 +248,7 @@ def build_list_custom_host_name_analysis_request( # pylint: disable=name-too-lo _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -277,7 +283,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,7 +316,7 @@ def build_get_auth_token_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -343,7 +349,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -378,7 +384,7 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -442,7 +448,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ContainerApp" api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContainerAppCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -459,7 +465,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -475,7 +480,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -524,7 +528,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContainerAppCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -542,7 +546,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -558,7 +561,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -603,11 +605,14 @@ def get(self, resource_group_name: str, container_app_name: str, **kwargs: Any) :rtype: ~azure.mgmt.appcontainers.models.ContainerApp :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 404: lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + 404: cast( + Type[HttpResponseError], + lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -625,7 +630,6 @@ def get(self, resource_group_name: str, container_app_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -640,7 +644,7 @@ def get(self, resource_group_name: str, container_app_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -653,8 +657,8 @@ def _create_or_update_initial( container_app_name: str, container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any - ) -> _models.ContainerApp: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -667,7 +671,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerApp] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -688,10 +692,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -699,15 +703,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -820,10 +824,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -847,10 +852,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, container_app_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, container_app_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -862,7 +865,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -872,10 +875,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -883,6 +886,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -891,8 +898,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, container_app_name: str, **kwargs: Any) -> LROPoller[None]: @@ -918,7 +929,7 @@ def begin_delete(self, resource_group_name: str, container_app_name: str, **kwar lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, container_app_name=container_app_name, api_version=api_version, @@ -927,6 +938,7 @@ def begin_delete(self, resource_group_name: str, container_app_name: str, **kwar params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -956,8 +968,8 @@ def _update_initial( container_app_name: str, container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ContainerApp]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -970,7 +982,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ContainerApp]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -991,10 +1003,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1002,18 +1014,20 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1125,10 +1139,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1169,7 +1184,7 @@ def list_custom_host_name_analysis( :rtype: ~azure.mgmt.appcontainers.models.CustomHostnameAnalysisResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1192,7 +1207,6 @@ def list_custom_host_name_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1207,7 +1221,7 @@ def list_custom_host_name_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1231,7 +1245,7 @@ def list_secrets( :rtype: ~azure.mgmt.appcontainers.models.SecretsCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1253,7 +1267,6 @@ def list_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1268,7 +1281,7 @@ def list_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecretsCollection", pipeline_response) + deserialized = self._deserialize("SecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1292,11 +1305,14 @@ def get_auth_token( :rtype: ~azure.mgmt.appcontainers.models.ContainerAppAuthToken :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 404: lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + 404: cast( + Type[HttpResponseError], + lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -1314,7 +1330,6 @@ def get_auth_token( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1329,17 +1344,15 @@ def get_auth_token( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContainerAppAuthToken", pipeline_response) + deserialized = self._deserialize("ContainerAppAuthToken", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _start_initial( - self, resource_group_name: str, container_app_name: str, **kwargs: Any - ) -> Optional[_models.ContainerApp]: - error_map = { + def _start_initial(self, resource_group_name: str, container_app_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1351,7 +1364,7 @@ def _start_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.ContainerApp]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_request( resource_group_name=resource_group_name, @@ -1361,10 +1374,10 @@ def _start_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1372,18 +1385,20 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1425,10 +1440,11 @@ def begin_start( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1452,10 +1468,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _stop_initial( - self, resource_group_name: str, container_app_name: str, **kwargs: Any - ) -> Optional[_models.ContainerApp]: - error_map = { + def _stop_initial(self, resource_group_name: str, container_app_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1467,7 +1481,7 @@ def _stop_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.ContainerApp]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_request( resource_group_name=resource_group_name, @@ -1477,10 +1491,10 @@ def _stop_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1488,18 +1502,20 @@ def _stop_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1541,10 +1557,11 @@ def begin_stop( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_patches_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_patches_operations.py new file mode 100644 index 000000000000..b245c359d6fa --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_patches_operations.py @@ -0,0 +1,857 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_container_app_request( + resource_group_name: str, + container_app_name: str, + subscription_id: 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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", pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # 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_request( + resource_group_name: str, container_app_name: str, patch_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches/{patchName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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", pattern=r"^[-\w\._\(\)]+$" + ), + "patchName": _SERIALIZER.url( + "patch_name", patch_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, container_app_name: str, patch_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches/{patchName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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", pattern=r"^[-\w\._\(\)]+$" + ), + "patchName": _SERIALIZER.url( + "patch_name", patch_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_skip_configure_request( + resource_group_name: str, container_app_name: str, patch_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches/{patchName}/skipConfig", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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", pattern=r"^[-\w\._\(\)]+$" + ), + "patchName": _SERIALIZER.url( + "patch_name", patch_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # 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, **kwargs) + + +def build_apply_request( + resource_group_name: str, container_app_name: str, patch_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches/{patchName}/apply", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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", pattern=r"^[-\w\._\(\)]+$" + ), + "patchName": _SERIALIZER.url( + "patch_name", patch_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ContainerAppsPatchesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_patches` 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_container_app( + self, resource_group_name: str, container_app_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.ContainerAppsPatchResource"]: + """List Container Apps Patch resources by ContainerApp. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param filter: The filter to apply on the operation. For example, + $filter=properties/patchApplyStatus eq 'Succeeded'. Default value is None. + :type filter: str + :return: An iterator like instance of either ContainerAppsPatchResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PatchCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_container_app_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PatchCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> _models.ContainerAppsPatchResource: + """Get details for specific Container Apps Patch by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: ContainerAppsPatchResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ContainerAppsPatchResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsPatchResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ContainerAppsPatchResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete specific Container Apps Patch by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _skip_configure_initial( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: Union[_models.PatchSkipConfig, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(patch_skip_config, (IOBase, bytes)): + _content = patch_skip_config + else: + _json = self._serialize.body(patch_skip_config, "PatchSkipConfig") + + _request = build_skip_configure_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: _models.PatchSkipConfig, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Required. + :type patch_skip_config: ~azure.mgmt.appcontainers.models.PatchSkipConfig + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Required. + :type patch_skip_config: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: Union[_models.PatchSkipConfig, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Is either a PatchSkipConfig + type or a IO[bytes] type. Required. + :type patch_skip_config: ~azure.mgmt.appcontainers.models.PatchSkipConfig or IO[bytes] + :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 {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._skip_configure_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + patch_skip_config=patch_skip_config, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _apply_initial( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_apply_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_apply( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> LROPoller[_models.ContainerAppsPatchResource]: + """Apply a Container Apps Patch resource with patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: An instance of LROPoller that returns either ContainerAppsPatchResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsPatchResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._apply_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ContainerAppsPatchResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ContainerAppsPatchResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ContainerAppsPatchResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py index 513cfd8687bd..56f9613a874e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +49,7 @@ def build_get_replica_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,7 +84,7 @@ def build_list_replicas_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -148,7 +152,7 @@ def get_replica( :rtype: ~azure.mgmt.appcontainers.models.Replica :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -172,7 +176,6 @@ def get_replica( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -187,7 +190,7 @@ def get_replica( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Replica", pipeline_response) + deserialized = self._deserialize("Replica", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -213,7 +216,7 @@ def list_replicas( :rtype: ~azure.mgmt.appcontainers.models.ReplicaCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -236,7 +239,6 @@ def list_replicas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -251,7 +253,7 @@ def list_replicas( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ReplicaCollection", pipeline_response) + deserialized = self._deserialize("ReplicaCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py index dbb59afb6558..f55e4f73edd3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +51,7 @@ def build_list_revisions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +86,7 @@ def build_get_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,7 +120,7 @@ def build_activate_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +154,7 @@ def build_deactivate_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +188,7 @@ def build_restart_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -256,7 +260,7 @@ def list_revisions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RevisionCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -276,7 +280,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -292,7 +295,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -341,7 +343,7 @@ def get_revision( :rtype: ~azure.mgmt.appcontainers.models.Revision :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -364,7 +366,6 @@ def get_revision( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -379,7 +380,7 @@ def get_revision( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Revision", pipeline_response) + deserialized = self._deserialize("Revision", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -405,7 +406,7 @@ def activate_revision( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -428,7 +429,6 @@ def activate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -465,7 +465,7 @@ def deactivate_revision( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +488,6 @@ def deactivate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -525,7 +524,7 @@ def restart_revision( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -548,7 +547,6 @@ def restart_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_session_pools_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_session_pools_operations.py new file mode 100644 index 000000000000..0cc9e78aaaf3 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_session_pools_operations.py @@ -0,0 +1,965 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/sessionPools") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, subscription_id: str, session_pool_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sessionPoolName": _SERIALIZER.url( + "session_pool_name", session_pool_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, subscription_id: str, session_pool_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sessionPoolName": _SERIALIZER.url( + "session_pool_name", session_pool_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # 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, **kwargs) + + +def build_update_request( + resource_group_name: str, subscription_id: str, session_pool_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sessionPoolName": _SERIALIZER.url( + "session_pool_name", session_pool_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # 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, **kwargs) + + +def build_delete_request( + resource_group_name: str, subscription_id: str, session_pool_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sessionPoolName": _SERIALIZER.url( + "session_pool_name", session_pool_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ContainerAppsSessionPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_session_pools` 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.SessionPool"]: + """Get the session pools in a given subscription. + + Get the session pools in a given subscription. + + :return: An iterator like instance of either SessionPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionPoolCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SessionPoolCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SessionPool"]: + """Get the session pools in a given resource group of a subscription. + + Get the session pools in a given resource group of a subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either SessionPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionPoolCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SessionPoolCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, **kwargs: Any) -> _models.SessionPool: + """Get the properties of a session pool. + + Get the properties of a session pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: SessionPool or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.SessionPool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionPool] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + session_pool_name=self._config.session_pool_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionPool", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, resource_group_name: str, session_pool_envelope: Union[_models.SessionPool, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_pool_envelope, (IOBase, bytes)): + _content = session_pool_envelope + else: + _json = self._serialize.body(session_pool_envelope, "SessionPool") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + session_pool_name=self._config.session_pool_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + session_pool_envelope: _models.SessionPool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionPool]: + """Create or update a session pool. + + Create or update a session pool with the given properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + session_pool_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionPool]: + """Create or update a session pool. + + Create or update a session pool with the given properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, session_pool_envelope: Union[_models.SessionPool, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.SessionPool]: + """Create or update a session pool. + + Create or update a session pool with the given properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_envelope: Properties used to create a session pool. Is either a SessionPool + type or a IO[bytes] type. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPool or IO[bytes] + :return: An instance of LROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SessionPool] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + session_pool_envelope=session_pool_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SessionPool", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.SessionPool].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SessionPool]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + session_pool_envelope: Union[_models.SessionPoolUpdatableProperties, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_pool_envelope, (IOBase, bytes)): + _content = session_pool_envelope + else: + _json = self._serialize.body(session_pool_envelope, "SessionPoolUpdatableProperties") + + _request = build_update_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + session_pool_name=self._config.session_pool_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + session_pool_envelope: _models.SessionPoolUpdatableProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionPool]: + """Update properties of a session pool. + + Patches a session pool using JSON merge patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPoolUpdatableProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + session_pool_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionPool]: + """Update properties of a session pool. + + Patches a session pool using JSON merge patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + session_pool_envelope: Union[_models.SessionPoolUpdatableProperties, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.SessionPool]: + """Update properties of a session pool. + + Patches a session pool using JSON merge patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_envelope: Properties used to create a session pool. Is either a + SessionPoolUpdatableProperties type or a IO[bytes] type. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPoolUpdatableProperties or + IO[bytes] + :return: An instance of LROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SessionPool] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + session_pool_envelope=session_pool_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SessionPool", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.SessionPool].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SessionPool]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + session_pool_name=self._config.session_pool_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a session pool. + + Delete the session pool with the given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py index 5c56850d64f3..7da3b05880bd 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +51,7 @@ def build_list_by_container_app_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +84,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,12 +113,18 @@ def build_get_request( def build_create_or_update_request( - resource_group_name: str, container_app_name: str, source_control_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + container_app_name: str, + source_control_name: str, + subscription_id: str, + *, + x_ms_github_auxiliary: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -136,6 +148,7 @@ def build_create_or_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + _headers["x-ms-github-auxiliary"] = _SERIALIZER.header("x_ms_github_auxiliary", x_ms_github_auxiliary, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -144,12 +157,20 @@ def build_create_or_update_request( def build_delete_request( - resource_group_name: str, container_app_name: str, source_control_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + container_app_name: str, + source_control_name: str, + subscription_id: str, + *, + x_ms_github_auxiliary: str, + ignore_workflow_deletion_failure: Optional[bool] = None, + delete_workflow: Optional[bool] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -169,9 +190,16 @@ def build_delete_request( _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + if ignore_workflow_deletion_failure is not None: + _params["ignoreWorkflowDeletionFailure"] = _SERIALIZER.query( + "ignore_workflow_deletion_failure", ignore_workflow_deletion_failure, "bool" + ) + if delete_workflow is not None: + _params["deleteWorkflow"] = _SERIALIZER.query("delete_workflow", delete_workflow, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + _headers["x-ms-github-auxiliary"] = _SERIALIZER.header("x_ms_github_auxiliary", x_ms_github_auxiliary, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) @@ -219,7 +247,7 @@ def list_by_container_app( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControlCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -238,7 +266,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -254,7 +281,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -303,7 +329,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.SourceControl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -326,7 +352,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -341,7 +366,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -353,10 +378,11 @@ def _create_or_update_initial( resource_group_name: str, container_app_name: str, source_control_name: str, + x_ms_github_auxiliary: str, source_control_envelope: Union[_models.SourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SourceControl: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -369,7 +395,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -384,6 +410,7 @@ def _create_or_update_initial( container_app_name=container_app_name, source_control_name=source_control_name, subscription_id=self._config.subscription_id, + x_ms_github_auxiliary=x_ms_github_auxiliary, api_version=api_version, content_type=content_type, json=_json, @@ -391,10 +418,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -402,15 +429,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -423,6 +450,7 @@ def begin_create_or_update( resource_group_name: str, container_app_name: str, source_control_name: str, + x_ms_github_auxiliary: str, source_control_envelope: _models.SourceControl, *, content_type: str = "application/json", @@ -439,6 +467,8 @@ def begin_create_or_update( :type container_app_name: str :param source_control_name: Name of the Container App SourceControl. Required. :type source_control_name: str + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Required. + :type x_ms_github_auxiliary: str :param source_control_envelope: Properties used to create a Container App SourceControl. Required. :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl @@ -457,6 +487,7 @@ def begin_create_or_update( resource_group_name: str, container_app_name: str, source_control_name: str, + x_ms_github_auxiliary: str, source_control_envelope: IO[bytes], *, content_type: str = "application/json", @@ -473,6 +504,8 @@ def begin_create_or_update( :type container_app_name: str :param source_control_name: Name of the Container App SourceControl. Required. :type source_control_name: str + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Required. + :type x_ms_github_auxiliary: str :param source_control_envelope: Properties used to create a Container App SourceControl. Required. :type source_control_envelope: IO[bytes] @@ -491,6 +524,7 @@ def begin_create_or_update( resource_group_name: str, container_app_name: str, source_control_name: str, + x_ms_github_auxiliary: str, source_control_envelope: Union[_models.SourceControl, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.SourceControl]: @@ -505,6 +539,8 @@ def begin_create_or_update( :type container_app_name: str :param source_control_name: Name of the Container App SourceControl. Required. :type source_control_name: str + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Required. + :type x_ms_github_auxiliary: str :param source_control_envelope: Properties used to create a Container App SourceControl. Is either a SourceControl type or a IO[bytes] type. Required. :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl or IO[bytes] @@ -527,6 +563,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, + x_ms_github_auxiliary=x_ms_github_auxiliary, source_control_envelope=source_control_envelope, api_version=api_version, content_type=content_type, @@ -535,10 +572,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -560,10 +598,17 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial( + self, + resource_group_name: str, + container_app_name: str, + source_control_name: str, + x_ms_github_auxiliary: str, + ignore_workflow_deletion_failure: Optional[bool] = None, + delete_workflow: Optional[bool] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -575,21 +620,24 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, subscription_id=self._config.subscription_id, + x_ms_github_auxiliary=x_ms_github_auxiliary, + ignore_workflow_deletion_failure=ignore_workflow_deletion_failure, + delete_workflow=delete_workflow, api_version=api_version, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -597,16 +645,31 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( - self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any + self, + resource_group_name: str, + container_app_name: str, + source_control_name: str, + x_ms_github_auxiliary: str, + ignore_workflow_deletion_failure: Optional[bool] = None, + delete_workflow: Optional[bool] = None, + **kwargs: Any ) -> LROPoller[None]: """Delete a Container App SourceControl. @@ -619,6 +682,13 @@ def begin_delete( :type container_app_name: str :param source_control_name: Name of the Container App SourceControl. Required. :type source_control_name: str + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Required. + :type x_ms_github_auxiliary: str + :param ignore_workflow_deletion_failure: Ignore Workflow Deletion Failure. Default value is + None. + :type ignore_workflow_deletion_failure: bool + :param delete_workflow: Delete workflow. Default value is None. + :type delete_workflow: bool :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: @@ -632,16 +702,20 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, + x_ms_github_auxiliary=x_ms_github_auxiliary, + ignore_workflow_deletion_failure=ignore_workflow_deletion_failure, + delete_workflow=delete_workflow, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_component_resiliency_policies_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_component_resiliency_policies_operations.py index 8651964a9c97..83f2cd925539 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_component_resiliency_policies_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_component_resiliency_policies_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,19 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +81,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +116,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -150,7 +154,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -225,7 +229,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprComponentResiliencyPoliciesCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -245,7 +249,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -261,7 +264,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -312,7 +314,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -336,7 +338,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -351,7 +352,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -463,7 +464,7 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +500,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -514,11 +514,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -546,7 +542,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -570,7 +566,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py index 6185be9c9fbe..3897efe52869 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,19 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +114,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -147,7 +151,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -181,7 +185,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -249,7 +253,7 @@ def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprComponentsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -268,7 +272,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -284,7 +287,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -333,7 +335,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -356,7 +358,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -371,7 +372,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response) + deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -469,7 +470,7 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +505,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -519,7 +519,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response) + deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -545,7 +545,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -568,7 +568,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -605,7 +604,7 @@ def list_secrets( :rtype: ~azure.mgmt.appcontainers.models.DaprSecretsCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -628,7 +627,6 @@ def list_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -643,7 +641,7 @@ def list_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprSecretsCollection", pipeline_response) + deserialized = self._deserialize("DaprSecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_subscriptions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_subscriptions_operations.py index 8b2488ce964a..15e751fee6df 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_subscriptions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_subscriptions_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,19 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +114,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -147,7 +151,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -217,7 +221,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprSubscriptionsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -236,7 +240,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -252,7 +255,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -301,7 +303,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -324,7 +326,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -339,7 +340,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprSubscription", pipeline_response) + deserialized = self._deserialize("DaprSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -438,7 +439,7 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -473,7 +474,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -488,11 +488,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DaprSubscription", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DaprSubscription", pipeline_response) + deserialized = self._deserialize("DaprSubscription", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -518,7 +514,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -541,7 +537,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dot_net_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dot_net_components_operations.py index eb95db3a3c78..6f9d3aac7b67 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dot_net_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dot_net_components_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +51,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +84,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +118,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -149,7 +155,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -186,7 +192,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -256,7 +262,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DotNetComponentsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -275,7 +281,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -291,7 +296,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -338,7 +342,7 @@ def get(self, resource_group_name: str, environment_name: str, name: str, **kwar :rtype: ~azure.mgmt.appcontainers.models.DotNetComponent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -361,7 +365,6 @@ def get(self, resource_group_name: str, environment_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -376,7 +379,7 @@ def get(self, resource_group_name: str, environment_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DotNetComponent", pipeline_response) + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -390,8 +393,8 @@ def _create_or_update_initial( name: str, dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], **kwargs: Any - ) -> _models.DotNetComponent: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -404,7 +407,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -426,10 +429,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -437,15 +440,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DotNetComponent", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DotNetComponent", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -568,10 +571,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DotNetComponent", pipeline_response) + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -602,8 +606,8 @@ def _update_initial( name: str, dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], **kwargs: Any - ) -> Optional[_models.DotNetComponent]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -616,7 +620,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.DotNetComponent]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -638,10 +642,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -649,18 +653,20 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("DotNetComponent", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -782,10 +788,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DotNetComponent", pipeline_response) + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -807,10 +814,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -822,7 +829,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -833,10 +840,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -844,6 +851,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -852,8 +863,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -883,7 +898,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, environment_name=environment_name, name=name, @@ -893,6 +908,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_functions_extension_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_functions_extension_operations.py new file mode 100644 index 000000000000..013b3e1f001d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_functions_extension_operations.py @@ -0,0 +1,171 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_invoke_functions_host_request( + resource_group_name: str, + container_app_name: str, + revision_name: str, + function_app_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/providers/Microsoft.App/functions/{functionAppName}/invoke", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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", pattern=r"^[-\w\._\(\)]+$" + ), + "revisionName": _SERIALIZER.url("revision_name", revision_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "functionAppName": _SERIALIZER.url("function_app_name", function_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class FunctionsExtensionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`functions_extension` 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 invoke_functions_host( + self, + resource_group_name: str, + container_app_name: str, + revision_name: str, + function_app_name: str, + **kwargs: Any + ) -> str: + """Proxies a Functions host call to the function app backed by the container app. + + Proxies a Functions host call to the function app backed by the container app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param revision_name: Name of the Container App Revision, the parent resource. Required. + :type revision_name: str + :param function_app_name: Name of the Function App, the extension resource. Required. + :type function_app_name: str + :return: str or the result of cls(response) + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_invoke_functions_host_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + revision_name=revision_name, + function_app_name=function_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("str", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py index 46f755fed0e0..d5c4f2d01e7c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +51,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +84,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +118,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -149,7 +155,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -186,7 +192,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -254,7 +260,7 @@ def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JavaComponentsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -273,7 +279,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -289,7 +294,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -336,7 +340,7 @@ def get(self, resource_group_name: str, environment_name: str, name: str, **kwar :rtype: ~azure.mgmt.appcontainers.models.JavaComponent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -359,7 +363,6 @@ def get(self, resource_group_name: str, environment_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -374,7 +377,7 @@ def get(self, resource_group_name: str, environment_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("JavaComponent", pipeline_response) + deserialized = self._deserialize("JavaComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -388,8 +391,8 @@ def _create_or_update_initial( name: str, java_component_envelope: Union[_models.JavaComponent, IO[bytes]], **kwargs: Any - ) -> _models.JavaComponent: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -402,7 +405,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -424,10 +427,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -435,15 +438,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("JavaComponent", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("JavaComponent", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -566,10 +569,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("JavaComponent", pipeline_response) + deserialized = self._deserialize("JavaComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -600,8 +604,8 @@ def _update_initial( name: str, java_component_envelope: Union[_models.JavaComponent, IO[bytes]], **kwargs: Any - ) -> Optional[_models.JavaComponent]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -614,7 +618,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.JavaComponent]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -636,10 +640,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -647,18 +651,20 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("JavaComponent", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -780,10 +786,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("JavaComponent", pipeline_response) + deserialized = self._deserialize("JavaComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -805,10 +812,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -820,7 +827,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -831,10 +838,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -842,6 +849,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -850,8 +861,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -881,7 +896,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, environment_name=environment_name, name=name, @@ -891,6 +906,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_executions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_executions_operations.py index eee36884768a..e2fb24a6e9b1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_executions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_executions_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +46,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +119,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContainerAppJobExecutions] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -135,7 +139,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -151,7 +154,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_operations.py index 9ad72330b0e7..7effe00e149d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +51,7 @@ def build_list_detectors_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +84,7 @@ def build_get_detector_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +119,7 @@ def build_proxy_get_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_name: Literal["rootApi"] = kwargs.pop("api_name", "rootApi") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,7 +151,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -169,7 +175,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -199,7 +205,7 @@ def build_get_request(resource_group_name: str, job_name: str, subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -232,7 +238,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -266,7 +272,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -297,7 +303,7 @@ def build_update_request(resource_group_name: str, job_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -331,7 +337,7 @@ def build_start_request(resource_group_name: str, job_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -367,7 +373,7 @@ def build_stop_execution_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -403,7 +409,7 @@ def build_stop_multiple_executions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -436,7 +442,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -483,7 +489,7 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_detectors(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models.DiagnosticsCollection: + def list_detectors(self, resource_group_name: str, job_name: str, **kwargs: Any) -> Iterable["_models.Diagnostics"]: """Get the list of diagnostics for a given Container App Job. Get the list of diagnostics for a Container App Job. @@ -493,11 +499,17 @@ def list_detectors(self, resource_group_name: str, job_name: str, **kwargs: Any) :type resource_group_name: str :param job_name: Job Name. Required. :type job_name: str - :return: DiagnosticsCollection or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DiagnosticsCollection + :return: An iterator like instance of either Diagnostics or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.Diagnostics] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DiagnosticsCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -505,41 +517,60 @@ def list_detectors(self, resource_group_name: str, job_name: str, **kwargs: Any) } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DiagnosticsCollection] = kwargs.pop("cls", None) + _request = build_list_detectors_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_list_detectors_request( - resource_group_name=resource_group_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + 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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - response = pipeline_response.http_response + def get_next(next_link=None): + _request = prepare_request(next_link) - 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) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = self._deserialize("DiagnosticsCollection", pipeline_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) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) @distributed_trace def get_detector( @@ -560,7 +591,7 @@ def get_detector( :rtype: ~azure.mgmt.appcontainers.models.Diagnostics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -583,7 +614,6 @@ def get_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -598,7 +628,7 @@ def get_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Diagnostics", pipeline_response) + deserialized = self._deserialize("Diagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -620,7 +650,7 @@ def proxy_get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _ :rtype: ~azure.mgmt.appcontainers.models.Job :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -644,7 +674,6 @@ def proxy_get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -659,7 +688,7 @@ def proxy_get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Job", pipeline_response) + deserialized = self._deserialize("Job", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -682,7 +711,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Job"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -699,7 +728,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -715,7 +743,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -764,7 +791,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -782,7 +809,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -798,7 +824,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -843,7 +868,7 @@ def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models :rtype: ~azure.mgmt.appcontainers.models.Job :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -865,7 +890,6 @@ def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -880,7 +904,7 @@ def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Job", pipeline_response) + deserialized = self._deserialize("Job", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -889,8 +913,8 @@ def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models def _create_or_update_initial( self, resource_group_name: str, job_name: str, job_envelope: Union[_models.Job, IO[bytes]], **kwargs: Any - ) -> _models.Job: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -903,7 +927,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Job] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -924,10 +948,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -935,15 +959,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Job", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Job", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1049,10 +1073,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Job", pipeline_response) + deserialized = self._deserialize("Job", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1074,10 +1099,8 @@ def get_long_running_output(pipeline_response): ) return LROPoller[_models.Job](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, job_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, job_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1089,7 +1112,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -1099,10 +1122,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1110,6 +1133,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1118,8 +1145,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1145,7 +1176,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, job_name=job_name, api_version=api_version, @@ -1154,6 +1185,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1183,8 +1215,8 @@ def _update_initial( job_name: str, job_envelope: Union[_models.JobPatchProperties, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Job]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1197,7 +1229,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Job]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1218,10 +1250,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1229,18 +1261,20 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Job", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1349,10 +1383,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Job", pipeline_response) + deserialized = self._deserialize("Job", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1378,8 +1413,8 @@ def _start_initial( job_name: str, template: Optional[Union[_models.JobExecutionTemplate, IO[bytes]]] = None, **kwargs: Any - ) -> Optional[_models.JobExecutionBase]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1392,7 +1427,7 @@ def _start_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.JobExecutionBase]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1416,10 +1451,10 @@ def _start_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1427,18 +1462,20 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("JobExecutionBase", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1550,10 +1587,11 @@ def begin_start( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("JobExecutionBase", pipeline_response) + deserialized = self._deserialize("JobExecutionBase", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1577,10 +1615,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _stop_execution_initial( # pylint: disable=inconsistent-return-statements + def _stop_execution_initial( self, resource_group_name: str, job_name: str, job_execution_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1592,7 +1630,7 @@ def _stop_execution_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_execution_request( resource_group_name=resource_group_name, @@ -1603,10 +1641,10 @@ def _stop_execution_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1614,6 +1652,10 @@ def _stop_execution_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1622,8 +1664,12 @@ def _stop_execution_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_stop_execution( @@ -1653,7 +1699,7 @@ def begin_stop_execution( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._stop_execution_initial( # type: ignore + raw_result = self._stop_execution_initial( resource_group_name=resource_group_name, job_name=job_name, job_execution_name=job_execution_name, @@ -1663,6 +1709,7 @@ def begin_stop_execution( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1688,8 +1735,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _stop_multiple_executions_initial( self, resource_group_name: str, job_name: str, **kwargs: Any - ) -> Optional[_models.ContainerAppJobExecutions]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1701,7 +1748,7 @@ def _stop_multiple_executions_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.ContainerAppJobExecutions]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_multiple_executions_request( resource_group_name=resource_group_name, @@ -1711,10 +1758,10 @@ def _stop_multiple_executions_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1722,18 +1769,20 @@ def _stop_multiple_executions_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ContainerAppJobExecutions", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1776,10 +1825,11 @@ def begin_stop_multiple_executions( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerAppJobExecutions", pipeline_response) + deserialized = self._deserialize("ContainerAppJobExecutions", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1818,7 +1868,7 @@ def list_secrets(self, resource_group_name: str, job_name: str, **kwargs: Any) - :rtype: ~azure.mgmt.appcontainers.models.JobSecretsCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1840,7 +1890,6 @@ def list_secrets(self, resource_group_name: str, job_name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1855,7 +1904,7 @@ def list_secrets(self, resource_group_name: str, job_name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("JobSecretsCollection", pipeline_response) + deserialized = self._deserialize("JobSecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_logic_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_logic_apps_operations.py new file mode 100644 index 000000000000..5817d7098478 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_logic_apps_operations.py @@ -0,0 +1,1075 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # 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, **kwargs) + + +def build_delete_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_workflows_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/workflows", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_workflow_request( + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/workflows/{workflowName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "workflowName": _SERIALIZER.url( + "workflow_name", workflow_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deploy_workflow_artifacts_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/deployWorkflowArtifacts", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # 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, **kwargs) + + +def build_list_workflows_connections_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/listWorkflowsConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_invoke_request( + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + subscription_id: str, + *, + x_ms_logic_apps_proxy_path: str, + x_ms_logic_apps_proxy_method: Union[str, _models.LogicAppsProxyMethod], + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/invoke", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["x-ms-logicApps-proxy-path"] = _SERIALIZER.header( + "x_ms_logic_apps_proxy_path", x_ms_logic_apps_proxy_path, "str" + ) + _headers["x-ms-logicApps-proxy-method"] = _SERIALIZER.header( + "x_ms_logic_apps_proxy_method", x_ms_logic_apps_proxy_method, "str" + ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class LogicAppsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`logic_apps` 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( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> _models.LogicApp: + """Gets a logic app extension resource. + + Gets a logic app extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LogicApp] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LogicApp", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: _models.LogicApp, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Required. + :type resource: ~azure.mgmt.appcontainers.models.LogicApp + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: Union[_models.LogicApp, IO[bytes]], + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Is either a LogicApp type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.appcontainers.models.LogicApp or IO[bytes] + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LogicApp] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "LogicApp") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LogicApp", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> None: + """Deletes a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 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, {}) # type: ignore + + @distributed_trace + def list_workflows( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> Iterable["_models.WorkflowEnvelope"]: + """List the workflows for a logic app. + + List the workflows for a logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: An iterator like instance of either WorkflowEnvelope or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.WorkflowEnvelope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelopeCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_workflows_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WorkflowEnvelopeCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_workflow( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, workflow_name: str, **kwargs: Any + ) -> _models.WorkflowEnvelope: + """Get workflow information by its name. + + Get workflow information by its name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_name: Workflow name. Required. + :type workflow_name: str + :return: WorkflowEnvelope or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.WorkflowEnvelope + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelope] = kwargs.pop("cls", None) + + _request = build_get_workflow_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + workflow_name=workflow_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[_models.WorkflowArtifacts] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Default value is + None. + :type workflow_artifacts: ~azure.mgmt.appcontainers.models.WorkflowArtifacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Default value is + None. + :type workflow_artifacts: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[Union[_models.WorkflowArtifacts, IO[bytes]]] = None, + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Is either a + WorkflowArtifacts type or a IO[bytes] type. Default value is None. + :type workflow_artifacts: ~azure.mgmt.appcontainers.models.WorkflowArtifacts or IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workflow_artifacts, (IOBase, bytes)): + _content = workflow_artifacts + else: + if workflow_artifacts is not None: + _json = self._serialize.body(workflow_artifacts, "WorkflowArtifacts") + else: + _json = None + + _request = build_deploy_workflow_artifacts_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + 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) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_workflows_connections( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> _models.WorkflowEnvelope: + """Gets logic app's connections. + + Gets logic app's connections. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: WorkflowEnvelope or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.WorkflowEnvelope + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelope] = kwargs.pop("cls", None) + + _request = build_list_workflows_connections_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def invoke( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + x_ms_logic_apps_proxy_path: str, + x_ms_logic_apps_proxy_method: Union[str, _models.LogicAppsProxyMethod], + **kwargs: Any + ) -> JSON: + """Proxies a the API call to the logic app backed by the container app. + + Proxies a the API call to the logic app backed by the container app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the LogicApp App, the extension resource. Required. + :type logic_app_name: str + :param x_ms_logic_apps_proxy_path: The proxy path for the API call. Required. + :type x_ms_logic_apps_proxy_path: str + :param x_ms_logic_apps_proxy_method: The proxy method for the API call. Known values are: "GET" + and "POST". Required. + :type x_ms_logic_apps_proxy_method: str or + ~azure.mgmt.appcontainers.models.LogicAppsProxyMethod + :return: JSON or the result of cls(response) + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_invoke_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + x_ms_logic_apps_proxy_path=x_ms_logic_apps_proxy_path, + x_ms_logic_apps_proxy_method=x_ms_logic_apps_proxy_method, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("object", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_certificates_operations.py index 1d0a9bdec49f..9863aaf8c2d7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_certificates_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +51,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +85,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -116,7 +122,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +156,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -187,7 +193,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -252,7 +258,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.ManagedCertificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -275,7 +281,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -290,7 +295,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedCertificate", pipeline_response) + deserialized = self._deserialize("ManagedCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -304,13 +309,16 @@ def _create_or_update_initial( managed_certificate_name: str, managed_certificate_envelope: Optional[Union[_models.ManagedCertificate, IO[bytes]]] = None, **kwargs: Any - ) -> _models.ManagedCertificate: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 400: lambda response: HttpResponseError(response=response, error_format=ARMErrorFormat), + 400: cast( + Type[HttpResponseError], + lambda response: HttpResponseError(response=response, error_format=ARMErrorFormat), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -319,7 +327,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ManagedCertificate] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -344,10 +352,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -355,15 +363,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ManagedCertificate", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ManagedCertificate", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -489,10 +497,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ManagedCertificate", pipeline_response) + deserialized = self._deserialize("ManagedCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -535,7 +544,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -558,7 +567,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -670,7 +678,7 @@ def update( :rtype: ~azure.mgmt.appcontainers.models.ManagedCertificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -705,7 +713,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -720,7 +727,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedCertificate", pipeline_response) + deserialized = self._deserialize("ManagedCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -750,7 +757,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedCertificateCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -769,7 +776,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -785,7 +791,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_diagnostics_operations.py index 36671189de6e..828f7a953f3b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_diagnostics_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +44,7 @@ def build_list_detectors_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +77,7 @@ def build_get_detector_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -137,7 +141,7 @@ def list_detectors( :rtype: ~azure.mgmt.appcontainers.models.DiagnosticsCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -159,7 +163,6 @@ def list_detectors( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -174,7 +177,7 @@ def list_detectors( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticsCollection", pipeline_response) + deserialized = self._deserialize("DiagnosticsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -200,7 +203,7 @@ def get_detector( :rtype: ~azure.mgmt.appcontainers.models.Diagnostics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -223,7 +226,6 @@ def get_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -238,7 +240,7 @@ def get_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Diagnostics", pipeline_response) + deserialized = self._deserialize("Diagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_endpoint_connections_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..5ce5ecc45308 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_endpoint_connections_operations.py @@ -0,0 +1,711 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateEndpointConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ManagedEnvironmentPrivateEndpointConnectionsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`managed_environment_private_endpoint_connections` 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, environment_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnection"]: + """List private endpoint connections for a given managed environment. + + List private endpoint connections for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Get a private endpoint connection for a given managed environment. + + Get a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(private_endpoint_connection_envelope, (IOBase, bytes)): + _content = private_endpoint_connection_envelope + else: + _json = self._serialize.body(private_endpoint_connection_envelope, "PrivateEndpointConnection") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Required. + :type private_endpoint_connection_envelope: + ~azure.mgmt.appcontainers.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Required. + :type private_endpoint_connection_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. + :type private_endpoint_connection_envelope: + ~azure.mgmt.appcontainers.models.PrivateEndpointConnection or IO[bytes] + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection_envelope=private_endpoint_connection_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a private endpoint connection for a given managed environment. + + Delete a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_link_resources_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_link_resources_operations.py new file mode 100644 index 000000000000..2ea55c35cc74 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_link_resources_operations.py @@ -0,0 +1,179 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateLinkResources", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ManagedEnvironmentPrivateLinkResourcesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`managed_environment_private_link_resources` 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, environment_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateLinkResource"]: + """List private link resources for a given managed environment. + + List private link resources for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py index 82dec27ebb0a..d8a432fc0419 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +46,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +111,7 @@ def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -126,7 +130,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -142,7 +145,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_diagnostics_operations.py index 077dcd413feb..c2090a76cbe6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_diagnostics_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +44,7 @@ def build_get_root_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +105,7 @@ def get_root(self, resource_group_name: str, environment_name: str, **kwargs: An :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,7 +127,6 @@ def get_root(self, resource_group_name: str, environment_name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -138,7 +141,7 @@ def get_root(self, resource_group_name: str, environment_name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = self._deserialize("ManagedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py index 4d29d04b1a48..574f14c32e45 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +49,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +73,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +105,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +138,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -168,7 +174,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -201,7 +207,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -237,7 +243,7 @@ def build_get_auth_token_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +276,7 @@ def build_list_workload_profile_states_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -332,7 +338,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ManagedEnviro api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedEnvironmentsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -349,7 +355,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -365,7 +370,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -414,7 +418,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedEnvironmentsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -432,7 +436,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -448,7 +451,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -493,7 +495,7 @@ def get(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -515,7 +517,6 @@ def get(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -530,7 +531,7 @@ def get(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = self._deserialize("ManagedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -543,8 +544,8 @@ def _create_or_update_initial( environment_name: str, environment_envelope: Union[_models.ManagedEnvironment, IO[bytes]], **kwargs: Any - ) -> _models.ManagedEnvironment: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -557,7 +558,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ManagedEnvironment] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -578,10 +579,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -589,15 +590,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -710,10 +711,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = self._deserialize("ManagedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -735,10 +737,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, environment_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -750,7 +750,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -760,10 +760,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -771,12 +771,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> LROPoller[None]: @@ -802,7 +810,7 @@ def begin_delete(self, resource_group_name: str, environment_name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, environment_name=environment_name, api_version=api_version, @@ -811,6 +819,7 @@ def begin_delete(self, resource_group_name: str, environment_name: str, **kwargs params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -838,8 +847,8 @@ def _update_initial( environment_name: str, environment_envelope: Union[_models.ManagedEnvironment, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ManagedEnvironment]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -852,7 +861,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ManagedEnvironment]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -873,10 +882,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -884,13 +893,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1003,10 +1014,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = self._deserialize("ManagedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1045,7 +1057,7 @@ def get_auth_token( :rtype: ~azure.mgmt.appcontainers.models.EnvironmentAuthToken :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1067,7 +1079,6 @@ def get_auth_token( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1082,7 +1093,7 @@ def get_auth_token( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EnvironmentAuthToken", pipeline_response) + deserialized = self._deserialize("EnvironmentAuthToken", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1113,7 +1124,7 @@ def list_workload_profile_states( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkloadProfileStatesCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1132,7 +1143,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1148,7 +1158,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py index efdd9a9c7d60..51ab48c82744 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +112,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -145,7 +149,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -209,7 +213,7 @@ def list( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStoragesCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,7 +235,6 @@ def list( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -246,7 +249,7 @@ def list( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedEnvironmentStoragesCollection", pipeline_response) + deserialized = self._deserialize("ManagedEnvironmentStoragesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -272,7 +275,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -295,7 +298,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -310,7 +312,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedEnvironmentStorage", pipeline_response) + deserialized = self._deserialize("ManagedEnvironmentStorage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -408,7 +410,7 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -443,7 +445,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -458,7 +459,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedEnvironmentStorage", pipeline_response) + deserialized = self._deserialize("ManagedEnvironmentStorage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -484,7 +485,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -507,7 +508,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py index 56f460ad18ba..80db6c4bd360 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +45,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -174,7 +178,7 @@ def check_name_availability( :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +212,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -223,7 +226,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py index 1a05294e4428..2217fc784f89 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +44,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +92,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -104,7 +108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -120,7 +123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py index 03bc72d24244..2791e30824c1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) 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.rest import HttpRequest, HttpResponse 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 .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +44,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +103,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.Usage"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -117,7 +121,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -133,7 +136,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_create_or_update.py index e98b4e1f846b..2064208d1654 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_create_or_update.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -58,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AppResiliency_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AppResiliency_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_delete.py index fab04833c272..4de520f79c66 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_delete.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AppResiliency_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AppResiliency_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_get.py index 26b4f027f9c5..e2be25bcbd58 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AppResiliency_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AppResiliency_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_list.py index 2ff4b5bb7403..3fe0f6bac2a0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_list.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AppResiliency_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AppResiliency_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.py index e351bd2e4a3d..4a97502dc4e4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -43,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AppResiliency_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AppResiliency_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_create_or_update.py index bbc6ec8fc9b3..3dcbad859b40 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_create_or_update.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="651f8027-33e8-4ec4-97b4-f6e9f3dc8744", ) @@ -53,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AuthConfigs_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AuthConfigs_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_delete.py index 6c96c3fdc91d..e2d5be9cf5a7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_delete.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="651f8027-33e8-4ec4-97b4-f6e9f3dc8744", ) @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AuthConfigs_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AuthConfigs_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_get.py index 1095283b90d4..3cf5ff3c9a09 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="651f8027-33e8-4ec4-97b4-f6e9f3dc8744", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AuthConfigs_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AuthConfigs_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_list_by_container.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_list_by_container.py index 8edbbff4ffae..461f3c2a4177 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_list_by_container.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_list_by_container.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="651f8027-33e8-4ec4-97b4-f6e9f3dc8744", ) @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AuthConfigs_ListByContainer.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AuthConfigs_ListByContainer.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/available_workload_profiles_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/available_workload_profiles_get.py index 865e1cbbd4fb..ad7d2f562e4c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/available_workload_profiles_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/available_workload_profiles_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AvailableWorkloadProfiles_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AvailableWorkloadProfiles_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/billing_meters_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/billing_meters_get.py index dff89c99c439..53b4161abe51 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/billing_meters_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/billing_meters_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/BillingMeters_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/BillingMeters_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py index 0f6707c6de5b..6b58ede4ab86 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="00000000-0000-0000-0000-000000000000", ) @@ -62,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builders_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builders_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_delete.py index f014b49a4339..36f04bcdcec9 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_delete.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="00000000-0000-0000-0000-000000000000", ) @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builders_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builders_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_get.py index e48ce3a5ca80..3ffcb399f7ce 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="00000000-0000-0000-0000-000000000000", ) @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builders_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builders_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.py index 812800c9de41..9159f0592ed4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="00000000-0000-0000-0000-000000000000", ) @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builders_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builders_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.py index 67032bc436ba..8fa701374622 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="00000000-0000-0000-0000-000000000000", ) @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builders_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builders_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.py index f5e123b1badb..0b90d24212ad 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="00000000-0000-0000-0000-000000000000", ) @@ -40,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builders_Update.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builders_Update.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py index 4fde89dd07ac..52aa2526cfb8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="00000000-0000-0000-0000-000000000000", ) @@ -67,6 +68,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builds_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builds_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_delete.py index 0cd6d19d5c57..ce7802ad6a63 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_delete.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="00000000-0000-0000-0000-000000000000", ) @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builds_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builds_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_get.py index 7c6dda4f0e38..1dc194087766 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="00000000-0000-0000-0000-000000000000", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builds_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builds_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.py index 0adf09f0fcc0..8f34598bfd6b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="00000000-0000-0000-0000-000000000000", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builds_ListAuthToken.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builds_ListAuthToken.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py index 804827d40261..4b2971fda3e2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="00000000-0000-0000-0000-000000000000", ) @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builds_ListByBuilderResource.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builds_ListByBuilderResource.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update.py index 675eb5b8c480..418618484945 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificate_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.py index 68eda9fa1946..c2b2d921de82 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificate_CreateOrUpdate_FromKeyVault.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificate_CreateOrUpdate_FromKeyVault.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py index 2989b2951a35..f6e8b74ae406 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificate_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py index 49eeaff2ccb1..dc8ec9c81d2d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificate_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_check_name_availability.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_check_name_availability.py index 92c3839cc465..735de3c4b300 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_check_name_availability.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_check_name_availability.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -43,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificates_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificates_CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_list_by_managed_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_list_by_managed_environment.py index ec5a8b88a5e7..20451151af9f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_list_by_managed_environment.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_list_by_managed_environment.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificates_ListByManagedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificates_ListByManagedEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py index 4006011a62c5..8116c84f3d2a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -41,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificates_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_create_or_update.py index 24c5e8187dd4..bfa911ab9afe 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_create_or_update.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsCertificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsCertificate_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_delete.py index eafde70f5640..de906608629e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_delete.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsCertificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsCertificate_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_get.py index f54e0c564dae..caae1ab97edd 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsCertificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsCertificate_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_check_name_availability.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_check_name_availability.py index e7f072087734..7abd8736c912 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_check_name_availability.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_check_name_availability.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -43,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsCertificates_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsCertificates_CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_list_by_connected_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_list_by_connected_environment.py index 06e06685241e..e7a65841835d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_list_by_connected_environment.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_list_by_connected_environment.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsCertificates_ListByConnectedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsCertificates_ListByConnectedEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_patch.py index 49e23990fabf..f52f94d3bd9d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_patch.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -41,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsCertificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsCertificates_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_create_or_update.py index 6e8f8e7c6140..8e4ad46920d5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_create_or_update.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -51,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironments_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironments_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_create_or_update.py index 30dc14394373..8a475e538516 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_create_or_update.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -63,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsDaprComponents_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsDaprComponents_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_delete.py index 14fe8bfd6a9f..eb4fdee4772c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_delete.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsDaprComponents_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsDaprComponents_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_get.py index 4fbf110564f2..a103e0d734fe 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsDaprComponents_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsDaprComponents_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list.py index f43c438ddde6..d73041280790 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsDaprComponents_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsDaprComponents_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list_secrets.py index 5c81a547ae0c..3f81933f3e3e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list_secrets.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_delete.py index 7bca2f8f07cd..e8cffe3a9d3b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_delete.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironments_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironments_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_get.py index 5d8f8bd24481..e65ed460d343 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironments_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironments_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_resource_group.py index 52df79f1d713..ad146c98619a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_resource_group.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironments_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironments_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_subscription.py index 211eaa06ed11..ffb1a7c9fd1c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_subscription.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironments_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironments_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_patch.py index 860f287b5d10..ef88e2aa2a98 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_patch.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironments_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironments_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_create_or_update.py index adf5251229f1..be6eeccd0839 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_create_or_update.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -50,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsStorages_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsStorages_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_delete.py index d4ba700860ea..30a40af9f084 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_delete.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsStorages_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsStorages_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_get.py index 2b2bf696fe9a..c363aa1faae0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsStorages_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsStorages_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_list.py index cec40e7e7126..4fdca29d9376 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_list.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsStorages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsStorages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_delete.py new file mode 100644 index 000000000000..a6816f1cdd0a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_delete.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_builds_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.container_apps_builds.begin_delete( + resource_group_name="rg", + container_app_name="testCapp", + build_name="testBuild", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsBuilds_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_get.py new file mode 100644 index 000000000000..5e3507103974 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_get.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_builds_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_builds.get( + resource_group_name="rg", + container_app_name="testCapp", + build_name="testBuild", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsBuilds_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_list_by_container_app.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_list_by_container_app.py new file mode 100644 index 000000000000..f88df1f1df57 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_list_by_container_app.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_builds_list_by_container_app.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_builds_by_container_app.list( + resource_group_name="rg", + container_app_name="testCapp", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsBuilds_ListByContainerApp.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py index ce1cd05f4de8..d44fa6882d4f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -40,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update.py index 9f0444130090..74445f3015b4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -36,6 +37,12 @@ def main(): resource_group_name="rg", container_app_name="testcontainerApp0", container_app_envelope={ + "identity": { + "type": "SystemAssigned,UserAssigned", + "userAssignedIdentities": { + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity": {} + }, + }, "location": "East US", "properties": { "configuration": { @@ -48,6 +55,13 @@ def main(): "httpReadBufferSize": 30, "logLevel": "debug", }, + "identitySettings": [ + { + "identity": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity", + "lifecycle": "All", + }, + {"identity": "system", "lifecycle": "Init"}, + ], "ingress": { "additionalPortMappings": [ {"external": True, "targetPort": 1234}, @@ -94,6 +108,18 @@ def main(): "traffic": [{"label": "production", "revisionName": "testcontainerApp0-ab1234", "weight": 100}], }, "maxInactiveRevisions": 10, + "runtime": { + "dotnet": {"autoConfigureDataProtection": True}, + "java": { + "enableMetrics": True, + "javaAgent": { + "enabled": True, + "logging": { + "loggerSettings": [{"level": "debug", "logger": "org.springframework.boot"}] + }, + }, + }, + }, "service": {"type": "redis"}, }, "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", @@ -136,7 +162,28 @@ def main(): { "custom": {"metadata": {"concurrentRequests": "50"}, "type": "http"}, "name": "httpscalingrule", - } + }, + { + "custom": { + "identity": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity", + "metadata": { + "messageCount": "5", + "namespace": "mynamespace", + "queueName": "myqueue", + }, + "type": "azure-servicebus", + }, + "name": "servicebus", + }, + { + "azureQueue": { + "accountName": "account1", + "identity": "system", + "queueLength": 1, + "queueName": "queue1", + }, + "name": "azure-queue", + }, ], }, "serviceBinds": [ @@ -159,6 +206,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py index 02be9846c6a6..04f9735557d0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -98,6 +99,18 @@ def main(): "traffic": [{"label": "production", "revisionName": "testcontainerApp0-ab1234", "weight": 100}], }, "maxInactiveRevisions": 10, + "runtime": { + "dotnet": {"autoConfigureDataProtection": True}, + "java": { + "enableMetrics": True, + "javaAgent": { + "enabled": True, + "logging": { + "loggerSettings": [{"level": "debug", "logger": "org.springframework.boot"}] + }, + }, + }, + }, }, "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/connectedEnvironments/demokube", "template": { @@ -145,6 +158,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_CreateOrUpdate_ConnectedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_CreateOrUpdate_ConnectedEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_delete.py index d4b0b91bd67d..5c4c2833470c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_delete.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_get.py index 0621e4623d72..8007ca276742 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="f07f3711-b45e-40fe-a941-4e6d93f851e6", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerAppsDiagnostics_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsDiagnostics_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_list.py index 948e502bc334..89dd1f28b61b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_list.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="f07f3711-b45e-40fe-a941-4e6d93f851e6", ) @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerAppsDiagnostics_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsDiagnostics_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get.py index a8f09b0d5a5b..083822e6334b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get.py @@ -27,16 +27,17 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.container_apps.get( + response = client.container_apps_diagnostics.get_root( resource_group_name="rg", container_app_name="testcontainerApp0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get_auth_token.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get_auth_token.py index 97280c262a21..d710efc51af0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get_auth_token.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get_auth_token.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="651f8027-33e8-4ec4-97b4-f6e9f3dc8744", ) @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_GetAuthToken.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_GetAuthToken.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_kind_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_kind_create_or_update.py new file mode 100644 index 000000000000..7e753082d4a9 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_kind_create_or_update.py @@ -0,0 +1,67 @@ +# 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, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_kind_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps.begin_create_or_update( + resource_group_name="rg", + container_app_name="testcontainerAppKind", + container_app_envelope={ + "kind": "workflowapp", + "location": "East Us", + "managedBy": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.Web/sites/testcontainerAppKind", + "properties": { + "configuration": { + "activeRevisionsMode": "Single", + "ingress": {"allowInsecure": True, "external": True, "targetPort": 80}, + }, + "managedEnvironmentId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/testmanagedenv3", + "template": { + "containers": [ + { + "image": "default/logicapps-base:latest", + "name": "logicapps-container", + "resources": {"cpu": 1, "memory": "2.0Gi"}, + } + ], + "scale": {"maxReplicas": 30, "minReplicas": 1}, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_Kind_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py index 3ddd12b249a7..61f5d72d971d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_subscription.py index 762384b44e69..906d64211834 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_subscription.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_custom_host_name_analysis.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_custom_host_name_analysis.py index e39c06791164..3e5e0c867cc5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_custom_host_name_analysis.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_custom_host_name_analysis.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_ListCustomHostNameAnalysis.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_ListCustomHostNameAnalysis.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_secrets.py index eb5fab29e6b8..f0632aebf76f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_secrets.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_managed_by_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_managed_by_create_or_update.py index 5c90c8d56eac..0d6df1880a5b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_managed_by_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_managed_by_create_or_update.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -76,6 +77,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_ManagedBy_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_ManagedBy_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patch.py index e0ebd96a01a5..9bf7e8f96dce 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patch.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -81,6 +82,18 @@ def main(): "traffic": [{"label": "production", "revisionName": "testcontainerApp0-ab1234", "weight": 100}], }, "maxInactiveRevisions": 10, + "runtime": { + "dotnet": {"autoConfigureDataProtection": True}, + "java": { + "enableMetrics": True, + "javaAgent": { + "enabled": True, + "logging": { + "loggerSettings": [{"level": "debug", "logger": "org.springframework.boot"}] + }, + }, + }, + }, "service": {"type": "redis"}, }, "template": { @@ -135,6 +148,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_apply.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_apply.py new file mode 100644 index 000000000000..fd31835f923a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_apply.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_patches_apply.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_patches.begin_apply( + resource_group_name="rg", + container_app_name="test-app", + patch_name="testPatch-25fe4b", + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsPatches_Apply.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_delete.py new file mode 100644 index 000000000000..e30a1be02bdc --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_delete.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_patches_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.container_apps_patches.begin_delete( + resource_group_name="rg", + container_app_name="test-app", + patch_name="testPatch-25fe4b", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsPatches_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_get.py new file mode 100644 index 000000000000..c86c0ba4b6bf --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_get.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_patches_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_patches.get( + resource_group_name="rg", + container_app_name="test-app", + patch_name="testPatch-25fe4b", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsPatches_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_list_by_container_app.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_list_by_container_app.py new file mode 100644 index 000000000000..24847c3940b0 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_list_by_container_app.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_patches_list_by_container_app.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_patches.list_by_container_app( + resource_group_name="rg", + container_app_name="test-app", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsPatches_ListByContainerApp.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_skip_configure.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_skip_configure.py new file mode 100644 index 000000000000..fc59f9799677 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_skip_configure.py @@ -0,0 +1,46 @@ +# 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, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_patches_skip_configure.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.container_apps_patches.begin_skip_configure( + resource_group_name="rg", + container_app_name="test-app", + patch_name="testPatch-25fe4b", + patch_skip_config={"skip": True}, + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsPatches_Skip_Configure.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_source_to_cloud_app_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_source_to_cloud_app_create_or_update.py new file mode 100644 index 000000000000..168fe4c31da8 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_source_to_cloud_app_create_or_update.py @@ -0,0 +1,167 @@ +# 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, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_source_to_cloud_app_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.container_apps.begin_create_or_update( + resource_group_name="rg", + container_app_name="testcontainerApp0", + container_app_envelope={ + "location": "East US", + "properties": { + "configuration": { + "dapr": { + "appPort": 3000, + "appProtocol": "http", + "enableApiLogging": True, + "enabled": True, + "httpMaxRequestSize": 10, + "httpReadBufferSize": 30, + "logLevel": "debug", + }, + "ingress": { + "additionalPortMappings": [ + {"external": True, "targetPort": 1234}, + {"exposedPort": 3456, "external": False, "targetPort": 2345}, + ], + "clientCertificateMode": "accept", + "corsPolicy": { + "allowCredentials": True, + "allowedHeaders": ["HEADER1", "HEADER2"], + "allowedMethods": ["GET", "POST"], + "allowedOrigins": ["https://a.test.com", "https://b.test.com"], + "exposeHeaders": ["HEADER3", "HEADER4"], + "maxAge": 1234, + }, + "customDomains": [ + { + "bindingType": "SniEnabled", + "certificateId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-name-dot-com", + "name": "www.my-name.com", + }, + { + "bindingType": "SniEnabled", + "certificateId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com", + "name": "www.my-other-name.com", + }, + ], + "external": True, + "ipSecurityRestrictions": [ + { + "action": "Allow", + "description": "Allowing all IP's within the subnet below to access containerapp", + "ipAddressRange": "192.168.1.1/32", + "name": "Allow work IP A subnet", + }, + { + "action": "Allow", + "description": "Allowing all IP's within the subnet below to access containerapp", + "ipAddressRange": "192.168.1.1/8", + "name": "Allow work IP B subnet", + }, + ], + "stickySessions": {"affinity": "sticky"}, + "targetPort": 3000, + "traffic": [{"label": "production", "revisionName": "testcontainerApp0-ab1234", "weight": 100}], + }, + "maxInactiveRevisions": 10, + "service": {"type": "redis"}, + }, + "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", + "patchingConfiguration": {"patchingMode": "Automatic"}, + "template": { + "containers": [ + { + "image": "", + "imageType": "CloudBuild", + "name": "testcontainerApp0", + "probes": [ + { + "httpGet": { + "httpHeaders": [{"name": "Custom-Header", "value": "Awesome"}], + "path": "/health", + "port": 8080, + }, + "initialDelaySeconds": 3, + "periodSeconds": 3, + "type": "Liveness", + } + ], + "volumeMounts": [ + {"mountPath": "/mnt/path1", "subPath": "subPath1", "volumeName": "azurefile"}, + {"mountPath": "/mnt/path2", "subPath": "subPath2", "volumeName": "nfsazurefile"}, + ], + } + ], + "initContainers": [ + { + "args": ["-c", "while true; do echo hello; sleep 10;done"], + "command": ["/bin/sh"], + "image": "repo/testcontainerApp0:v4", + "name": "testinitcontainerApp0", + "resources": {"cpu": 0.2, "memory": "100Mi"}, + } + ], + "scale": { + "maxReplicas": 5, + "minReplicas": 1, + "rules": [ + { + "custom": {"metadata": {"concurrentRequests": "50"}, "type": "http"}, + "name": "httpscalingrule", + } + ], + }, + "serviceBinds": [ + { + "clientType": "dotnet", + "customizedKeys": {"DesiredKey": "defaultKey"}, + "name": "redisService", + "serviceId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/redisService", + } + ], + "volumes": [ + {"name": "azurefile", "storageName": "storage", "storageType": "AzureFile"}, + {"name": "nfsazurefile", "storageName": "nfsStorage", "storageType": "NfsAzureFile"}, + ], + }, + "workloadProfileName": "My-GP-01", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_SourceToCloudApp_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py index 9125f2d8182a..702e64d6be30 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_Start.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_Start.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py index 0fc89828ced7..2b15d490c487 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_Stop.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_Stop.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_tcp_app_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_tcp_app_create_or_update.py index bd84fa656785..d42073cbc556 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_tcp_app_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_tcp_app_create_or_update.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -75,6 +76,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_TcpApp_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_TcpApp_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.py index eb3c02bb76d0..4d8d7b45d44f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponentResiliencyPolicies_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponentResiliencyPolicies_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.py index d3a007f91680..5db2e291b6e8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponentResiliencyPolicies_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponentResiliencyPolicies_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.py index 1fc552c48b8b..0e9192177007 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -39,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponentResiliencyPolicies_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponentResiliencyPolicies_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.py index 399c7ed65abf..6a19dd0c353e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -61,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_AllOptions.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_AllOptions.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.py index f3b4323bad94..56612a3ad803 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -53,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_OutboundOnly.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_OutboundOnly.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.py index 692e76e00cf4..754a63967afa 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -53,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_SparseOptions.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_SparseOptions.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secret_store_component.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secret_store_component.py index 98d1b2f380e4..adf6a04d3548 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secret_store_component.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secret_store_component.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -63,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_CreateOrUpdate_SecretStoreComponent.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponents_CreateOrUpdate_SecretStoreComponent.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secrets.py index adff70eea4af..cc321440db80 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secrets.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -63,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_CreateOrUpdate_Secrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponents_CreateOrUpdate_Secrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_delete.py index edfbdb28f867..aab3b55977d5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_delete.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponents_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secret_store_component.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secret_store_component.py index ec4b1a935bb7..125324a8f8df 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secret_store_component.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secret_store_component.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_Get_SecretStoreComponent.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponents_Get_SecretStoreComponent.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secrets.py index e797ea7a4c3b..5aa7dd7676ac 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secrets.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_Get_Secrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponents_Get_Secrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list.py index 742c780dd094..fc6deb59700d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponents_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list_secrets.py index 6071afa6717d..6392b2426081 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list_secrets.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponents_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py index c78a49eb395b..c24ccc763624 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -49,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_CreateOrUpdate_BulkSubscribeAndScopes.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_CreateOrUpdate_BulkSubscribeAndScopes.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.py index 4756e5f0cf94..dda12d5223d9 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -43,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_CreateOrUpdate_DefaultRoute.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_CreateOrUpdate_DefaultRoute.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py index 1005320a7c2a..8a31aa5e293c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -54,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_CreateOrUpdate_RouteRulesAndMetadata.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_CreateOrUpdate_RouteRulesAndMetadata.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_delete.py index ba81e2ee5418..968cabf4f3c6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_delete.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.py index 65b1aaafe2ec..8c293bf03ef2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_Get_BulkSubscribeAndScopes.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_Get_BulkSubscribeAndScopes.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.py index 505a1dc57b79..73a6aef996ca 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_Get_DefaultRoute.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_Get_DefaultRoute.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.py index 1b75ba87e155..1dbee4a11d65 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_Get_RouteRulesAndMetadata.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_Get_RouteRulesAndMetadata.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_list.py index 53d9fdff5473..0fdb009c7061 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_list.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update.py index 083c21be5588..cc93f9d0ea9a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -46,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update_service_bind.py index 124f25f97468..b6cfcf07c834 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update_service_bind.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update_service_bind.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -52,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_CreateOrUpdate_ServiceBind.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_CreateOrUpdate_ServiceBind.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_delete.py index 8f767c38f83f..d583f15359fa 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_delete.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get.py index 527ce8b43bcb..e99dca0fa6d9 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get_service_bind.py index bffb648b2e74..056e9703edac 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get_service_bind.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get_service_bind.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_Get_ServiceBind.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_Get_ServiceBind.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list.py index 0505fb4bf395..cb94ac582ad1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list_service_bind.py index fd153eb24c56..e4103be85f0b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list_service_bind.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list_service_bind.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_List_ServiceBind.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_List_ServiceBind.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch.py index 6dd065b5ee1b..45c3ddc6d56a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -46,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch_service_bind.py index 7289c041a76c..d318e50d1c3d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch_service_bind.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch_service_bind.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -52,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_Patch_ServiceBind.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_Patch_ServiceBind.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/functions_extension_post.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/functions_extension_post.py new file mode 100644 index 000000000000..3810be2c0e25 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/functions_extension_post.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python functions_extension_post.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.functions_extension.invoke_functions_host( + resource_group_name="rg", + container_app_name="testcontainerApp0", + revision_name="testcontainerApp0-pjxhsye", + function_app_name="testcontainerApp0", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/FunctionsExtension_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py index 703c852b6736..33f69f7ca08d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -43,12 +44,13 @@ def main(): {"propertyName": "spring.boot.admin.ui.enable-toasts", "value": "true"}, {"propertyName": "spring.boot.admin.monitor.status-interval", "value": "10000ms"}, ], + "scale": {"maxReplicas": 1, "minReplicas": 1}, } }, ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py index a7fd208f05a6..693c3bce4b92 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -43,6 +44,7 @@ def main(): {"propertyName": "spring.boot.admin.ui.enable-toasts", "value": "true"}, {"propertyName": "spring.boot.admin.monitor.status-interval", "value": "10000ms"}, ], + "scale": {"maxReplicas": 1, "minReplicas": 1}, "serviceBinds": [ { "name": "yellowcat", @@ -55,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_CreateOrUpdate_ServiceBind.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_CreateOrUpdate_ServiceBind.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_delete.py index c90fd77d7b3d..8e775406965f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_delete.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get.py index 957441f7e6b6..4f308ff2cade 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.py index 51378453d799..1c82e57413de 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_Get_ServiceBind.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_Get_ServiceBind.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list.py index 0fb2ce7d5a59..b83343d63563 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.py index bfbbba681c61..42460b521e02 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_List_ServiceBind.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_List_ServiceBind.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py index 95689cb92c43..8b96177de156 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -43,12 +44,13 @@ def main(): {"propertyName": "spring.boot.admin.ui.enable-toasts", "value": "true"}, {"propertyName": "spring.boot.admin.monitor.status-interval", "value": "10000ms"}, ], + "scale": {"maxReplicas": 1, "minReplicas": 1}, } }, ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py index 4c0daf6835f0..4cbc2247f0da 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -43,6 +44,7 @@ def main(): {"propertyName": "spring.boot.admin.ui.enable-toasts", "value": "true"}, {"propertyName": "spring.boot.admin.monitor.status-interval", "value": "10000ms"}, ], + "scale": {"maxReplicas": 1, "minReplicas": 1}, "serviceBinds": [ { "name": "yellowcat", @@ -55,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_Patch_ServiceBind.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_Patch_ServiceBind.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py index 226e0f4c27dc..72ed61792665 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -36,9 +37,22 @@ def main(): resource_group_name="rg", job_name="testcontainerAppsJob0", job_envelope={ + "identity": { + "type": "SystemAssigned,UserAssigned", + "userAssignedIdentities": { + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity": {} + }, + }, "location": "East US", "properties": { "configuration": { + "identitySettings": [ + { + "identity": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity", + "lifecycle": "All", + }, + {"identity": "system", "lifecycle": "Init"}, + ], "manualTriggerConfig": {"parallelism": 4, "replicaCompletionCount": 1}, "replicaRetryLimit": 10, "replicaTimeout": 10, @@ -84,6 +98,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_CreateorUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_CreateorUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_connected_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_connected_environment.py index 3a34b6d23ba3..47a9f65953c3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_connected_environment.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_connected_environment.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -84,6 +85,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_CreateorUpdate_ConnectedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_CreateorUpdate_ConnectedEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py index 76642c7b3be0..f0cad6661d77 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -36,6 +37,12 @@ def main(): resource_group_name="rg", job_name="testcontainerAppsJob0", job_envelope={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity": {} + }, + }, "location": "East US", "properties": { "configuration": { @@ -48,6 +55,7 @@ def main(): "pollingInterval": 40, "rules": [ { + "identity": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity", "metadata": {"topicName": "my-topic"}, "name": "servicebuscalingrule", "type": "azure-servicebus", @@ -78,6 +86,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_CreateorUpdate_EventTrigger.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_CreateorUpdate_EventTrigger.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py index 707d5be599a9..074d266edb7c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py index 71e6f219196e..ba97137820de 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Execution_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_Execution_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_executions_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_executions_get.py index 5c42446c93b7..a8908753c028 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_executions_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_executions_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Executions_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_Executions_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py index 13df12d0d25a..816b288f9cff 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py index 34492b40251e..a5f2bc751c28 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="f07f3711-b45e-40fe-a941-4e6d93f851e6", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_GetDetector.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_GetDetector.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py index 43aa91b84e69..0ecd8a580fda 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="f07f3711-b45e-40fe-a941-4e6d93f851e6", ) @@ -34,9 +35,10 @@ def main(): resource_group_name="mikono-workerapp-test-rg", job_name="mikonojob1", ) - print(response) + for item in response: + print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_ListDetectors.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_ListDetectors.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py index a00a65ae0774..46c7cbc9495c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py index fdd90a62cd4d..575d8c654cc3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -78,6 +79,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py index cb08ef600bde..f8d7d57e0703 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_ProxyGet.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_ProxyGet.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py index 9c45dd9143a2..8e29f228047e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Start.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_Start.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_execution.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_execution.py index a35dbe1fdb88..4f4d52085d1a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_execution.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_execution.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Stop_Execution.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_Stop_Execution.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_multiple.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_multiple.py index fc6afaa7d9e4..c21d1a920d1b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_multiple.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_multiple.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Stop_Multiple.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_Stop_Multiple.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_resource_group.py index bb74c063d810..aa2b933e8cb2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_resource_group.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Jobs_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Jobs_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_subscription.py index 417ccd48b7b5..d05e77ea6151 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_subscription.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Jobs_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Jobs_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_create.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_create.py new file mode 100644 index 000000000000..bd8300b9bb0f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_create.py @@ -0,0 +1,47 @@ +# 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, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.logic_apps.create_or_update( + resource_group_name="examplerg", + container_app_name="testcontainerApp0", + logic_app_name="testcontainerApp0", + resource={"properties": {}}, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete.py new file mode 100644 index 000000000000..53b812765a4c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.logic_apps.delete( + resource_group_name="examplerg", + container_app_name="testcontainerApp0", + logic_app_name="testcontainerApp0", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete_deploy_workflow_artifacts.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete_deploy_workflow_artifacts.py new file mode 100644 index 000000000000..a9823e5fd590 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete_deploy_workflow_artifacts.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_delete_deploy_workflow_artifacts.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + client.logic_apps.deploy_workflow_artifacts( + resource_group_name="testrg123", + container_app_name="testapp2", + logic_app_name="testapp2", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_DeleteDeployWorkflowArtifacts.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get.py new file mode 100644 index 000000000000..210042819531 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.logic_apps.get( + resource_group_name="examplerg", + container_app_name="testcontainerApp0", + logic_app_name="testcontainerApp0", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get_workflow.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get_workflow.py new file mode 100644 index 000000000000..907082ded50f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get_workflow.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_get_workflow.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.logic_apps.get_workflow( + resource_group_name="examplerg", + container_app_name="testcontainerApp0", + logic_app_name="testcontainerApp0", + workflow_name="stateful1", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_GetWorkflow.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_connections.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_connections.py new file mode 100644 index 000000000000..925e0bf2fdc2 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_connections.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_list_connections.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.logic_apps.list_workflows_connections( + resource_group_name="testrg123", + container_app_name="testapp2", + logic_app_name="testapp2", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_ListConnections.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_workflows.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_workflows.py new file mode 100644 index 000000000000..92b1b761eeb9 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_workflows.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_list_workflows.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.logic_apps.list_workflows( + resource_group_name="examplerg", + container_app_name="testcontainerApp0", + logic_app_name="testcontainerApp0", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_ListWorkflows.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_post_deploy_workflow_artifacts.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_post_deploy_workflow_artifacts.py new file mode 100644 index 000000000000..8465ac88ba2d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_post_deploy_workflow_artifacts.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_post_deploy_workflow_artifacts.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + client.logic_apps.deploy_workflow_artifacts( + resource_group_name="testrg123", + container_app_name="testapp2", + logic_app_name="testapp2", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_PostDeployWorkflowArtifacts.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py index f82b4b92f33e..7d0bc48bd3e9 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedCertificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedCertificate_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_delete.py index d81ae7f29fbe..e4f44c4e992f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_delete.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedCertificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedCertificate_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_get.py index fcf0c6f806e7..e2fecf5ebee2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedCertificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedCertificate_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_list_by_managed_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_list_by_managed_environment.py index 7d3485b3dc42..98dfcd8fd90a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_list_by_managed_environment.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_list_by_managed_environment.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedCertificates_ListByManagedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedCertificates_ListByManagedEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_patch.py index 3d48fd683378..6d6a34505619 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_patch.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -41,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedCertificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedCertificates_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_get.py index 9654c3282d2c..eb43e3778384 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="f07f3711-b45e-40fe-a941-4e6d93f851e6", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentDiagnostics_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentDiagnostics_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_list.py index 5869e15ea3a5..662b06165449 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_list.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="f07f3711-b45e-40fe-a941-4e6d93f851e6", ) @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentDiagnostics_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentDiagnostics_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_create_or_update.py new file mode 100644 index 000000000000..493886900ce0 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_create_or_update.py @@ -0,0 +1,49 @@ +# 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, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_private_endpoint_connections_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.managed_environment_private_endpoint_connections.begin_create_or_update( + resource_group_name="examplerg", + environment_name="managedEnv", + private_endpoint_connection_name="jlaw-demo1", + private_endpoint_connection_envelope={ + "properties": {"privateLinkServiceConnectionState": {"actionsRequired": "None", "status": "Approved"}} + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentPrivateEndpointConnections_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_delete.py new file mode 100644 index 000000000000..2ca9d4994e1e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_delete.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_private_endpoint_connections_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.managed_environment_private_endpoint_connections.begin_delete( + resource_group_name="examplerg", + environment_name="managedEnv", + private_endpoint_connection_name="jlaw-demo1", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentPrivateEndpointConnections_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_get.py new file mode 100644 index 000000000000..e519f964af06 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_get.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_private_endpoint_connections_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.managed_environment_private_endpoint_connections.get( + resource_group_name="examplerg", + environment_name="managedEnv", + private_endpoint_connection_name="jlaw-demo1", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentPrivateEndpointConnections_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_list.py new file mode 100644 index 000000000000..4e24da9b8201 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_list.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_private_endpoint_connections_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.managed_environment_private_endpoint_connections.list( + resource_group_name="examplerg", + environment_name="managedEnv", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentPrivateEndpointConnections_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_link_resources_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_link_resources_list.py new file mode 100644 index 000000000000..0643223311b8 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_link_resources_list.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_private_link_resources_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.managed_environment_private_link_resources.list( + resource_group_name="examplerg", + environment_name="managedEnv", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentPrivateLinkResources_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py index 49df9cba2d41..f0bfd54f92d6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="subid", ) @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentUsages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentUsages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_create_or_update.py index d14f9aa12b11..7819820db05e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_create_or_update.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -77,6 +78,7 @@ def main(): "tracesConfiguration": {"destinations": ["appInsights"]}, }, "peerAuthentication": {"mtls": {"enabled": True}}, + "peerTrafficConfiguration": {"encryption": {"enabled": True}}, "vnetConfiguration": { "infrastructureSubnetId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/VNetName/subnets/subnetName1" }, @@ -108,6 +110,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_custom_infrastructure_resource_group_create.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_custom_infrastructure_resource_group_create.py index bf8b11e1fa3d..3de66728097e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_custom_infrastructure_resource_group_create.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_custom_infrastructure_resource_group_create.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -77,6 +78,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_CustomInfrastructureResourceGroup_Create.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_CustomInfrastructureResourceGroup_Create.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_delete.py index 75019f367c6c..5633f1b135e2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_delete.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get.py index 0f70c08f3366..64465ac3bd66 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get.py @@ -9,7 +9,6 @@ from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient - """ # PREREQUISITES pip install azure-identity @@ -22,21 +21,21 @@ AZURE_CLIENT_SECRET. For more info about how to get the value, please see: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal """ - - def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) - response = client.managed_environments_diagnostics.get_root( - resource_group_name="examplerg", - environment_name="jlaw-demo1", + response = client.managed_environments.get( + resource_group_name='examplerg', + environment_name='jlaw-demo1', ) print(response) - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_Get.json if __name__ == "__main__": main() +n__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py index e2020d33fdc3..0131dfdb347c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="651f8027-33e8-4ec4-97b4-f6e9f3dc8744", ) @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_GetAuthToken.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_GetAuthToken.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_resource_group.py index 6a42e68a13fb..4746f771fcc9 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_resource_group.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_subscription.py index 157f4e41569a..541425357e00 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_subscription.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_workload_profile_states.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_workload_profile_states.py index 7fbce5c40111..a31423c3f393 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_workload_profile_states.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_workload_profile_states.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_ListWorkloadProfileStates.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_ListWorkloadProfileStates.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_patch.py index 6c8a286e29f8..45a0d022dcfe 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_patch.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -40,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update.py index e1b2ea86cf93..afb4a26a9caa 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -50,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py index 41af4163e581..fcb1acf87ef1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py @@ -29,6 +29,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -43,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate_NfsAzureFile.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate_NfsAzureFile.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py index 2998b568b579..c62017f88601 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentsStorages_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentsStorages_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get.py index 0d0955564cd3..d0c90378b6e0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentsStorages_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentsStorages_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py index e61419aaacb1..291ca2eb7ba4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentsStorages_Get_NfsAzureFile.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentsStorages_Get_NfsAzureFile.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py index eed274629609..4e4365910263 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentsStorages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentsStorages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py index 119af87df18c..0d095b80a1d7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="SUBSCRIPTION_ID", ) @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Operations_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py index f1e6923b9510..56aaf032ad5f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="651f8027-33e8-4ec4-97b4-f6e9f3dc8744", ) @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Replicas_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Replicas_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py index ced67bc69945..2d0684bdea2d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="651f8027-33e8-4ec4-97b4-f6e9f3dc8744", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Replicas_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Replicas_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py index 16bf6566e1a4..d76c397c1722 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Revisions_Activate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Revisions_Activate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py index 12cf26fe99f8..43f5fb8324b1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Revisions_Deactivate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Revisions_Deactivate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py index dd0b6278c92e..b8ce0f98825b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py @@ -27,10 +27,11 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.container_apps_revisions.get_revision( + response = client.container_apps_diagnostics.get_revision( resource_group_name="rg", container_app_name="testcontainerApp0", revision_name="testcontainerApp0-pjxhsye", @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Revisions_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Revisions_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py index c9bde6a3e2c6..c66b64a993e0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py @@ -27,10 +27,11 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.container_apps_revisions.list_revisions( + response = client.container_apps_diagnostics.list_revisions( resource_group_name="rg", container_app_name="testcontainerApp0", ) @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Revisions_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Revisions_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py index 3e581135da72..b3f93d093448 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Revisions_Restart.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Revisions_Restart.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_create_or_update.py new file mode 100644 index 000000000000..62ef2355b612 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_create_or_update.py @@ -0,0 +1,67 @@ +# 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, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python session_pools_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="testsessionpool", + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.container_apps_session_pools.begin_create_or_update( + resource_group_name="rg", + session_pool_envelope={ + "location": "East US", + "properties": { + "containerType": "CustomContainer", + "customContainerTemplate": { + "containers": [ + { + "args": ["-c", "while true; do echo hello; sleep 10;done"], + "command": ["/bin/sh"], + "image": "repo/testcontainer:v4", + "name": "testinitcontainer", + "resources": {"cpu": 0.25, "memory": "0.5Gi"}, + } + ], + "ingress": {"targetPort": 80}, + }, + "dynamicPoolConfiguration": {"cooldownPeriodInSeconds": 600, "executionType": "Timed"}, + "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", + "poolManagementType": "Dynamic", + "scaleConfiguration": {"maxConcurrentSessions": 500, "readySessionInstances": 100}, + "sessionNetworkConfiguration": {"status": "EgressEnabled"}, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SessionPools_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_delete.py similarity index 77% rename from sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_delete.py rename to sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_delete.py index ca22d4352d20..f8cafe53fb01 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_delete.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-appcontainers # USAGE - python source_controls_delete.py + python session_pools_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -27,16 +27,15 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), - subscription_id="651f8027-33e8-4ec4-97b4-f6e9f3dc8744", + session_pool_name="testsessionpool", + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - client.container_apps_source_controls.begin_delete( - resource_group_name="workerapps-rg-xj", - container_app_name="testcanadacentral", - source_control_name="current", + client.container_apps_session_pools.begin_delete( + resource_group_name="rg", ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/SourceControls_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SessionPools_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_get.py new file mode 100644 index 000000000000..5174588bd2bb --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python session_pools_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="testsessionpool", + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.container_apps_session_pools.get( + resource_group_name="rg", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SessionPools_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_resource_group.py new file mode 100644 index 000000000000..dd3aa52f173a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_resource_group.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python session_pools_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.container_apps_session_pools.list_by_resource_group( + resource_group_name="rg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SessionPools_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_subscription.py new file mode 100644 index 000000000000..e79c6e63b782 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_subscription.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python session_pools_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.container_apps_session_pools.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SessionPools_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_patch.py similarity index 50% rename from sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py rename to sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_patch.py index b2a93c97a1fa..0ebfdb652905 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_patch.py @@ -17,7 +17,7 @@ pip install azure-identity pip install azure-mgmt-appcontainers # USAGE - python source_controls_create_or_update.py + python session_pools_patch.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,40 +29,35 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), - subscription_id="651f8027-33e8-4ec4-97b4-f6e9f3dc8744", + session_pool_name="testsessionpool", + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.container_apps_source_controls.begin_create_or_update( - resource_group_name="workerapps-rg-xj", - container_app_name="testcanadacentral", - source_control_name="current", - source_control_envelope={ + response = client.container_apps_session_pools.begin_update( + resource_group_name="rg", + session_pool_envelope={ "properties": { - "branch": "master", - "githubActionConfiguration": { - "azureCredentials": { - "clientId": "", - "clientSecret": "", - "kind": "feaderated", - "tenantId": "", - }, - "buildEnvironmentVariables": [{"name": "foo1", "value": "bar1"}, {"name": "foo2", "value": "bar2"}], - "contextPath": "./", - "githubPersonalAccessToken": "test", - "image": "image/tag", - "registryInfo": { - "registryPassword": "", - "registryUrl": "test-registry.azurecr.io", - "registryUserName": "test-registry", - }, + "customContainerTemplate": { + "containers": [ + { + "args": ["-c", "while true; do echo hello; sleep 10;done"], + "command": ["/bin/sh"], + "image": "repo/testcontainer:v4", + "name": "testinitcontainer", + "resources": {"cpu": 0.25, "memory": "0.5Gi"}, + } + ], + "ingress": {"targetPort": 80}, }, - "repoUrl": "https://github.com/xwang971/ghatest", + "dynamicPoolConfiguration": {"cooldownPeriodInSeconds": 600, "executionType": "Timed"}, + "scaleConfiguration": {"maxConcurrentSessions": 500, "readySessionInstances": 100}, + "sessionNetworkConfiguration": {"status": "EgressEnabled"}, } }, ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/SourceControls_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SessionPools_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_get.py index 9276b931e314..4d5a885c2dbc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_get.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="651f8027-33e8-4ec4-97b4-f6e9f3dc8744", ) @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/SourceControls_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SourceControls_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_list_by_container.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_list_by_container.py index 3d8e2b44f018..6060b2fb40d3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_list_by_container.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_list_by_container.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="651f8027-33e8-4ec4-97b4-f6e9f3dc8744", ) @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/SourceControls_ListByContainer.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SourceControls_ListByContainer.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py index cea7244da098..e560a664c2a6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="d27c3573-f76e-4b26-b871-0ccd2203d08c", ) @@ -34,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Subscriptions_GetCustomDomainVerificationId.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Subscriptions_GetCustomDomainVerificationId.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py index c3633f4f65d5..6f89fba0a1cb 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py @@ -27,6 +27,7 @@ def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), + session_pool_name="SESSION_POOL_NAME", subscription_id="subid", ) @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Usages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Usages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/conftest.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/conftest.py new file mode 100644 index 000000000000..961ce7cf468a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/conftest.py @@ -0,0 +1,35 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + containerappsapi_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + containerappsapi_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + containerappsapi_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + containerappsapi_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=containerappsapi_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=containerappsapi_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=containerappsapi_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=containerappsapi_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api.py new file mode 100644 index 000000000000..94215044ea12 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPI(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_job_execution(self, resource_group): + response = self.client.job_execution( + resource_group_name=resource_group.name, + job_name="str", + job_execution_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_custom_domain_verification_id(self, resource_group): + response = self.client.get_custom_domain_verification_id( + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations.py new file mode 100644 index 000000000000..54644f94f304 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations.py @@ -0,0 +1,151 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIAppResiliencyOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.app_resiliency.create_or_update( + resource_group_name=resource_group.name, + app_name="str", + name="str", + resiliency_envelope={ + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "maxEjectionPercent": 0}, + "httpConnectionPool": {"http1MaxPendingRequests": 0, "http2MaxRequests": 0}, + "httpRetryPolicy": { + "errors": ["str"], + "headers": [ + { + "exactMatch": "str", + "header": "str", + "prefixMatch": "str", + "regexMatch": "str", + "suffixMatch": "str", + } + ], + "httpStatusCodes": [0], + "initialDelayInMilliseconds": 0, + "maxIntervalInMilliseconds": 0, + "maxRetries": 0, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tcpConnectionPool": {"maxConnections": 0}, + "tcpRetryPolicy": {"maxConnectAttempts": 0}, + "timeoutPolicy": {"connectionTimeoutInSeconds": 0, "responseTimeoutInSeconds": 0}, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.app_resiliency.update( + resource_group_name=resource_group.name, + app_name="str", + name="str", + resiliency_envelope={ + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "maxEjectionPercent": 0}, + "httpConnectionPool": {"http1MaxPendingRequests": 0, "http2MaxRequests": 0}, + "httpRetryPolicy": { + "errors": ["str"], + "headers": [ + { + "exactMatch": "str", + "header": "str", + "prefixMatch": "str", + "regexMatch": "str", + "suffixMatch": "str", + } + ], + "httpStatusCodes": [0], + "initialDelayInMilliseconds": 0, + "maxIntervalInMilliseconds": 0, + "maxRetries": 0, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tcpConnectionPool": {"maxConnections": 0}, + "tcpRetryPolicy": {"maxConnectAttempts": 0}, + "timeoutPolicy": {"connectionTimeoutInSeconds": 0, "responseTimeoutInSeconds": 0}, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.app_resiliency.delete( + resource_group_name=resource_group.name, + app_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.app_resiliency.get( + resource_group_name=resource_group.name, + app_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.app_resiliency.list( + resource_group_name=resource_group.name, + app_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations_async.py new file mode 100644 index 000000000000..ff4be53d4302 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations_async.py @@ -0,0 +1,152 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIAppResiliencyOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.app_resiliency.create_or_update( + resource_group_name=resource_group.name, + app_name="str", + name="str", + resiliency_envelope={ + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "maxEjectionPercent": 0}, + "httpConnectionPool": {"http1MaxPendingRequests": 0, "http2MaxRequests": 0}, + "httpRetryPolicy": { + "errors": ["str"], + "headers": [ + { + "exactMatch": "str", + "header": "str", + "prefixMatch": "str", + "regexMatch": "str", + "suffixMatch": "str", + } + ], + "httpStatusCodes": [0], + "initialDelayInMilliseconds": 0, + "maxIntervalInMilliseconds": 0, + "maxRetries": 0, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tcpConnectionPool": {"maxConnections": 0}, + "tcpRetryPolicy": {"maxConnectAttempts": 0}, + "timeoutPolicy": {"connectionTimeoutInSeconds": 0, "responseTimeoutInSeconds": 0}, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.app_resiliency.update( + resource_group_name=resource_group.name, + app_name="str", + name="str", + resiliency_envelope={ + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "maxEjectionPercent": 0}, + "httpConnectionPool": {"http1MaxPendingRequests": 0, "http2MaxRequests": 0}, + "httpRetryPolicy": { + "errors": ["str"], + "headers": [ + { + "exactMatch": "str", + "header": "str", + "prefixMatch": "str", + "regexMatch": "str", + "suffixMatch": "str", + } + ], + "httpStatusCodes": [0], + "initialDelayInMilliseconds": 0, + "maxIntervalInMilliseconds": 0, + "maxRetries": 0, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tcpConnectionPool": {"maxConnections": 0}, + "tcpRetryPolicy": {"maxConnectAttempts": 0}, + "timeoutPolicy": {"connectionTimeoutInSeconds": 0, "responseTimeoutInSeconds": 0}, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.app_resiliency.delete( + resource_group_name=resource_group.name, + app_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.app_resiliency.get( + resource_group_name=resource_group.name, + app_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.app_resiliency.list( + resource_group_name=resource_group.name, + app_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_async.py new file mode 100644 index 000000000000..ef584fad5d2d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_async.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_job_execution(self, resource_group): + response = await self.client.job_execution( + resource_group_name=resource_group.name, + job_name="str", + job_execution_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_custom_domain_verification_id(self, resource_group): + response = await self.client.get_custom_domain_verification_id( + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations.py new file mode 100644 index 000000000000..8eae410d0d89 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIAvailableWorkloadProfilesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.available_workload_profiles.get( + location="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations_async.py new file mode 100644 index 000000000000..f1c9e48ffecb --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations_async.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIAvailableWorkloadProfilesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = self.client.available_workload_profiles.get( + location="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations.py new file mode 100644 index 000000000000..275a3238118c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBillingMetersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.billing_meters.get( + location="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations_async.py new file mode 100644 index 000000000000..f0b99ca05854 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations_async.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBillingMetersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.billing_meters.get( + location="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations.py new file mode 100644 index 000000000000..d042638f1658 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildAuthTokenOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.build_auth_token.list( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations_async.py new file mode 100644 index 000000000000..c318505cab15 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations_async.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildAuthTokenOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = await self.client.build_auth_token.list( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations.py new file mode 100644 index 000000000000..bf0aa1457acc --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.builders.list_by_subscription( + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.builders.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.builders.get( + resource_group_name=resource_group.name, + builder_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.builders.begin_create_or_update( + resource_group_name=resource_group.name, + builder_name="str", + builder_envelope={ + "location": "str", + "containerRegistries": [{"containerRegistryServer": "str", "identityResourceId": "str"}], + "environmentId": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.builders.begin_update( + resource_group_name=resource_group.name, + builder_name="str", + builder_envelope={ + "environmentId": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "tags": {"str": "str"}, + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.builders.begin_delete( + resource_group_name=resource_group.name, + builder_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations_async.py new file mode 100644 index 000000000000..22c6c7970201 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations_async.py @@ -0,0 +1,129 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.builders.list_by_subscription( + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.builders.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.builders.get( + resource_group_name=resource_group.name, + builder_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.builders.begin_create_or_update( + resource_group_name=resource_group.name, + builder_name="str", + builder_envelope={ + "location": "str", + "containerRegistries": [{"containerRegistryServer": "str", "identityResourceId": "str"}], + "environmentId": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.builders.begin_update( + resource_group_name=resource_group.name, + builder_name="str", + builder_envelope={ + "environmentId": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "tags": {"str": "str"}, + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.builders.begin_delete( + resource_group_name=resource_group.name, + builder_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations.py new file mode 100644 index 000000000000..b09222cbb50d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildsByBuilderResourceOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.builds_by_builder_resource.list( + resource_group_name=resource_group.name, + builder_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations_async.py new file mode 100644 index 000000000000..3bb9dc3a779f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildsByBuilderResourceOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.builds_by_builder_resource.list( + resource_group_name=resource_group.name, + builder_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations.py new file mode 100644 index 000000000000..27fc8b6e19e6 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations.py @@ -0,0 +1,90 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.builds.get( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.builds.begin_create_or_update( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + build_envelope={ + "buildStatus": "str", + "configuration": { + "baseOs": "str", + "environmentVariables": [{"name": "str", "value": "str"}], + "platform": "str", + "platformVersion": "str", + "preBuildSteps": [ + { + "description": "str", + "httpGet": {"url": "str", "fileName": "str", "headers": ["str"]}, + "scripts": ["str"], + } + ], + }, + "destinationContainerRegistry": {"server": "str", "image": "str"}, + "id": "str", + "logStreamEndpoint": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tokenEndpoint": "str", + "type": "str", + "uploadEndpoint": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.builds.begin_delete( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations_async.py new file mode 100644 index 000000000000..8926a7c50342 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations_async.py @@ -0,0 +1,95 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.builds.get( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.builds.begin_create_or_update( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + build_envelope={ + "buildStatus": "str", + "configuration": { + "baseOs": "str", + "environmentVariables": [{"name": "str", "value": "str"}], + "platform": "str", + "platformVersion": "str", + "preBuildSteps": [ + { + "description": "str", + "httpGet": {"url": "str", "fileName": "str", "headers": ["str"]}, + "scripts": ["str"], + } + ], + }, + "destinationContainerRegistry": {"server": "str", "image": "str"}, + "id": "str", + "logStreamEndpoint": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tokenEndpoint": "str", + "type": "str", + "uploadEndpoint": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.builds.begin_delete( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations.py new file mode 100644 index 000000000000..bb71a5ae354f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations.py @@ -0,0 +1,84 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPICertificatesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.certificates.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.certificates.get( + resource_group_name=resource_group.name, + environment_name="str", + certificate_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.certificates.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + certificate_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.certificates.delete( + resource_group_name=resource_group.name, + environment_name="str", + certificate_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.certificates.update( + resource_group_name=resource_group.name, + environment_name="str", + certificate_name="str", + certificate_envelope={"tags": {"str": "str"}}, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations_async.py new file mode 100644 index 000000000000..fa7528f15ff7 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations_async.py @@ -0,0 +1,85 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPICertificatesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.certificates.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.certificates.get( + resource_group_name=resource_group.name, + environment_name="str", + certificate_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.certificates.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + certificate_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.certificates.delete( + resource_group_name=resource_group.name, + environment_name="str", + certificate_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.certificates.update( + resource_group_name=resource_group.name, + environment_name="str", + certificate_name="str", + certificate_envelope={"tags": {"str": "str"}}, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations.py new file mode 100644 index 000000000000..90e7557395ce --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations.py @@ -0,0 +1,84 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIConnectedEnvironmentsCertificatesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.connected_environments_certificates.list( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.connected_environments_certificates.get( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.connected_environments_certificates.create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.connected_environments_certificates.delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.connected_environments_certificates.update( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + certificate_envelope={"tags": {"str": "str"}}, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations_async.py new file mode 100644 index 000000000000..1aecd0cca672 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations_async.py @@ -0,0 +1,85 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIConnectedEnvironmentsCertificatesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.connected_environments_certificates.list( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.connected_environments_certificates.get( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.connected_environments_certificates.create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.connected_environments_certificates.delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.connected_environments_certificates.update( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + certificate_envelope={"tags": {"str": "str"}}, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations.py new file mode 100644 index 000000000000..d8e59805808a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations.py @@ -0,0 +1,107 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIConnectedEnvironmentsDaprComponentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.connected_environments_dapr_components.list( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.connected_environments_dapr_components.get( + resource_group_name=resource_group.name, + connected_environment_name="str", + component_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.connected_environments_dapr_components.create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + component_name="str", + dapr_component_envelope={ + "componentType": "str", + "id": "str", + "ignoreErrors": False, + "initTimeout": "str", + "metadata": [{"name": "str", "secretRef": "str", "value": "str"}], + "name": "str", + "scopes": ["str"], + "secretStoreComponent": "str", + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "serviceComponentBind": [ + {"metadata": {"name": "str", "value": "str"}, "name": "str", "serviceId": "str"} + ], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + "version": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.connected_environments_dapr_components.delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + component_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_secrets(self, resource_group): + response = self.client.connected_environments_dapr_components.list_secrets( + resource_group_name=resource_group.name, + connected_environment_name="str", + component_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations_async.py new file mode 100644 index 000000000000..1c70aa13e458 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations_async.py @@ -0,0 +1,108 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIConnectedEnvironmentsDaprComponentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.connected_environments_dapr_components.list( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.connected_environments_dapr_components.get( + resource_group_name=resource_group.name, + connected_environment_name="str", + component_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.connected_environments_dapr_components.create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + component_name="str", + dapr_component_envelope={ + "componentType": "str", + "id": "str", + "ignoreErrors": False, + "initTimeout": "str", + "metadata": [{"name": "str", "secretRef": "str", "value": "str"}], + "name": "str", + "scopes": ["str"], + "secretStoreComponent": "str", + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "serviceComponentBind": [ + {"metadata": {"name": "str", "value": "str"}, "name": "str", "serviceId": "str"} + ], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + "version": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.connected_environments_dapr_components.delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + component_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_secrets(self, resource_group): + response = await self.client.connected_environments_dapr_components.list_secrets( + resource_group_name=resource_group.name, + connected_environment_name="str", + component_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations.py new file mode 100644 index 000000000000..d8d65eaeb645 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations.py @@ -0,0 +1,132 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIConnectedEnvironmentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.connected_environments.list_by_subscription( + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.connected_environments.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.connected_environments.get( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.connected_environments.begin_create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + environment_envelope={ + "location": "str", + "customDomainConfiguration": { + "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, + "certificatePassword": "str", + "certificateValue": bytes("bytes", encoding="utf-8"), + "customDomainVerificationId": "str", + "dnsSuffix": "str", + "expirationDate": "2020-02-20 00:00:00", + "subjectName": "str", + "thumbprint": "str", + }, + "daprAIConnectionString": "str", + "defaultDomain": "str", + "deploymentErrors": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "name": "str", + "provisioningState": "str", + "staticIp": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.connected_environments.begin_delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.connected_environments.update( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_check_name_availability(self, resource_group): + response = self.client.connected_environments.check_name_availability( + resource_group_name=resource_group.name, + connected_environment_name="str", + check_name_availability_request={"name": "str", "type": "str"}, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations_async.py new file mode 100644 index 000000000000..20b583aecca8 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations_async.py @@ -0,0 +1,137 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIConnectedEnvironmentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.connected_environments.list_by_subscription( + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.connected_environments.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.connected_environments.get( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.connected_environments.begin_create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + environment_envelope={ + "location": "str", + "customDomainConfiguration": { + "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, + "certificatePassword": "str", + "certificateValue": bytes("bytes", encoding="utf-8"), + "customDomainVerificationId": "str", + "dnsSuffix": "str", + "expirationDate": "2020-02-20 00:00:00", + "subjectName": "str", + "thumbprint": "str", + }, + "daprAIConnectionString": "str", + "defaultDomain": "str", + "deploymentErrors": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "name": "str", + "provisioningState": "str", + "staticIp": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.connected_environments.begin_delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.connected_environments.update( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_check_name_availability(self, resource_group): + response = await self.client.connected_environments.check_name_availability( + resource_group_name=resource_group.name, + connected_environment_name="str", + check_name_availability_request={"name": "str", "type": "str"}, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations.py new file mode 100644 index 000000000000..9d23204d77e3 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations.py @@ -0,0 +1,94 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIConnectedEnvironmentsStoragesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.connected_environments_storages.list( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.connected_environments_storages.get( + resource_group_name=resource_group.name, + connected_environment_name="str", + storage_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.connected_environments_storages.create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + storage_name="str", + storage_envelope={ + "id": "str", + "name": "str", + "properties": { + "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"}, + "smb": { + "accessMode": "str", + "domain": "str", + "host": "str", + "password": "str", + "shareName": "str", + "username": "str", + }, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.connected_environments_storages.delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + storage_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations_async.py new file mode 100644 index 000000000000..2f61ad4ecc5a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations_async.py @@ -0,0 +1,95 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIConnectedEnvironmentsStoragesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = await self.client.connected_environments_storages.list( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.connected_environments_storages.get( + resource_group_name=resource_group.name, + connected_environment_name="str", + storage_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.connected_environments_storages.create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + storage_name="str", + storage_envelope={ + "id": "str", + "name": "str", + "properties": { + "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"}, + "smb": { + "accessMode": "str", + "domain": "str", + "host": "str", + "password": "str", + "shareName": "str", + "username": "str", + }, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.connected_environments_storages.delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + storage_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations.py new file mode 100644 index 000000000000..a05430f40e0d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations.py @@ -0,0 +1,181 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsAuthConfigsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_container_app(self, resource_group): + response = self.client.container_apps_auth_configs.list_by_container_app( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.container_apps_auth_configs.get( + resource_group_name=resource_group.name, + container_app_name="str", + auth_config_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.container_apps_auth_configs.create_or_update( + resource_group_name=resource_group.name, + container_app_name="str", + auth_config_name="str", + auth_config_envelope={ + "encryptionSettings": { + "containerAppAuthEncryptionSecretName": "str", + "containerAppAuthSigningSecretName": "str", + }, + "globalValidation": { + "excludedPaths": ["str"], + "redirectToProvider": "str", + "unauthenticatedClientAction": "str", + }, + "httpSettings": { + "forwardProxy": { + "convention": "str", + "customHostHeaderName": "str", + "customProtoHeaderName": "str", + }, + "requireHttps": bool, + "routes": {"apiPrefix": "str"}, + }, + "id": "str", + "identityProviders": { + "apple": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + }, + "azureActiveDirectory": { + "enabled": bool, + "isAutoProvisioned": bool, + "login": {"disableWWWAuthenticate": bool, "loginParameters": ["str"]}, + "registration": { + "clientId": "str", + "clientSecretCertificateIssuer": "str", + "clientSecretCertificateSubjectAlternativeName": "str", + "clientSecretCertificateThumbprint": "str", + "clientSecretSettingName": "str", + "openIdIssuer": "str", + }, + "validation": { + "allowedAudiences": ["str"], + "defaultAuthorizationPolicy": { + "allowedApplications": ["str"], + "allowedPrincipals": {"groups": ["str"], "identities": ["str"]}, + }, + "jwtClaimChecks": {"allowedClientApplications": ["str"], "allowedGroups": ["str"]}, + }, + }, + "azureStaticWebApps": {"enabled": bool, "registration": {"clientId": "str"}}, + "customOpenIdConnectProviders": { + "str": { + "enabled": bool, + "login": {"nameClaimType": "str", "scopes": ["str"]}, + "registration": { + "clientCredential": {"clientSecretSettingName": "str", "method": "ClientSecretPost"}, + "clientId": "str", + "openIdConnectConfiguration": { + "authorizationEndpoint": "str", + "certificationUri": "str", + "issuer": "str", + "tokenEndpoint": "str", + "wellKnownOpenIdConfiguration": "str", + }, + }, + } + }, + "facebook": { + "enabled": bool, + "graphApiVersion": "str", + "login": {"scopes": ["str"]}, + "registration": {"appId": "str", "appSecretSettingName": "str"}, + }, + "gitHub": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + }, + "google": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + "validation": {"allowedAudiences": ["str"]}, + }, + "twitter": { + "enabled": bool, + "registration": {"consumerKey": "str", "consumerSecretSettingName": "str"}, + }, + }, + "login": { + "allowedExternalRedirectUrls": ["str"], + "cookieExpiration": {"convention": "str", "timeToExpiration": "str"}, + "nonce": {"nonceExpirationInterval": "str", "validateNonce": bool}, + "preserveUrlFragmentsForLogins": bool, + "routes": {"logoutEndpoint": "str"}, + "tokenStore": { + "azureBlobStorage": {"sasUrlSettingName": "str"}, + "enabled": bool, + "tokenRefreshExtensionHours": 0.0, + }, + }, + "name": "str", + "platform": {"enabled": bool, "runtimeVersion": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.container_apps_auth_configs.delete( + resource_group_name=resource_group.name, + container_app_name="str", + auth_config_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations_async.py new file mode 100644 index 000000000000..a5de3d34523f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations_async.py @@ -0,0 +1,182 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsAuthConfigsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_container_app(self, resource_group): + response = self.client.container_apps_auth_configs.list_by_container_app( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.container_apps_auth_configs.get( + resource_group_name=resource_group.name, + container_app_name="str", + auth_config_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.container_apps_auth_configs.create_or_update( + resource_group_name=resource_group.name, + container_app_name="str", + auth_config_name="str", + auth_config_envelope={ + "encryptionSettings": { + "containerAppAuthEncryptionSecretName": "str", + "containerAppAuthSigningSecretName": "str", + }, + "globalValidation": { + "excludedPaths": ["str"], + "redirectToProvider": "str", + "unauthenticatedClientAction": "str", + }, + "httpSettings": { + "forwardProxy": { + "convention": "str", + "customHostHeaderName": "str", + "customProtoHeaderName": "str", + }, + "requireHttps": bool, + "routes": {"apiPrefix": "str"}, + }, + "id": "str", + "identityProviders": { + "apple": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + }, + "azureActiveDirectory": { + "enabled": bool, + "isAutoProvisioned": bool, + "login": {"disableWWWAuthenticate": bool, "loginParameters": ["str"]}, + "registration": { + "clientId": "str", + "clientSecretCertificateIssuer": "str", + "clientSecretCertificateSubjectAlternativeName": "str", + "clientSecretCertificateThumbprint": "str", + "clientSecretSettingName": "str", + "openIdIssuer": "str", + }, + "validation": { + "allowedAudiences": ["str"], + "defaultAuthorizationPolicy": { + "allowedApplications": ["str"], + "allowedPrincipals": {"groups": ["str"], "identities": ["str"]}, + }, + "jwtClaimChecks": {"allowedClientApplications": ["str"], "allowedGroups": ["str"]}, + }, + }, + "azureStaticWebApps": {"enabled": bool, "registration": {"clientId": "str"}}, + "customOpenIdConnectProviders": { + "str": { + "enabled": bool, + "login": {"nameClaimType": "str", "scopes": ["str"]}, + "registration": { + "clientCredential": {"clientSecretSettingName": "str", "method": "ClientSecretPost"}, + "clientId": "str", + "openIdConnectConfiguration": { + "authorizationEndpoint": "str", + "certificationUri": "str", + "issuer": "str", + "tokenEndpoint": "str", + "wellKnownOpenIdConfiguration": "str", + }, + }, + } + }, + "facebook": { + "enabled": bool, + "graphApiVersion": "str", + "login": {"scopes": ["str"]}, + "registration": {"appId": "str", "appSecretSettingName": "str"}, + }, + "gitHub": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + }, + "google": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + "validation": {"allowedAudiences": ["str"]}, + }, + "twitter": { + "enabled": bool, + "registration": {"consumerKey": "str", "consumerSecretSettingName": "str"}, + }, + }, + "login": { + "allowedExternalRedirectUrls": ["str"], + "cookieExpiration": {"convention": "str", "timeToExpiration": "str"}, + "nonce": {"nonceExpirationInterval": "str", "validateNonce": bool}, + "preserveUrlFragmentsForLogins": bool, + "routes": {"logoutEndpoint": "str"}, + "tokenStore": { + "azureBlobStorage": {"sasUrlSettingName": "str"}, + "enabled": bool, + "tokenRefreshExtensionHours": 0.0, + }, + }, + "name": "str", + "platform": {"enabled": bool, "runtimeVersion": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.container_apps_auth_configs.delete( + resource_group_name=resource_group.name, + container_app_name="str", + auth_config_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations.py new file mode 100644 index 000000000000..de15466e9fb8 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsBuildsByContainerAppOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.container_apps_builds_by_container_app.list( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations_async.py new file mode 100644 index 000000000000..88f9aa60204e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsBuildsByContainerAppOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.container_apps_builds_by_container_app.list( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations.py new file mode 100644 index 000000000000..b401d0208703 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsBuildsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.container_apps_builds.get( + resource_group_name=resource_group.name, + container_app_name="str", + build_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.container_apps_builds.begin_delete( + resource_group_name=resource_group.name, + container_app_name="str", + build_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations_async.py new file mode 100644 index 000000000000..d3686d69e48e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations_async.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsBuildsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.container_apps_builds.get( + resource_group_name=resource_group.name, + container_app_name="str", + build_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.container_apps_builds.begin_delete( + resource_group_name=resource_group.name, + container_app_name="str", + build_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations.py new file mode 100644 index 000000000000..6feb281ecca7 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations.py @@ -0,0 +1,81 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsDiagnosticsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_detectors(self, resource_group): + response = self.client.container_apps_diagnostics.list_detectors( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_detector(self, resource_group): + response = self.client.container_apps_diagnostics.get_detector( + resource_group_name=resource_group.name, + container_app_name="str", + detector_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_revisions(self, resource_group): + response = self.client.container_apps_diagnostics.list_revisions( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_revision(self, resource_group): + response = self.client.container_apps_diagnostics.get_revision( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_root(self, resource_group): + response = self.client.container_apps_diagnostics.get_root( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations_async.py new file mode 100644 index 000000000000..31469c25d996 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations_async.py @@ -0,0 +1,82 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsDiagnosticsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_detectors(self, resource_group): + response = self.client.container_apps_diagnostics.list_detectors( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_detector(self, resource_group): + response = await self.client.container_apps_diagnostics.get_detector( + resource_group_name=resource_group.name, + container_app_name="str", + detector_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_revisions(self, resource_group): + response = self.client.container_apps_diagnostics.list_revisions( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_revision(self, resource_group): + response = await self.client.container_apps_diagnostics.get_revision( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_root(self, resource_group): + response = await self.client.container_apps_diagnostics.get_root( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations.py new file mode 100644 index 000000000000..ebd45b7f54ea --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations.py @@ -0,0 +1,506 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.container_apps.list_by_subscription( + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.container_apps.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.container_apps.get( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.container_apps.begin_create_or_update( + resource_group_name=resource_group.name, + container_app_name="str", + container_app_envelope={ + "location": "str", + "configuration": { + "activeRevisionsMode": "Single", + "dapr": { + "appId": "str", + "appPort": 0, + "appProtocol": "http", + "enableApiLogging": bool, + "enabled": False, + "httpMaxRequestSize": 0, + "httpReadBufferSize": 0, + "logLevel": "str", + }, + "identitySettings": [{"identity": "str", "lifecycle": "All"}], + "ingress": { + "additionalPortMappings": [{"external": bool, "targetPort": 0, "exposedPort": 0}], + "allowInsecure": False, + "clientCertificateMode": "str", + "corsPolicy": { + "allowedOrigins": ["str"], + "allowCredentials": bool, + "allowedHeaders": ["str"], + "allowedMethods": ["str"], + "exposeHeaders": ["str"], + "maxAge": 0, + }, + "customDomains": [{"name": "str", "bindingType": "str", "certificateId": "str"}], + "exposedPort": 0, + "external": False, + "fqdn": "str", + "ipSecurityRestrictions": [ + {"action": "str", "ipAddressRange": "str", "name": "str", "description": "str"} + ], + "stickySessions": {"affinity": "str"}, + "targetPort": 0, + "targetPortHttpScheme": "str", + "traffic": [{"label": "str", "latestRevision": False, "revisionName": "str", "weight": 0}], + "transport": "auto", + }, + "maxInactiveRevisions": 0, + "registries": [{"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"}], + "runtime": { + "dotnet": {"autoConfigureDataProtection": bool}, + "java": { + "enableMetrics": bool, + "javaAgent": { + "enabled": bool, + "logging": {"loggerSettings": [{"level": "str", "logger": "str"}]}, + }, + }, + }, + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "service": {"type": "str"}, + }, + "customDomainVerificationId": "str", + "environmentId": "str", + "eventStreamEndpoint": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "latestReadyRevisionName": "str", + "latestRevisionFqdn": "str", + "latestRevisionName": "str", + "managedBy": "str", + "managedEnvironmentId": "str", + "name": "str", + "outboundIpAddresses": ["str"], + "patchingConfiguration": {"patchingMode": "str"}, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "template": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "imageType": "str", + "name": "str", + "probes": [ + { + "failureThreshold": 0, + "httpGet": { + "port": 0, + "host": "str", + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "tcpSocket": {"port": 0, "host": "str"}, + "terminationGracePeriodSeconds": 0, + "timeoutSeconds": 0, + "type": "str", + } + ], + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "initContainers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "imageType": "str", + "name": "str", + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "revisionSuffix": "str", + "scale": { + "maxReplicas": 10, + "minReplicas": 0, + "rules": [ + { + "azureQueue": { + "accountName": "str", + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", + "queueLength": 0, + "queueName": "str", + }, + "custom": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", + "metadata": {"str": "str"}, + "type": "str", + }, + "http": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", + "metadata": {"str": "str"}, + }, + "name": "str", + "tcp": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", + "metadata": {"str": "str"}, + }, + } + ], + }, + "serviceBinds": [ + {"clientType": "str", "customizedKeys": {"str": "str"}, "name": "str", "serviceId": "str"} + ], + "terminationGracePeriodSeconds": 0, + "volumes": [ + { + "mountOptions": "str", + "name": "str", + "secrets": [{"path": "str", "secretRef": "str"}], + "storageName": "str", + "storageType": "str", + } + ], + }, + "type": "str", + "workloadProfileName": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.container_apps.begin_delete( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.container_apps.begin_update( + resource_group_name=resource_group.name, + container_app_name="str", + container_app_envelope={ + "location": "str", + "configuration": { + "activeRevisionsMode": "Single", + "dapr": { + "appId": "str", + "appPort": 0, + "appProtocol": "http", + "enableApiLogging": bool, + "enabled": False, + "httpMaxRequestSize": 0, + "httpReadBufferSize": 0, + "logLevel": "str", + }, + "identitySettings": [{"identity": "str", "lifecycle": "All"}], + "ingress": { + "additionalPortMappings": [{"external": bool, "targetPort": 0, "exposedPort": 0}], + "allowInsecure": False, + "clientCertificateMode": "str", + "corsPolicy": { + "allowedOrigins": ["str"], + "allowCredentials": bool, + "allowedHeaders": ["str"], + "allowedMethods": ["str"], + "exposeHeaders": ["str"], + "maxAge": 0, + }, + "customDomains": [{"name": "str", "bindingType": "str", "certificateId": "str"}], + "exposedPort": 0, + "external": False, + "fqdn": "str", + "ipSecurityRestrictions": [ + {"action": "str", "ipAddressRange": "str", "name": "str", "description": "str"} + ], + "stickySessions": {"affinity": "str"}, + "targetPort": 0, + "targetPortHttpScheme": "str", + "traffic": [{"label": "str", "latestRevision": False, "revisionName": "str", "weight": 0}], + "transport": "auto", + }, + "maxInactiveRevisions": 0, + "registries": [{"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"}], + "runtime": { + "dotnet": {"autoConfigureDataProtection": bool}, + "java": { + "enableMetrics": bool, + "javaAgent": { + "enabled": bool, + "logging": {"loggerSettings": [{"level": "str", "logger": "str"}]}, + }, + }, + }, + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "service": {"type": "str"}, + }, + "customDomainVerificationId": "str", + "environmentId": "str", + "eventStreamEndpoint": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "latestReadyRevisionName": "str", + "latestRevisionFqdn": "str", + "latestRevisionName": "str", + "managedBy": "str", + "managedEnvironmentId": "str", + "name": "str", + "outboundIpAddresses": ["str"], + "patchingConfiguration": {"patchingMode": "str"}, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "template": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "imageType": "str", + "name": "str", + "probes": [ + { + "failureThreshold": 0, + "httpGet": { + "port": 0, + "host": "str", + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "tcpSocket": {"port": 0, "host": "str"}, + "terminationGracePeriodSeconds": 0, + "timeoutSeconds": 0, + "type": "str", + } + ], + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "initContainers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "imageType": "str", + "name": "str", + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "revisionSuffix": "str", + "scale": { + "maxReplicas": 10, + "minReplicas": 0, + "rules": [ + { + "azureQueue": { + "accountName": "str", + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", + "queueLength": 0, + "queueName": "str", + }, + "custom": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", + "metadata": {"str": "str"}, + "type": "str", + }, + "http": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", + "metadata": {"str": "str"}, + }, + "name": "str", + "tcp": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", + "metadata": {"str": "str"}, + }, + } + ], + }, + "serviceBinds": [ + {"clientType": "str", "customizedKeys": {"str": "str"}, "name": "str", "serviceId": "str"} + ], + "terminationGracePeriodSeconds": 0, + "volumes": [ + { + "mountOptions": "str", + "name": "str", + "secrets": [{"path": "str", "secretRef": "str"}], + "storageName": "str", + "storageType": "str", + } + ], + }, + "type": "str", + "workloadProfileName": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_custom_host_name_analysis(self, resource_group): + response = self.client.container_apps.list_custom_host_name_analysis( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_secrets(self, resource_group): + response = self.client.container_apps.list_secrets( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_auth_token(self, resource_group): + response = self.client.container_apps.get_auth_token( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_start(self, resource_group): + response = self.client.container_apps.begin_start( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_stop(self, resource_group): + response = self.client.container_apps.begin_stop( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations_async.py new file mode 100644 index 000000000000..778038b4b3cf --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations_async.py @@ -0,0 +1,521 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.container_apps.list_by_subscription( + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.container_apps.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.container_apps.get( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.container_apps.begin_create_or_update( + resource_group_name=resource_group.name, + container_app_name="str", + container_app_envelope={ + "location": "str", + "configuration": { + "activeRevisionsMode": "Single", + "dapr": { + "appId": "str", + "appPort": 0, + "appProtocol": "http", + "enableApiLogging": bool, + "enabled": False, + "httpMaxRequestSize": 0, + "httpReadBufferSize": 0, + "logLevel": "str", + }, + "identitySettings": [{"identity": "str", "lifecycle": "All"}], + "ingress": { + "additionalPortMappings": [{"external": bool, "targetPort": 0, "exposedPort": 0}], + "allowInsecure": False, + "clientCertificateMode": "str", + "corsPolicy": { + "allowedOrigins": ["str"], + "allowCredentials": bool, + "allowedHeaders": ["str"], + "allowedMethods": ["str"], + "exposeHeaders": ["str"], + "maxAge": 0, + }, + "customDomains": [{"name": "str", "bindingType": "str", "certificateId": "str"}], + "exposedPort": 0, + "external": False, + "fqdn": "str", + "ipSecurityRestrictions": [ + {"action": "str", "ipAddressRange": "str", "name": "str", "description": "str"} + ], + "stickySessions": {"affinity": "str"}, + "targetPort": 0, + "targetPortHttpScheme": "str", + "traffic": [{"label": "str", "latestRevision": False, "revisionName": "str", "weight": 0}], + "transport": "auto", + }, + "maxInactiveRevisions": 0, + "registries": [ + {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} + ], + "runtime": { + "dotnet": {"autoConfigureDataProtection": bool}, + "java": { + "enableMetrics": bool, + "javaAgent": { + "enabled": bool, + "logging": {"loggerSettings": [{"level": "str", "logger": "str"}]}, + }, + }, + }, + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "service": {"type": "str"}, + }, + "customDomainVerificationId": "str", + "environmentId": "str", + "eventStreamEndpoint": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "latestReadyRevisionName": "str", + "latestRevisionFqdn": "str", + "latestRevisionName": "str", + "managedBy": "str", + "managedEnvironmentId": "str", + "name": "str", + "outboundIpAddresses": ["str"], + "patchingConfiguration": {"patchingMode": "str"}, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "template": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "imageType": "str", + "name": "str", + "probes": [ + { + "failureThreshold": 0, + "httpGet": { + "port": 0, + "host": "str", + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "tcpSocket": {"port": 0, "host": "str"}, + "terminationGracePeriodSeconds": 0, + "timeoutSeconds": 0, + "type": "str", + } + ], + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "initContainers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "imageType": "str", + "name": "str", + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "revisionSuffix": "str", + "scale": { + "maxReplicas": 10, + "minReplicas": 0, + "rules": [ + { + "azureQueue": { + "accountName": "str", + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", + "queueLength": 0, + "queueName": "str", + }, + "custom": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", + "metadata": {"str": "str"}, + "type": "str", + }, + "http": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", + "metadata": {"str": "str"}, + }, + "name": "str", + "tcp": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", + "metadata": {"str": "str"}, + }, + } + ], + }, + "serviceBinds": [ + {"clientType": "str", "customizedKeys": {"str": "str"}, "name": "str", "serviceId": "str"} + ], + "terminationGracePeriodSeconds": 0, + "volumes": [ + { + "mountOptions": "str", + "name": "str", + "secrets": [{"path": "str", "secretRef": "str"}], + "storageName": "str", + "storageType": "str", + } + ], + }, + "type": "str", + "workloadProfileName": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.container_apps.begin_delete( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.container_apps.begin_update( + resource_group_name=resource_group.name, + container_app_name="str", + container_app_envelope={ + "location": "str", + "configuration": { + "activeRevisionsMode": "Single", + "dapr": { + "appId": "str", + "appPort": 0, + "appProtocol": "http", + "enableApiLogging": bool, + "enabled": False, + "httpMaxRequestSize": 0, + "httpReadBufferSize": 0, + "logLevel": "str", + }, + "identitySettings": [{"identity": "str", "lifecycle": "All"}], + "ingress": { + "additionalPortMappings": [{"external": bool, "targetPort": 0, "exposedPort": 0}], + "allowInsecure": False, + "clientCertificateMode": "str", + "corsPolicy": { + "allowedOrigins": ["str"], + "allowCredentials": bool, + "allowedHeaders": ["str"], + "allowedMethods": ["str"], + "exposeHeaders": ["str"], + "maxAge": 0, + }, + "customDomains": [{"name": "str", "bindingType": "str", "certificateId": "str"}], + "exposedPort": 0, + "external": False, + "fqdn": "str", + "ipSecurityRestrictions": [ + {"action": "str", "ipAddressRange": "str", "name": "str", "description": "str"} + ], + "stickySessions": {"affinity": "str"}, + "targetPort": 0, + "targetPortHttpScheme": "str", + "traffic": [{"label": "str", "latestRevision": False, "revisionName": "str", "weight": 0}], + "transport": "auto", + }, + "maxInactiveRevisions": 0, + "registries": [ + {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} + ], + "runtime": { + "dotnet": {"autoConfigureDataProtection": bool}, + "java": { + "enableMetrics": bool, + "javaAgent": { + "enabled": bool, + "logging": {"loggerSettings": [{"level": "str", "logger": "str"}]}, + }, + }, + }, + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "service": {"type": "str"}, + }, + "customDomainVerificationId": "str", + "environmentId": "str", + "eventStreamEndpoint": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "latestReadyRevisionName": "str", + "latestRevisionFqdn": "str", + "latestRevisionName": "str", + "managedBy": "str", + "managedEnvironmentId": "str", + "name": "str", + "outboundIpAddresses": ["str"], + "patchingConfiguration": {"patchingMode": "str"}, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "template": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "imageType": "str", + "name": "str", + "probes": [ + { + "failureThreshold": 0, + "httpGet": { + "port": 0, + "host": "str", + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "tcpSocket": {"port": 0, "host": "str"}, + "terminationGracePeriodSeconds": 0, + "timeoutSeconds": 0, + "type": "str", + } + ], + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "initContainers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "imageType": "str", + "name": "str", + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "revisionSuffix": "str", + "scale": { + "maxReplicas": 10, + "minReplicas": 0, + "rules": [ + { + "azureQueue": { + "accountName": "str", + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", + "queueLength": 0, + "queueName": "str", + }, + "custom": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", + "metadata": {"str": "str"}, + "type": "str", + }, + "http": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", + "metadata": {"str": "str"}, + }, + "name": "str", + "tcp": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", + "metadata": {"str": "str"}, + }, + } + ], + }, + "serviceBinds": [ + {"clientType": "str", "customizedKeys": {"str": "str"}, "name": "str", "serviceId": "str"} + ], + "terminationGracePeriodSeconds": 0, + "volumes": [ + { + "mountOptions": "str", + "name": "str", + "secrets": [{"path": "str", "secretRef": "str"}], + "storageName": "str", + "storageType": "str", + } + ], + }, + "type": "str", + "workloadProfileName": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_custom_host_name_analysis(self, resource_group): + response = await self.client.container_apps.list_custom_host_name_analysis( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_secrets(self, resource_group): + response = await self.client.container_apps.list_secrets( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_auth_token(self, resource_group): + response = await self.client.container_apps.get_auth_token( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_start(self, resource_group): + response = await ( + await self.client.container_apps.begin_start( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_stop(self, resource_group): + response = await ( + await self.client.container_apps.begin_stop( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations.py new file mode 100644 index 000000000000..066218350cda --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations.py @@ -0,0 +1,84 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsPatchesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_container_app(self, resource_group): + response = self.client.container_apps_patches.list_by_container_app( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.container_apps_patches.get( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.container_apps_patches.begin_delete( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_skip_configure(self, resource_group): + response = self.client.container_apps_patches.begin_skip_configure( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + patch_skip_config={"skip": bool}, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_apply(self, resource_group): + response = self.client.container_apps_patches.begin_apply( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations_async.py new file mode 100644 index 000000000000..ceffcba02976 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations_async.py @@ -0,0 +1,91 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsPatchesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_container_app(self, resource_group): + response = self.client.container_apps_patches.list_by_container_app( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.container_apps_patches.get( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.container_apps_patches.begin_delete( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_skip_configure(self, resource_group): + response = await ( + await self.client.container_apps_patches.begin_skip_configure( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + patch_skip_config={"skip": bool}, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_apply(self, resource_group): + response = await ( + await self.client.container_apps_patches.begin_apply( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations.py new file mode 100644 index 000000000000..2a146342491d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsRevisionReplicasOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_replica(self, resource_group): + response = self.client.container_apps_revision_replicas.get_replica( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + replica_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_replicas(self, resource_group): + response = self.client.container_apps_revision_replicas.list_replicas( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations_async.py new file mode 100644 index 000000000000..2057852c3796 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations_async.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsRevisionReplicasOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_replica(self, resource_group): + response = await self.client.container_apps_revision_replicas.get_replica( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + replica_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_replicas(self, resource_group): + response = await self.client.container_apps_revision_replicas.list_replicas( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations.py new file mode 100644 index 000000000000..94d92dbc0bfb --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations.py @@ -0,0 +1,83 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsRevisionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_revisions(self, resource_group): + response = self.client.container_apps_revisions.list_revisions( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_revision(self, resource_group): + response = self.client.container_apps_revisions.get_revision( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_activate_revision(self, resource_group): + response = self.client.container_apps_revisions.activate_revision( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_deactivate_revision(self, resource_group): + response = self.client.container_apps_revisions.deactivate_revision( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_restart_revision(self, resource_group): + response = self.client.container_apps_revisions.restart_revision( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations_async.py new file mode 100644 index 000000000000..a1947378e9ec --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations_async.py @@ -0,0 +1,84 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsRevisionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_revisions(self, resource_group): + response = self.client.container_apps_revisions.list_revisions( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_revision(self, resource_group): + response = await self.client.container_apps_revisions.get_revision( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_activate_revision(self, resource_group): + response = await self.client.container_apps_revisions.activate_revision( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_deactivate_revision(self, resource_group): + response = await self.client.container_apps_revisions.deactivate_revision( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_restart_revision(self, resource_group): + response = await self.client.container_apps_revisions.restart_revision( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations.py new file mode 100644 index 000000000000..fe85a5d8acf1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations.py @@ -0,0 +1,143 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsSessionPoolsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.container_apps_session_pools.list_by_subscription( + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.container_apps_session_pools.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.container_apps_session_pools.get( + resource_group_name=resource_group.name, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.container_apps_session_pools.begin_create_or_update( + resource_group_name=resource_group.name, + session_pool_envelope={ + "location": "str", + "containerType": "str", + "customContainerTemplate": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "memory": "str"}, + } + ], + "ingress": {"targetPort": 0}, + "registryCredentials": {"passwordSecretRef": "str", "registryServer": "str", "username": "str"}, + }, + "dynamicPoolConfiguration": {"cooldownPeriodInSeconds": 0, "executionType": "str"}, + "environmentId": "str", + "id": "str", + "name": "str", + "nodeCount": 0, + "poolManagementEndpoint": "str", + "poolManagementType": "str", + "provisioningState": "str", + "scaleConfiguration": {"maxConcurrentSessions": 0, "readySessionInstances": 0}, + "secrets": [{"name": "str", "value": "str"}], + "sessionNetworkConfiguration": {"status": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.container_apps_session_pools.begin_update( + resource_group_name=resource_group.name, + session_pool_envelope={ + "customContainerTemplate": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "memory": "str"}, + } + ], + "ingress": {"targetPort": 0}, + "registryCredentials": {"passwordSecretRef": "str", "registryServer": "str", "username": "str"}, + }, + "dynamicPoolConfiguration": {"cooldownPeriodInSeconds": 0, "executionType": "str"}, + "scaleConfiguration": {"maxConcurrentSessions": 0, "readySessionInstances": 0}, + "secrets": [{"name": "str", "value": "str"}], + "sessionNetworkConfiguration": {"status": "str"}, + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.container_apps_session_pools.begin_delete( + resource_group_name=resource_group.name, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations_async.py new file mode 100644 index 000000000000..b1a60f9c99a1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations_async.py @@ -0,0 +1,150 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsSessionPoolsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.container_apps_session_pools.list_by_subscription( + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.container_apps_session_pools.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.container_apps_session_pools.get( + resource_group_name=resource_group.name, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.container_apps_session_pools.begin_create_or_update( + resource_group_name=resource_group.name, + session_pool_envelope={ + "location": "str", + "containerType": "str", + "customContainerTemplate": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "memory": "str"}, + } + ], + "ingress": {"targetPort": 0}, + "registryCredentials": {"passwordSecretRef": "str", "registryServer": "str", "username": "str"}, + }, + "dynamicPoolConfiguration": {"cooldownPeriodInSeconds": 0, "executionType": "str"}, + "environmentId": "str", + "id": "str", + "name": "str", + "nodeCount": 0, + "poolManagementEndpoint": "str", + "poolManagementType": "str", + "provisioningState": "str", + "scaleConfiguration": {"maxConcurrentSessions": 0, "readySessionInstances": 0}, + "secrets": [{"name": "str", "value": "str"}], + "sessionNetworkConfiguration": {"status": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.container_apps_session_pools.begin_update( + resource_group_name=resource_group.name, + session_pool_envelope={ + "customContainerTemplate": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "memory": "str"}, + } + ], + "ingress": {"targetPort": 0}, + "registryCredentials": {"passwordSecretRef": "str", "registryServer": "str", "username": "str"}, + }, + "dynamicPoolConfiguration": {"cooldownPeriodInSeconds": 0, "executionType": "str"}, + "scaleConfiguration": {"maxConcurrentSessions": 0, "readySessionInstances": 0}, + "secrets": [{"name": "str", "value": "str"}], + "sessionNetworkConfiguration": {"status": "str"}, + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.container_apps_session_pools.begin_delete( + resource_group_name=resource_group.name, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations.py new file mode 100644 index 000000000000..2d9e46c748b4 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations.py @@ -0,0 +1,106 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsSourceControlsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_container_app(self, resource_group): + response = self.client.container_apps_source_controls.list_by_container_app( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.container_apps_source_controls.get( + resource_group_name=resource_group.name, + container_app_name="str", + source_control_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.container_apps_source_controls.begin_create_or_update( + resource_group_name=resource_group.name, + container_app_name="str", + source_control_name="str", + x_ms_github_auxiliary="str", + source_control_envelope={ + "branch": "str", + "githubActionConfiguration": { + "azureCredentials": { + "clientId": "str", + "clientSecret": "str", + "kind": "str", + "subscriptionId": "str", + "tenantId": "str", + }, + "buildEnvironmentVariables": [{"name": "str", "value": "str"}], + "contextPath": "str", + "githubPersonalAccessToken": "str", + "image": "str", + "os": "str", + "publishType": "str", + "registryInfo": {"registryPassword": "str", "registryUrl": "str", "registryUserName": "str"}, + "runtimeStack": "str", + "runtimeVersion": "str", + }, + "id": "str", + "name": "str", + "operationState": "str", + "repoUrl": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.container_apps_source_controls.begin_delete( + resource_group_name=resource_group.name, + container_app_name="str", + source_control_name="str", + x_ms_github_auxiliary="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations_async.py new file mode 100644 index 000000000000..b300e1f8d356 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations_async.py @@ -0,0 +1,111 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsSourceControlsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_container_app(self, resource_group): + response = self.client.container_apps_source_controls.list_by_container_app( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.container_apps_source_controls.get( + resource_group_name=resource_group.name, + container_app_name="str", + source_control_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.container_apps_source_controls.begin_create_or_update( + resource_group_name=resource_group.name, + container_app_name="str", + source_control_name="str", + x_ms_github_auxiliary="str", + source_control_envelope={ + "branch": "str", + "githubActionConfiguration": { + "azureCredentials": { + "clientId": "str", + "clientSecret": "str", + "kind": "str", + "subscriptionId": "str", + "tenantId": "str", + }, + "buildEnvironmentVariables": [{"name": "str", "value": "str"}], + "contextPath": "str", + "githubPersonalAccessToken": "str", + "image": "str", + "os": "str", + "publishType": "str", + "registryInfo": {"registryPassword": "str", "registryUrl": "str", "registryUserName": "str"}, + "runtimeStack": "str", + "runtimeVersion": "str", + }, + "id": "str", + "name": "str", + "operationState": "str", + "repoUrl": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.container_apps_source_controls.begin_delete( + resource_group_name=resource_group.name, + container_app_name="str", + source_control_name="str", + x_ms_github_auxiliary="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations.py new file mode 100644 index 000000000000..3147d365491d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations.py @@ -0,0 +1,103 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDaprComponentResiliencyPoliciesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.dapr_component_resiliency_policies.list( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.dapr_component_resiliency_policies.get( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.dapr_component_resiliency_policies.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + name="str", + dapr_component_resiliency_policy_envelope={ + "id": "str", + "inboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "timeoutInSeconds": 0}, + "httpRetryPolicy": { + "maxRetries": 0, + "retryBackOff": {"initialDelayInMilliseconds": 0, "maxIntervalInMilliseconds": 0}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 0}, + }, + "name": "str", + "outboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "timeoutInSeconds": 0}, + "httpRetryPolicy": { + "maxRetries": 0, + "retryBackOff": {"initialDelayInMilliseconds": 0, "maxIntervalInMilliseconds": 0}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 0}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.dapr_component_resiliency_policies.delete( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations_async.py new file mode 100644 index 000000000000..fc06f53a0604 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations_async.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDaprComponentResiliencyPoliciesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.dapr_component_resiliency_policies.list( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.dapr_component_resiliency_policies.get( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.dapr_component_resiliency_policies.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + name="str", + dapr_component_resiliency_policy_envelope={ + "id": "str", + "inboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "timeoutInSeconds": 0}, + "httpRetryPolicy": { + "maxRetries": 0, + "retryBackOff": {"initialDelayInMilliseconds": 0, "maxIntervalInMilliseconds": 0}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 0}, + }, + "name": "str", + "outboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "timeoutInSeconds": 0}, + "httpRetryPolicy": { + "maxRetries": 0, + "retryBackOff": {"initialDelayInMilliseconds": 0, "maxIntervalInMilliseconds": 0}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 0}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.dapr_component_resiliency_policies.delete( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations.py new file mode 100644 index 000000000000..bbd3070f070f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations.py @@ -0,0 +1,107 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDaprComponentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.dapr_components.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.dapr_components.get( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.dapr_components.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + dapr_component_envelope={ + "componentType": "str", + "id": "str", + "ignoreErrors": False, + "initTimeout": "str", + "metadata": [{"name": "str", "secretRef": "str", "value": "str"}], + "name": "str", + "scopes": ["str"], + "secretStoreComponent": "str", + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "serviceComponentBind": [ + {"metadata": {"name": "str", "value": "str"}, "name": "str", "serviceId": "str"} + ], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + "version": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.dapr_components.delete( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_secrets(self, resource_group): + response = self.client.dapr_components.list_secrets( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations_async.py new file mode 100644 index 000000000000..59f9d86584b9 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations_async.py @@ -0,0 +1,108 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDaprComponentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.dapr_components.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.dapr_components.get( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.dapr_components.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + dapr_component_envelope={ + "componentType": "str", + "id": "str", + "ignoreErrors": False, + "initTimeout": "str", + "metadata": [{"name": "str", "secretRef": "str", "value": "str"}], + "name": "str", + "scopes": ["str"], + "secretStoreComponent": "str", + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "serviceComponentBind": [ + {"metadata": {"name": "str", "value": "str"}, "name": "str", "serviceId": "str"} + ], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + "version": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.dapr_components.delete( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_secrets(self, resource_group): + response = await self.client.dapr_components.list_secrets( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations.py new file mode 100644 index 000000000000..49197250bc40 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations.py @@ -0,0 +1,90 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDaprSubscriptionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.dapr_subscriptions.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.dapr_subscriptions.get( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.dapr_subscriptions.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + dapr_subscription_envelope={ + "bulkSubscribe": {"enabled": False, "maxAwaitDurationMs": 0, "maxMessagesCount": 0}, + "deadLetterTopic": "str", + "id": "str", + "metadata": {"str": "str"}, + "name": "str", + "pubsubName": "str", + "routes": {"default": "str", "rules": [{"match": "str", "path": "str"}]}, + "scopes": ["str"], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topic": "str", + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.dapr_subscriptions.delete( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations_async.py new file mode 100644 index 000000000000..9038a3c23b75 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations_async.py @@ -0,0 +1,91 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDaprSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.dapr_subscriptions.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.dapr_subscriptions.get( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.dapr_subscriptions.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + dapr_subscription_envelope={ + "bulkSubscribe": {"enabled": False, "maxAwaitDurationMs": 0, "maxMessagesCount": 0}, + "deadLetterTopic": "str", + "id": "str", + "metadata": {"str": "str"}, + "name": "str", + "pubsubName": "str", + "routes": {"default": "str", "rules": [{"match": "str", "path": "str"}]}, + "scopes": ["str"], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topic": "str", + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.dapr_subscriptions.delete( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations.py new file mode 100644 index 000000000000..72a4e436436f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations.py @@ -0,0 +1,117 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDotNetComponentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.dot_net_components.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.dot_net_components.get( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.dot_net_components.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + dot_net_component_envelope={ + "componentType": "str", + "configurations": [{"propertyName": "str", "value": "str"}], + "id": "str", + "name": "str", + "provisioningState": "str", + "serviceBinds": [{"name": "str", "serviceId": "str"}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.dot_net_components.begin_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + dot_net_component_envelope={ + "componentType": "str", + "configurations": [{"propertyName": "str", "value": "str"}], + "id": "str", + "name": "str", + "provisioningState": "str", + "serviceBinds": [{"name": "str", "serviceId": "str"}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.dot_net_components.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations_async.py new file mode 100644 index 000000000000..1e6a8021baa2 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations_async.py @@ -0,0 +1,124 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDotNetComponentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.dot_net_components.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.dot_net_components.get( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.dot_net_components.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + dot_net_component_envelope={ + "componentType": "str", + "configurations": [{"propertyName": "str", "value": "str"}], + "id": "str", + "name": "str", + "provisioningState": "str", + "serviceBinds": [{"name": "str", "serviceId": "str"}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.dot_net_components.begin_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + dot_net_component_envelope={ + "componentType": "str", + "configurations": [{"propertyName": "str", "value": "str"}], + "id": "str", + "name": "str", + "provisioningState": "str", + "serviceBinds": [{"name": "str", "serviceId": "str"}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.dot_net_components.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations.py new file mode 100644 index 000000000000..743c92817f33 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIFunctionsExtensionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_invoke_functions_host(self, resource_group): + response = self.client.functions_extension.invoke_functions_host( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + function_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations_async.py new file mode 100644 index 000000000000..7601b17d79b5 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations_async.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIFunctionsExtensionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_invoke_functions_host(self, resource_group): + response = await self.client.functions_extension.invoke_functions_host( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + function_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations.py new file mode 100644 index 000000000000..3e2beb5bccf3 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations.py @@ -0,0 +1,111 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIJavaComponentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.java_components.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.java_components.get( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.java_components.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + java_component_envelope={ + "id": "str", + "name": "str", + "properties": "java_component_properties", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.java_components.begin_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + java_component_envelope={ + "id": "str", + "name": "str", + "properties": "java_component_properties", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.java_components.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations_async.py new file mode 100644 index 000000000000..afe090122714 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations_async.py @@ -0,0 +1,118 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIJavaComponentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.java_components.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.java_components.get( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.java_components.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + java_component_envelope={ + "id": "str", + "name": "str", + "properties": "java_component_properties", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.java_components.begin_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + java_component_envelope={ + "id": "str", + "name": "str", + "properties": "java_component_properties", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.java_components.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations.py new file mode 100644 index 000000000000..c2e31ca66ea3 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIJobsExecutionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.jobs_executions.list( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations_async.py new file mode 100644 index 000000000000..3bc443073725 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIJobsExecutionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.jobs_executions.list( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations.py new file mode 100644 index 000000000000..9c704f3ed70c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations.py @@ -0,0 +1,387 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIJobsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_detectors(self, resource_group): + response = self.client.jobs.list_detectors( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_detector(self, resource_group): + response = self.client.jobs.get_detector( + resource_group_name=resource_group.name, + job_name="str", + detector_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_proxy_get(self, resource_group): + response = self.client.jobs.proxy_get( + resource_group_name=resource_group.name, + job_name="str", + api_name="rootApi", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.jobs.list_by_subscription( + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.jobs.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.jobs.get( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.jobs.begin_create_or_update( + resource_group_name=resource_group.name, + job_name="str", + job_envelope={ + "location": "str", + "configuration": { + "replicaTimeout": 0, + "triggerType": "Manual", + "eventTriggerConfig": { + "parallelism": 0, + "replicaCompletionCount": 0, + "scale": { + "maxExecutions": 100, + "minExecutions": 0, + "pollingInterval": 0, + "rules": [ + { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", + "metadata": {}, + "name": "str", + "type": "str", + } + ], + }, + }, + "identitySettings": [{"identity": "str", "lifecycle": "All"}], + "manualTriggerConfig": {"parallelism": 0, "replicaCompletionCount": 0}, + "registries": [{"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"}], + "replicaRetryLimit": 0, + "scheduleTriggerConfig": {"cronExpression": "str", "parallelism": 0, "replicaCompletionCount": 0}, + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + }, + "environmentId": "str", + "eventStreamEndpoint": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "outboundIpAddresses": ["str"], + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "template": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "imageType": "str", + "name": "str", + "probes": [ + { + "failureThreshold": 0, + "httpGet": { + "port": 0, + "host": "str", + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "tcpSocket": {"port": 0, "host": "str"}, + "terminationGracePeriodSeconds": 0, + "timeoutSeconds": 0, + "type": "str", + } + ], + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "initContainers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "imageType": "str", + "name": "str", + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "volumes": [ + { + "mountOptions": "str", + "name": "str", + "secrets": [{"path": "str", "secretRef": "str"}], + "storageName": "str", + "storageType": "str", + } + ], + }, + "type": "str", + "workloadProfileName": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.jobs.begin_delete( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.jobs.begin_update( + resource_group_name=resource_group.name, + job_name="str", + job_envelope={ + "extendedLocation": {"name": "str", "type": "str"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "configuration": { + "replicaTimeout": 0, + "triggerType": "Manual", + "eventTriggerConfig": { + "parallelism": 0, + "replicaCompletionCount": 0, + "scale": { + "maxExecutions": 100, + "minExecutions": 0, + "pollingInterval": 0, + "rules": [ + { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", + "metadata": {}, + "name": "str", + "type": "str", + } + ], + }, + }, + "identitySettings": [{"identity": "str", "lifecycle": "All"}], + "manualTriggerConfig": {"parallelism": 0, "replicaCompletionCount": 0}, + "registries": [ + {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} + ], + "replicaRetryLimit": 0, + "scheduleTriggerConfig": { + "cronExpression": "str", + "parallelism": 0, + "replicaCompletionCount": 0, + }, + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + }, + "environmentId": "str", + "eventStreamEndpoint": "str", + "outboundIpAddresses": ["str"], + "template": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "imageType": "str", + "name": "str", + "probes": [ + { + "failureThreshold": 0, + "httpGet": { + "port": 0, + "host": "str", + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "tcpSocket": {"port": 0, "host": "str"}, + "terminationGracePeriodSeconds": 0, + "timeoutSeconds": 0, + "type": "str", + } + ], + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "initContainers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "imageType": "str", + "name": "str", + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "volumes": [ + { + "mountOptions": "str", + "name": "str", + "secrets": [{"path": "str", "secretRef": "str"}], + "storageName": "str", + "storageType": "str", + } + ], + }, + }, + "tags": {"str": "str"}, + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_start(self, resource_group): + response = self.client.jobs.begin_start( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_stop_execution(self, resource_group): + response = self.client.jobs.begin_stop_execution( + resource_group_name=resource_group.name, + job_name="str", + job_execution_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_stop_multiple_executions(self, resource_group): + response = self.client.jobs.begin_stop_multiple_executions( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_secrets(self, resource_group): + response = self.client.jobs.list_secrets( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations_async.py new file mode 100644 index 000000000000..5ff218416109 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations_async.py @@ -0,0 +1,406 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIJobsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_detectors(self, resource_group): + response = self.client.jobs.list_detectors( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_detector(self, resource_group): + response = await self.client.jobs.get_detector( + resource_group_name=resource_group.name, + job_name="str", + detector_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_proxy_get(self, resource_group): + response = await self.client.jobs.proxy_get( + resource_group_name=resource_group.name, + job_name="str", + api_name="rootApi", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.jobs.list_by_subscription( + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.jobs.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.jobs.get( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.jobs.begin_create_or_update( + resource_group_name=resource_group.name, + job_name="str", + job_envelope={ + "location": "str", + "configuration": { + "replicaTimeout": 0, + "triggerType": "Manual", + "eventTriggerConfig": { + "parallelism": 0, + "replicaCompletionCount": 0, + "scale": { + "maxExecutions": 100, + "minExecutions": 0, + "pollingInterval": 0, + "rules": [ + { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", + "metadata": {}, + "name": "str", + "type": "str", + } + ], + }, + }, + "identitySettings": [{"identity": "str", "lifecycle": "All"}], + "manualTriggerConfig": {"parallelism": 0, "replicaCompletionCount": 0}, + "registries": [ + {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} + ], + "replicaRetryLimit": 0, + "scheduleTriggerConfig": { + "cronExpression": "str", + "parallelism": 0, + "replicaCompletionCount": 0, + }, + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + }, + "environmentId": "str", + "eventStreamEndpoint": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "outboundIpAddresses": ["str"], + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "template": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "imageType": "str", + "name": "str", + "probes": [ + { + "failureThreshold": 0, + "httpGet": { + "port": 0, + "host": "str", + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "tcpSocket": {"port": 0, "host": "str"}, + "terminationGracePeriodSeconds": 0, + "timeoutSeconds": 0, + "type": "str", + } + ], + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "initContainers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "imageType": "str", + "name": "str", + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "volumes": [ + { + "mountOptions": "str", + "name": "str", + "secrets": [{"path": "str", "secretRef": "str"}], + "storageName": "str", + "storageType": "str", + } + ], + }, + "type": "str", + "workloadProfileName": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.jobs.begin_delete( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.jobs.begin_update( + resource_group_name=resource_group.name, + job_name="str", + job_envelope={ + "extendedLocation": {"name": "str", "type": "str"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "configuration": { + "replicaTimeout": 0, + "triggerType": "Manual", + "eventTriggerConfig": { + "parallelism": 0, + "replicaCompletionCount": 0, + "scale": { + "maxExecutions": 100, + "minExecutions": 0, + "pollingInterval": 0, + "rules": [ + { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", + "metadata": {}, + "name": "str", + "type": "str", + } + ], + }, + }, + "identitySettings": [{"identity": "str", "lifecycle": "All"}], + "manualTriggerConfig": {"parallelism": 0, "replicaCompletionCount": 0}, + "registries": [ + {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} + ], + "replicaRetryLimit": 0, + "scheduleTriggerConfig": { + "cronExpression": "str", + "parallelism": 0, + "replicaCompletionCount": 0, + }, + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + }, + "environmentId": "str", + "eventStreamEndpoint": "str", + "outboundIpAddresses": ["str"], + "template": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "imageType": "str", + "name": "str", + "probes": [ + { + "failureThreshold": 0, + "httpGet": { + "port": 0, + "host": "str", + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "tcpSocket": {"port": 0, "host": "str"}, + "terminationGracePeriodSeconds": 0, + "timeoutSeconds": 0, + "type": "str", + } + ], + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "initContainers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "imageType": "str", + "name": "str", + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "volumes": [ + { + "mountOptions": "str", + "name": "str", + "secrets": [{"path": "str", "secretRef": "str"}], + "storageName": "str", + "storageType": "str", + } + ], + }, + }, + "tags": {"str": "str"}, + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_start(self, resource_group): + response = await ( + await self.client.jobs.begin_start( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_stop_execution(self, resource_group): + response = await ( + await self.client.jobs.begin_stop_execution( + resource_group_name=resource_group.name, + job_name="str", + job_execution_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_stop_multiple_executions(self, resource_group): + response = await ( + await self.client.jobs.begin_stop_multiple_executions( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_secrets(self, resource_group): + response = await self.client.jobs.list_secrets( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations.py new file mode 100644 index 000000000000..1d4536c74063 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations.py @@ -0,0 +1,140 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPILogicAppsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.logic_apps.get( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.logic_apps.create_or_update( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + resource={ + "id": "str", + "name": "str", + "properties": {}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.logic_apps.delete( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_workflows(self, resource_group): + response = self.client.logic_apps.list_workflows( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_workflow(self, resource_group): + response = self.client.logic_apps.get_workflow( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + workflow_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_deploy_workflow_artifacts(self, resource_group): + response = self.client.logic_apps.deploy_workflow_artifacts( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_workflows_connections(self, resource_group): + response = self.client.logic_apps.list_workflows_connections( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_invoke(self, resource_group): + response = self.client.logic_apps.invoke( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + x_ms_logic_apps_proxy_path="str", + x_ms_logic_apps_proxy_method="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations_async.py new file mode 100644 index 000000000000..76a868a54901 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations_async.py @@ -0,0 +1,141 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPILogicAppsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.logic_apps.get( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.logic_apps.create_or_update( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + resource={ + "id": "str", + "name": "str", + "properties": {}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.logic_apps.delete( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_workflows(self, resource_group): + response = self.client.logic_apps.list_workflows( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_workflow(self, resource_group): + response = await self.client.logic_apps.get_workflow( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + workflow_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_deploy_workflow_artifacts(self, resource_group): + response = await self.client.logic_apps.deploy_workflow_artifacts( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_workflows_connections(self, resource_group): + response = await self.client.logic_apps.list_workflows_connections( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_invoke(self, resource_group): + response = await self.client.logic_apps.invoke( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + x_ms_logic_apps_proxy_path="str", + x_ms_logic_apps_proxy_method="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations.py new file mode 100644 index 000000000000..15cb79a15a31 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations.py @@ -0,0 +1,84 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedCertificatesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.managed_certificates.get( + resource_group_name=resource_group.name, + environment_name="str", + managed_certificate_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.managed_certificates.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + managed_certificate_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.managed_certificates.delete( + resource_group_name=resource_group.name, + environment_name="str", + managed_certificate_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.managed_certificates.update( + resource_group_name=resource_group.name, + environment_name="str", + managed_certificate_name="str", + managed_certificate_envelope={"tags": {"str": "str"}}, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.managed_certificates.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations_async.py new file mode 100644 index 000000000000..aa2880913e1e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations_async.py @@ -0,0 +1,87 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedCertificatesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.managed_certificates.get( + resource_group_name=resource_group.name, + environment_name="str", + managed_certificate_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.managed_certificates.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + managed_certificate_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.managed_certificates.delete( + resource_group_name=resource_group.name, + environment_name="str", + managed_certificate_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.managed_certificates.update( + resource_group_name=resource_group.name, + environment_name="str", + managed_certificate_name="str", + managed_certificate_envelope={"tags": {"str": "str"}}, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.managed_certificates.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations.py new file mode 100644 index 000000000000..e99594c282e9 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentDiagnosticsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_detectors(self, resource_group): + response = self.client.managed_environment_diagnostics.list_detectors( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_detector(self, resource_group): + response = self.client.managed_environment_diagnostics.get_detector( + resource_group_name=resource_group.name, + environment_name="str", + detector_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations_async.py new file mode 100644 index 000000000000..b9e3e94e8464 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations_async.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentDiagnosticsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_detectors(self, resource_group): + response = await self.client.managed_environment_diagnostics.list_detectors( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_detector(self, resource_group): + response = await self.client.managed_environment_diagnostics.get_detector( + resource_group_name=resource_group.name, + environment_name="str", + detector_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..44b9aa6dbcc2 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations.py @@ -0,0 +1,87 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.managed_environment_private_endpoint_connections.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.managed_environment_private_endpoint_connections.get( + resource_group_name=resource_group.name, + environment_name="str", + private_endpoint_connection_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.managed_environment_private_endpoint_connections.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + private_endpoint_connection_name="str", + private_endpoint_connection_envelope={ + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.managed_environment_private_endpoint_connections.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + private_endpoint_connection_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations_async.py new file mode 100644 index 000000000000..ea026b11caf3 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations_async.py @@ -0,0 +1,96 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentPrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.managed_environment_private_endpoint_connections.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.managed_environment_private_endpoint_connections.get( + resource_group_name=resource_group.name, + environment_name="str", + private_endpoint_connection_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.managed_environment_private_endpoint_connections.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + private_endpoint_connection_name="str", + private_endpoint_connection_envelope={ + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.managed_environment_private_endpoint_connections.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + private_endpoint_connection_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations.py new file mode 100644 index 000000000000..297c7238aa80 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentPrivateLinkResourcesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.managed_environment_private_link_resources.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations_async.py new file mode 100644 index 000000000000..74a629c4ff43 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentPrivateLinkResourcesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.managed_environment_private_link_resources.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations.py new file mode 100644 index 000000000000..849c8b722162 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentUsagesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.managed_environment_usages.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations_async.py new file mode 100644 index 000000000000..92e527da68b4 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentUsagesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.managed_environment_usages.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations.py new file mode 100644 index 000000000000..10da13959b88 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentsDiagnosticsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_root(self, resource_group): + response = self.client.managed_environments_diagnostics.get_root( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations_async.py new file mode 100644 index 000000000000..62bd4fd73518 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentsDiagnosticsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_root(self, resource_group): + response = await self.client.managed_environments_diagnostics.get_root( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations.py new file mode 100644 index 000000000000..c3104653b04f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations.py @@ -0,0 +1,312 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.managed_environments.list_by_subscription( + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.managed_environments.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.managed_environments.get( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.managed_environments.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + environment_envelope={ + "location": "str", + "appInsightsConfiguration": {"connectionString": "str"}, + "appLogsConfiguration": { + "destination": "str", + "logAnalyticsConfiguration": {"customerId": "str", "dynamicJsonColumns": bool, "sharedKey": "str"}, + }, + "customDomainConfiguration": { + "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, + "certificatePassword": "str", + "certificateValue": bytes("bytes", encoding="utf-8"), + "customDomainVerificationId": "str", + "dnsSuffix": "str", + "expirationDate": "2020-02-20 00:00:00", + "subjectName": "str", + "thumbprint": "str", + }, + "daprAIConnectionString": "str", + "daprAIInstrumentationKey": "str", + "daprConfiguration": {"version": "str"}, + "defaultDomain": "str", + "deploymentErrors": "str", + "eventStreamEndpoint": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "infrastructureResourceGroup": "str", + "kedaConfiguration": {"version": "str"}, + "kind": "str", + "name": "str", + "openTelemetryConfiguration": { + "destinationsConfiguration": { + "dataDogConfiguration": {"key": "str", "site": "str"}, + "otlpConfigurations": [ + { + "endpoint": "str", + "headers": [{"key": "str", "value": "str"}], + "insecure": bool, + "name": "str", + } + ], + }, + "logsConfiguration": {"destinations": ["str"]}, + "metricsConfiguration": {"destinations": ["str"]}, + "tracesConfiguration": {"destinations": ["str"]}, + }, + "peerAuthentication": {"mtls": {"enabled": bool}}, + "peerTrafficConfiguration": {"encryption": {"enabled": bool}}, + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "staticIp": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "vnetConfiguration": { + "dockerBridgeCidr": "str", + "infrastructureSubnetId": "str", + "internal": bool, + "platformReservedCidr": "str", + "platformReservedDnsIP": "str", + }, + "workloadProfiles": [ + {"name": "str", "workloadProfileType": "str", "maximumCount": 0, "minimumCount": 0} + ], + "zoneRedundant": bool, + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.managed_environments.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.managed_environments.begin_update( + resource_group_name=resource_group.name, + environment_name="str", + environment_envelope={ + "location": "str", + "appInsightsConfiguration": {"connectionString": "str"}, + "appLogsConfiguration": { + "destination": "str", + "logAnalyticsConfiguration": {"customerId": "str", "dynamicJsonColumns": bool, "sharedKey": "str"}, + }, + "customDomainConfiguration": { + "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, + "certificatePassword": "str", + "certificateValue": bytes("bytes", encoding="utf-8"), + "customDomainVerificationId": "str", + "dnsSuffix": "str", + "expirationDate": "2020-02-20 00:00:00", + "subjectName": "str", + "thumbprint": "str", + }, + "daprAIConnectionString": "str", + "daprAIInstrumentationKey": "str", + "daprConfiguration": {"version": "str"}, + "defaultDomain": "str", + "deploymentErrors": "str", + "eventStreamEndpoint": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "infrastructureResourceGroup": "str", + "kedaConfiguration": {"version": "str"}, + "kind": "str", + "name": "str", + "openTelemetryConfiguration": { + "destinationsConfiguration": { + "dataDogConfiguration": {"key": "str", "site": "str"}, + "otlpConfigurations": [ + { + "endpoint": "str", + "headers": [{"key": "str", "value": "str"}], + "insecure": bool, + "name": "str", + } + ], + }, + "logsConfiguration": {"destinations": ["str"]}, + "metricsConfiguration": {"destinations": ["str"]}, + "tracesConfiguration": {"destinations": ["str"]}, + }, + "peerAuthentication": {"mtls": {"enabled": bool}}, + "peerTrafficConfiguration": {"encryption": {"enabled": bool}}, + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "staticIp": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "vnetConfiguration": { + "dockerBridgeCidr": "str", + "infrastructureSubnetId": "str", + "internal": bool, + "platformReservedCidr": "str", + "platformReservedDnsIP": "str", + }, + "workloadProfiles": [ + {"name": "str", "workloadProfileType": "str", "maximumCount": 0, "minimumCount": 0} + ], + "zoneRedundant": bool, + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_auth_token(self, resource_group): + response = self.client.managed_environments.get_auth_token( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_workload_profile_states(self, resource_group): + response = self.client.managed_environments.list_workload_profile_states( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations_async.py new file mode 100644 index 000000000000..2830fceec6fc --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations_async.py @@ -0,0 +1,327 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.managed_environments.list_by_subscription( + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.managed_environments.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.managed_environments.get( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.managed_environments.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + environment_envelope={ + "location": "str", + "appInsightsConfiguration": {"connectionString": "str"}, + "appLogsConfiguration": { + "destination": "str", + "logAnalyticsConfiguration": { + "customerId": "str", + "dynamicJsonColumns": bool, + "sharedKey": "str", + }, + }, + "customDomainConfiguration": { + "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, + "certificatePassword": "str", + "certificateValue": bytes("bytes", encoding="utf-8"), + "customDomainVerificationId": "str", + "dnsSuffix": "str", + "expirationDate": "2020-02-20 00:00:00", + "subjectName": "str", + "thumbprint": "str", + }, + "daprAIConnectionString": "str", + "daprAIInstrumentationKey": "str", + "daprConfiguration": {"version": "str"}, + "defaultDomain": "str", + "deploymentErrors": "str", + "eventStreamEndpoint": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "infrastructureResourceGroup": "str", + "kedaConfiguration": {"version": "str"}, + "kind": "str", + "name": "str", + "openTelemetryConfiguration": { + "destinationsConfiguration": { + "dataDogConfiguration": {"key": "str", "site": "str"}, + "otlpConfigurations": [ + { + "endpoint": "str", + "headers": [{"key": "str", "value": "str"}], + "insecure": bool, + "name": "str", + } + ], + }, + "logsConfiguration": {"destinations": ["str"]}, + "metricsConfiguration": {"destinations": ["str"]}, + "tracesConfiguration": {"destinations": ["str"]}, + }, + "peerAuthentication": {"mtls": {"enabled": bool}}, + "peerTrafficConfiguration": {"encryption": {"enabled": bool}}, + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "staticIp": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "vnetConfiguration": { + "dockerBridgeCidr": "str", + "infrastructureSubnetId": "str", + "internal": bool, + "platformReservedCidr": "str", + "platformReservedDnsIP": "str", + }, + "workloadProfiles": [ + {"name": "str", "workloadProfileType": "str", "maximumCount": 0, "minimumCount": 0} + ], + "zoneRedundant": bool, + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.managed_environments.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.managed_environments.begin_update( + resource_group_name=resource_group.name, + environment_name="str", + environment_envelope={ + "location": "str", + "appInsightsConfiguration": {"connectionString": "str"}, + "appLogsConfiguration": { + "destination": "str", + "logAnalyticsConfiguration": { + "customerId": "str", + "dynamicJsonColumns": bool, + "sharedKey": "str", + }, + }, + "customDomainConfiguration": { + "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, + "certificatePassword": "str", + "certificateValue": bytes("bytes", encoding="utf-8"), + "customDomainVerificationId": "str", + "dnsSuffix": "str", + "expirationDate": "2020-02-20 00:00:00", + "subjectName": "str", + "thumbprint": "str", + }, + "daprAIConnectionString": "str", + "daprAIInstrumentationKey": "str", + "daprConfiguration": {"version": "str"}, + "defaultDomain": "str", + "deploymentErrors": "str", + "eventStreamEndpoint": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "infrastructureResourceGroup": "str", + "kedaConfiguration": {"version": "str"}, + "kind": "str", + "name": "str", + "openTelemetryConfiguration": { + "destinationsConfiguration": { + "dataDogConfiguration": {"key": "str", "site": "str"}, + "otlpConfigurations": [ + { + "endpoint": "str", + "headers": [{"key": "str", "value": "str"}], + "insecure": bool, + "name": "str", + } + ], + }, + "logsConfiguration": {"destinations": ["str"]}, + "metricsConfiguration": {"destinations": ["str"]}, + "tracesConfiguration": {"destinations": ["str"]}, + }, + "peerAuthentication": {"mtls": {"enabled": bool}}, + "peerTrafficConfiguration": {"encryption": {"enabled": bool}}, + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "staticIp": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "vnetConfiguration": { + "dockerBridgeCidr": "str", + "infrastructureSubnetId": "str", + "internal": bool, + "platformReservedCidr": "str", + "platformReservedDnsIP": "str", + }, + "workloadProfiles": [ + {"name": "str", "workloadProfileType": "str", "maximumCount": 0, "minimumCount": 0} + ], + "zoneRedundant": bool, + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_auth_token(self, resource_group): + response = await self.client.managed_environments.get_auth_token( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_workload_profile_states(self, resource_group): + response = self.client.managed_environments.list_workload_profile_states( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations.py new file mode 100644 index 000000000000..07d3f3d84dd2 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations.py @@ -0,0 +1,87 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentsStoragesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.managed_environments_storages.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.managed_environments_storages.get( + resource_group_name=resource_group.name, + environment_name="str", + storage_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.managed_environments_storages.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + storage_name="str", + storage_envelope={ + "id": "str", + "name": "str", + "properties": { + "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"}, + "nfsAzureFile": {"accessMode": "str", "server": "str", "shareName": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.managed_environments_storages.delete( + resource_group_name=resource_group.name, + environment_name="str", + storage_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations_async.py new file mode 100644 index 000000000000..5e6af988708e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations_async.py @@ -0,0 +1,88 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentsStoragesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = await self.client.managed_environments_storages.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.managed_environments_storages.get( + resource_group_name=resource_group.name, + environment_name="str", + storage_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.managed_environments_storages.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + storage_name="str", + storage_envelope={ + "id": "str", + "name": "str", + "properties": { + "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"}, + "nfsAzureFile": {"accessMode": "str", "server": "str", "shareName": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.managed_environments_storages.delete( + resource_group_name=resource_group.name, + environment_name="str", + storage_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations.py new file mode 100644 index 000000000000..2c6343949e2f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPINamespacesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_check_name_availability(self, resource_group): + response = self.client.namespaces.check_name_availability( + resource_group_name=resource_group.name, + environment_name="str", + check_name_availability_request={"name": "str", "type": "str"}, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations_async.py new file mode 100644 index 000000000000..4d7d402a20d7 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations_async.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPINamespacesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_check_name_availability(self, resource_group): + response = await self.client.namespaces.check_name_availability( + resource_group_name=resource_group.name, + environment_name="str", + check_name_availability_request={"name": "str", "type": "str"}, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations.py new file mode 100644 index 000000000000..a6f1201eb482 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations_async.py new file mode 100644 index 000000000000..79e186721f08 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations_async.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations.py new file mode 100644 index 000000000000..04acf42ae22d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIUsagesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.usages.list( + location="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations_async.py new file mode 100644 index 000000000000..d463d34828e8 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations_async.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIUsagesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.usages.list( + location="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/setup.py b/sdk/appcontainers/azure-mgmt-appcontainers/setup.py index 98a7edfe26ee..f4a701461b04 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/setup.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/setup.py @@ -75,6 +75,7 @@ }, install_requires=[ "isodate>=0.6.1", + "typing-extensions>=4.6.0", "azure-common>=1.1", "azure-mgmt-core>=1.3.2", ],