diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json b/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json index 2b97d51948d3..133ae32f602d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json +++ b/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json @@ -1,11 +1,11 @@ { - "commit": "4cd95123fb961c68740565a1efcaa5e43bd35802", + "commit": "8a5088b0024ead0f63e54784579157e9b318d619", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/app/resource-manager/readme.md --generate-sample=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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --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 8c597d56b1c9..ebda732f0bc3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py @@ -27,16 +27,16 @@ class ContainerAppsAPIClientConfiguration(Configuration): # pylint: disable=too :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :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-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-08-01-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: super(ContainerAppsAPIClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-05-01") + api_version: str = kwargs.pop("api_version", "2023-08-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") 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 a40beedb16fa..f7176ae08345 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 @@ -16,8 +16,11 @@ from ._configuration import ContainerAppsAPIClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( + AppResiliencyOperations, AvailableWorkloadProfilesOperations, BillingMetersOperations, + BuildersOperations, + BuildsOperations, CertificatesOperations, ConnectedEnvironmentsCertificatesOperations, ConnectedEnvironmentsDaprComponentsOperations, @@ -30,16 +33,20 @@ ContainerAppsRevisionReplicasOperations, ContainerAppsRevisionsOperations, ContainerAppsSourceControlsOperations, + DaprComponentResiliencyPoliciesOperations, DaprComponentsOperations, + DaprSubscriptionsOperations, JobsExecutionsOperations, JobsOperations, ManagedCertificatesOperations, ManagedEnvironmentDiagnosticsOperations, + ManagedEnvironmentUsagesOperations, ManagedEnvironmentsDiagnosticsOperations, ManagedEnvironmentsOperations, ManagedEnvironmentsStoragesOperations, NamespacesOperations, Operations, + UsagesOperations, ) if TYPE_CHECKING: @@ -52,6 +59,8 @@ class ContainerAppsAPIClient( ): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """ContainerAppsAPIClient. + :ivar app_resiliency: AppResiliencyOperations operations + :vartype app_resiliency: azure.mgmt.appcontainers.operations.AppResiliencyOperations :ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations :vartype container_apps_auth_configs: azure.mgmt.appcontainers.operations.ContainerAppsAuthConfigsOperations @@ -60,6 +69,10 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.operations.AvailableWorkloadProfilesOperations :ivar billing_meters: BillingMetersOperations operations :vartype billing_meters: azure.mgmt.appcontainers.operations.BillingMetersOperations + :ivar builders: BuildersOperations operations + :vartype builders: azure.mgmt.appcontainers.operations.BuildersOperations + :ivar builds: BuildsOperations operations + :vartype builds: azure.mgmt.appcontainers.operations.BuildsOperations :ivar connected_environments: ConnectedEnvironmentsOperations operations :vartype connected_environments: azure.mgmt.appcontainers.operations.ConnectedEnvironmentsOperations @@ -91,10 +104,10 @@ class ContainerAppsAPIClient( :ivar managed_environments_diagnostics: ManagedEnvironmentsDiagnosticsOperations operations :vartype managed_environments_diagnostics: azure.mgmt.appcontainers.operations.ManagedEnvironmentsDiagnosticsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appcontainers.operations.Operations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.appcontainers.operations.JobsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appcontainers.operations.Operations :ivar jobs_executions: JobsExecutionsOperations operations :vartype jobs_executions: azure.mgmt.appcontainers.operations.JobsExecutionsOperations :ivar managed_environments: ManagedEnvironmentsOperations operations @@ -109,20 +122,30 @@ class ContainerAppsAPIClient( :vartype namespaces: azure.mgmt.appcontainers.operations.NamespacesOperations :ivar dapr_components: DaprComponentsOperations operations :vartype dapr_components: azure.mgmt.appcontainers.operations.DaprComponentsOperations + :ivar dapr_component_resiliency_policies: DaprComponentResiliencyPoliciesOperations operations + :vartype dapr_component_resiliency_policies: + azure.mgmt.appcontainers.operations.DaprComponentResiliencyPoliciesOperations + :ivar dapr_subscriptions: DaprSubscriptionsOperations operations + :vartype dapr_subscriptions: azure.mgmt.appcontainers.operations.DaprSubscriptionsOperations :ivar managed_environments_storages: ManagedEnvironmentsStoragesOperations operations :vartype managed_environments_storages: azure.mgmt.appcontainers.operations.ManagedEnvironmentsStoragesOperations :ivar container_apps_source_controls: ContainerAppsSourceControlsOperations operations :vartype container_apps_source_controls: azure.mgmt.appcontainers.operations.ContainerAppsSourceControlsOperations + :ivar usages: UsagesOperations operations + :vartype usages: azure.mgmt.appcontainers.operations.UsagesOperations + :ivar managed_environment_usages: ManagedEnvironmentUsagesOperations operations + :vartype managed_environment_usages: + azure.mgmt.appcontainers.operations.ManagedEnvironmentUsagesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :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-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-08-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -144,6 +167,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + self.app_resiliency = AppResiliencyOperations(self._client, self._config, self._serialize, self._deserialize) self.container_apps_auth_configs = ContainerAppsAuthConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -151,6 +175,8 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.billing_meters = BillingMetersOperations(self._client, self._config, self._serialize, self._deserialize) + self.builders = BuildersOperations(self._client, self._config, self._serialize, self._deserialize) + self.builds = BuildsOperations(self._client, self._config, self._serialize, self._deserialize) self.connected_environments = ConnectedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -179,8 +205,8 @@ def __init__( self.managed_environments_diagnostics = ManagedEnvironmentsDiagnosticsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.jobs_executions = JobsExecutionsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_environments = ManagedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize @@ -191,12 +217,22 @@ def __init__( ) self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) self.dapr_components = DaprComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dapr_component_resiliency_policies = DaprComponentResiliencyPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.dapr_subscriptions = DaprSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.managed_environments_storages = ManagedEnvironmentsStoragesOperations( self._client, self._config, self._serialize, self._deserialize ) self.container_apps_source_controls = ContainerAppsSourceControlsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_environment_usages = ManagedEnvironmentUsagesOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. 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 cac9f5d10f8b..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.0.0" +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 9047e10b128d..bf438cd75f41 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 @@ -27,16 +27,16 @@ class ContainerAppsAPIClientConfiguration(Configuration): # pylint: disable=too :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :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-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-08-01-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: super(ContainerAppsAPIClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-05-01") + api_version: str = kwargs.pop("api_version", "2023-08-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") 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 fc093b7cef63..9c7acbaeed6f 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 @@ -16,8 +16,11 @@ from .._serialization import Deserializer, Serializer from ._configuration import ContainerAppsAPIClientConfiguration from .operations import ( + AppResiliencyOperations, AvailableWorkloadProfilesOperations, BillingMetersOperations, + BuildersOperations, + BuildsOperations, CertificatesOperations, ConnectedEnvironmentsCertificatesOperations, ConnectedEnvironmentsDaprComponentsOperations, @@ -30,16 +33,20 @@ ContainerAppsRevisionReplicasOperations, ContainerAppsRevisionsOperations, ContainerAppsSourceControlsOperations, + DaprComponentResiliencyPoliciesOperations, DaprComponentsOperations, + DaprSubscriptionsOperations, JobsExecutionsOperations, JobsOperations, ManagedCertificatesOperations, ManagedEnvironmentDiagnosticsOperations, + ManagedEnvironmentUsagesOperations, ManagedEnvironmentsDiagnosticsOperations, ManagedEnvironmentsOperations, ManagedEnvironmentsStoragesOperations, NamespacesOperations, Operations, + UsagesOperations, ) if TYPE_CHECKING: @@ -52,6 +59,8 @@ class ContainerAppsAPIClient( ): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """ContainerAppsAPIClient. + :ivar app_resiliency: AppResiliencyOperations operations + :vartype app_resiliency: azure.mgmt.appcontainers.aio.operations.AppResiliencyOperations :ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations :vartype container_apps_auth_configs: azure.mgmt.appcontainers.aio.operations.ContainerAppsAuthConfigsOperations @@ -60,6 +69,10 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.aio.operations.AvailableWorkloadProfilesOperations :ivar billing_meters: BillingMetersOperations operations :vartype billing_meters: azure.mgmt.appcontainers.aio.operations.BillingMetersOperations + :ivar builders: BuildersOperations operations + :vartype builders: azure.mgmt.appcontainers.aio.operations.BuildersOperations + :ivar builds: BuildsOperations operations + :vartype builds: azure.mgmt.appcontainers.aio.operations.BuildsOperations :ivar connected_environments: ConnectedEnvironmentsOperations operations :vartype connected_environments: azure.mgmt.appcontainers.aio.operations.ConnectedEnvironmentsOperations @@ -91,10 +104,10 @@ class ContainerAppsAPIClient( :ivar managed_environments_diagnostics: ManagedEnvironmentsDiagnosticsOperations operations :vartype managed_environments_diagnostics: azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsDiagnosticsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appcontainers.aio.operations.Operations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.appcontainers.aio.operations.JobsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appcontainers.aio.operations.Operations :ivar jobs_executions: JobsExecutionsOperations operations :vartype jobs_executions: azure.mgmt.appcontainers.aio.operations.JobsExecutionsOperations :ivar managed_environments: ManagedEnvironmentsOperations operations @@ -109,20 +122,31 @@ class ContainerAppsAPIClient( :vartype namespaces: azure.mgmt.appcontainers.aio.operations.NamespacesOperations :ivar dapr_components: DaprComponentsOperations operations :vartype dapr_components: azure.mgmt.appcontainers.aio.operations.DaprComponentsOperations + :ivar dapr_component_resiliency_policies: DaprComponentResiliencyPoliciesOperations operations + :vartype dapr_component_resiliency_policies: + azure.mgmt.appcontainers.aio.operations.DaprComponentResiliencyPoliciesOperations + :ivar dapr_subscriptions: DaprSubscriptionsOperations operations + :vartype dapr_subscriptions: + azure.mgmt.appcontainers.aio.operations.DaprSubscriptionsOperations :ivar managed_environments_storages: ManagedEnvironmentsStoragesOperations operations :vartype managed_environments_storages: azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsStoragesOperations :ivar container_apps_source_controls: ContainerAppsSourceControlsOperations operations :vartype container_apps_source_controls: azure.mgmt.appcontainers.aio.operations.ContainerAppsSourceControlsOperations + :ivar usages: UsagesOperations operations + :vartype usages: azure.mgmt.appcontainers.aio.operations.UsagesOperations + :ivar managed_environment_usages: ManagedEnvironmentUsagesOperations operations + :vartype managed_environment_usages: + azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentUsagesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :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-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-08-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -144,6 +168,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + self.app_resiliency = AppResiliencyOperations(self._client, self._config, self._serialize, self._deserialize) self.container_apps_auth_configs = ContainerAppsAuthConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -151,6 +176,8 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.billing_meters = BillingMetersOperations(self._client, self._config, self._serialize, self._deserialize) + self.builders = BuildersOperations(self._client, self._config, self._serialize, self._deserialize) + self.builds = BuildsOperations(self._client, self._config, self._serialize, self._deserialize) self.connected_environments = ConnectedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -179,8 +206,8 @@ def __init__( self.managed_environments_diagnostics = ManagedEnvironmentsDiagnosticsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.jobs_executions = JobsExecutionsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_environments = ManagedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize @@ -191,12 +218,22 @@ def __init__( ) self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) self.dapr_components = DaprComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dapr_component_resiliency_policies = DaprComponentResiliencyPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.dapr_subscriptions = DaprSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.managed_environments_storages = ManagedEnvironmentsStoragesOperations( self._client, self._config, self._serialize, self._deserialize ) self.container_apps_source_controls = ContainerAppsSourceControlsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_environment_usages = ManagedEnvironmentUsagesOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 839be84fdb2f..63382b7b45ad 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 @@ -6,9 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._app_resiliency_operations import AppResiliencyOperations from ._container_apps_auth_configs_operations import ContainerAppsAuthConfigsOperations from ._available_workload_profiles_operations import AvailableWorkloadProfilesOperations from ._billing_meters_operations import BillingMetersOperations +from ._builders_operations import BuildersOperations +from ._builds_operations import BuildsOperations from ._connected_environments_operations import ConnectedEnvironmentsOperations from ._connected_environments_certificates_operations import ConnectedEnvironmentsCertificatesOperations from ._connected_environments_dapr_components_operations import ConnectedEnvironmentsDaprComponentsOperations @@ -19,8 +22,8 @@ from ._container_apps_diagnostics_operations import ContainerAppsDiagnosticsOperations from ._managed_environment_diagnostics_operations import ManagedEnvironmentDiagnosticsOperations from ._managed_environments_diagnostics_operations import ManagedEnvironmentsDiagnosticsOperations -from ._operations import Operations from ._jobs_operations import JobsOperations +from ._operations import Operations from ._jobs_executions_operations import JobsExecutionsOperations from ._container_apps_api_client_operations import ContainerAppsAPIClientOperationsMixin from ._managed_environments_operations import ManagedEnvironmentsOperations @@ -28,17 +31,24 @@ from ._managed_certificates_operations import ManagedCertificatesOperations from ._namespaces_operations import NamespacesOperations from ._dapr_components_operations import DaprComponentsOperations +from ._dapr_component_resiliency_policies_operations import DaprComponentResiliencyPoliciesOperations +from ._dapr_subscriptions_operations import DaprSubscriptionsOperations from ._managed_environments_storages_operations import ManagedEnvironmentsStoragesOperations from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations +from ._usages_operations import UsagesOperations +from ._managed_environment_usages_operations import ManagedEnvironmentUsagesOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ + "AppResiliencyOperations", "ContainerAppsAuthConfigsOperations", "AvailableWorkloadProfilesOperations", "BillingMetersOperations", + "BuildersOperations", + "BuildsOperations", "ConnectedEnvironmentsOperations", "ConnectedEnvironmentsCertificatesOperations", "ConnectedEnvironmentsDaprComponentsOperations", @@ -49,8 +59,8 @@ "ContainerAppsDiagnosticsOperations", "ManagedEnvironmentDiagnosticsOperations", "ManagedEnvironmentsDiagnosticsOperations", - "Operations", "JobsOperations", + "Operations", "JobsExecutionsOperations", "ContainerAppsAPIClientOperationsMixin", "ManagedEnvironmentsOperations", @@ -58,8 +68,12 @@ "ManagedCertificatesOperations", "NamespacesOperations", "DaprComponentsOperations", + "DaprComponentResiliencyPoliciesOperations", + "DaprSubscriptionsOperations", "ManagedEnvironmentsStoragesOperations", "ContainerAppsSourceControlsOperations", + "UsagesOperations", + "ManagedEnvironmentUsagesOperations", ] __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 new file mode 100644 index 000000000000..82d5d5571f52 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_app_resiliency_operations.py @@ -0,0 +1,610 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._app_resiliency_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) +from .._vendor import ContainerAppsAPIClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AppResiliencyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`app_resiliency` 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") + + @overload + async def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: _models.AppResiliency, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Required. + :type resiliency_envelope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: Union[_models.AppResiliency, IO], + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Is either a + AppResiliency type or a IO type. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.AppResiliency] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resiliency_envelope, (IOBase, bytes)): + _content = resiliency_envelope + else: + _json = self._serialize.body(resiliency_envelope, "AppResiliency") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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) + + if response.status_code == 200: + deserialized = self._deserialize("AppResiliency", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("AppResiliency", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}" + } + + @overload + async def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: _models.AppResiliency, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Required. + :type resiliency_envelope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: Union[_models.AppResiliency, IO], + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Is either a AppResiliency type or + a IO type. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.AppResiliency] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resiliency_envelope, (IOBase, bytes)): + _content = resiliency_envelope + else: + _json = self._serialize.body(resiliency_envelope, "AppResiliency") + + request = build_update_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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("AppResiliency", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, app_name: str, name: str, **kwargs: Any + ) -> None: + """Delete an application's resiliency policy. + + Delete container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 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, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, app_name: str, name: str, **kwargs: Any) -> _models.AppResiliency: + """Get an application's resiliency policy. + + Get container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.AppResiliency] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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("AppResiliency", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}" + } + + @distributed_trace + def list(self, resource_group_name: str, app_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResiliency"]: + """List an application's resiliency policies. + + List container app resiliency policies. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppResiliency or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.AppResiliency] + :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.AppResiliencyCollection] = kwargs.pop("cls", None) + + error_map = { + 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, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AppResiliencyCollection", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies" + } 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 new file mode 100644 index 000000000000..02f0ffe46d9b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py @@ -0,0 +1,882 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, 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, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._builders_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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`builders` 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.BuilderResource"]: + """List BuilderResource resources by subscription ID. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] + :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.BuilderCollection] = kwargs.pop("cls", None) + + error_map = { + 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, + template_url=self.list_by_subscription.metadata["url"], + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderCollection", 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) + + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/builders"} + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BuilderResource"]: + """List BuilderResource resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] + :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.BuilderCollection] = kwargs.pop("cls", None) + + error_map = { + 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, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderCollection", 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) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> _models.BuilderResource: + """Get a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuilderResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuilderResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.BuilderResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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("BuilderResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO], + **kwargs: Any + ) -> _models.BuilderResource: + error_map = { + 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.BuilderResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_envelope, (IOBase, bytes)): + _content = builder_envelope + else: + _json = self._serialize.body(builder_envelope, "BuilderResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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) + + 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) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: _models.BuilderResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Required. + :type builder_envelope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Is either a BuilderResource type or a IO + type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :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.BuilderResource] = 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, + builder_name=builder_name, + builder_envelope=builder_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + async def _update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO], + **kwargs: Any + ) -> Optional[_models.BuilderResource]: + error_map = { + 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[Optional[_models.BuilderResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_envelope, (IOBase, bytes)): + _content = builder_envelope + else: + _json = self._serialize.body(builder_envelope, "BuilderResourceUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = 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")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: _models.BuilderResourceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Required. + :type builder_envelope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Is either a + BuilderResourceUpdate type or a IO type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :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.BuilderResource] = 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, + builder_name=builder_name, + builder_envelope=builder_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, builder_name: str, **kwargs: Any + ) -> None: + error_map = { + 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, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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 [202, 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) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + builder_name=builder_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } 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 new file mode 100644 index 000000000000..ca7d451dbe53 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py @@ -0,0 +1,662 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, 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, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._builds_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_auth_token_request, + build_list_by_builder_resource_request, +) +from .._vendor import ContainerAppsAPIClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`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 + def list_by_builder_resource( + self, resource_group_name: str, builder_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BuildResource"]: + """List BuildResource resources by BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildResource or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.BuildResource] + :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.BuildCollection] = kwargs.pop("cls", None) + + error_map = { + 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_builder_resource_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_builder_resource.metadata["url"], + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuildCollection", 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) + + list_by_builder_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> _models.BuildResource: + """Get a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.BuildResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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("BuildResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO], + **kwargs: Any + ) -> _models.BuildResource: + error_map = { + 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.BuildResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(build_envelope, (IOBase, bytes)): + _content = build_envelope + else: + _json = self._serialize.body(build_envelope, "BuildResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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) + + 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) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: _models.BuildResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Required. + :type build_envelope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Is either a BuildResource type or + a IO type. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :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.BuildResource] = 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, + builder_name=builder_name, + build_name=build_name, + build_envelope=build_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> None: + error_map = { + 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, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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 [202, 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) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + } + + @distributed_trace_async + async def list_auth_token( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> _models.BuildToken: + """Gets the token used to connect to the endpoint where source code can be uploaded for a build. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildToken or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildToken + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.BuildToken] = kwargs.pop("cls", None) + + request = build_list_auth_token_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_auth_token.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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("BuildToken", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_auth_token.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}/listAuthToken" + } 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 e7644744068f..6afdcbec68df 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 @@ -25,7 +25,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._container_apps_api_client_operations import build_job_execution_request +from ...operations._container_apps_api_client_operations import ( + build_get_custom_domain_verification_id_request, + build_job_execution_request, +) from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") @@ -102,3 +105,59 @@ async def job_execution( job_execution.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}" } + + @distributed_trace_async + async def get_custom_domain_verification_id(self, **kwargs: Any) -> str: + """Get the verification id of a subscription used for verifying custom domains. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str or the result of cls(response) + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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_get_custom_domain_verification_id_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_custom_domain_verification_id.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_custom_domain_verification_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/getCustomDomainVerificationId" + } 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 new file mode 100644 index 000000000000..636a0c66a8de --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_component_resiliency_policies_operations.py @@ -0,0 +1,479 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._dapr_component_resiliency_policies_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) +from .._vendor import ContainerAppsAPIClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DaprComponentResiliencyPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`dapr_component_resiliency_policies` 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, component_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DaprComponentResiliencyPolicy"]: + """Get the resiliency policies for a Dapr component. + + Get the resiliency policies for a Dapr component. + + :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 component_name: Name of the Dapr Component. Required. + :type component_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DaprComponentResiliencyPolicy or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] + :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.DaprComponentResiliencyPoliciesCollection] = kwargs.pop("cls", None) + + error_map = { + 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, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DaprComponentResiliencyPoliciesCollection", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, component_name: str, name: str, **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Get a Dapr component resiliency policy. + + Get a Dapr component resiliency policy. + + :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 component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.DaprComponentResiliencyPolicy] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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("DaprComponentResiliencyPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: _models.DaprComponentResiliencyPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :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 component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Required. + :type dapr_component_resiliency_policy_envelope: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :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 component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Required. + :type dapr_component_resiliency_policy_envelope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: Union[_models.DaprComponentResiliencyPolicy, IO], + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :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 component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Is either a DaprComponentResiliencyPolicy type or a IO type. Required. + :type dapr_component_resiliency_policy_envelope: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.DaprComponentResiliencyPolicy] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dapr_component_resiliency_policy_envelope, (IOBase, bytes)): + _content = dapr_component_resiliency_policy_envelope + else: + _json = self._serialize.body(dapr_component_resiliency_policy_envelope, "DaprComponentResiliencyPolicy") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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) + + if response.status_code == 200: + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, component_name: str, name: str, **kwargs: Any + ) -> None: + """Delete a Dapr component resiliency policy. + + Delete a resiliency policy for a Dapr component. + + :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 component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 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, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}" + } 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 new file mode 100644 index 000000000000..3b2e7c40d841 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_subscriptions_operations.py @@ -0,0 +1,455 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._dapr_subscriptions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) +from .._vendor import ContainerAppsAPIClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DaprSubscriptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`dapr_subscriptions` 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.DaprSubscription"]: + """Get the Dapr subscriptions for a managed environment. + + Get the Dapr subscriptions for a 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DaprSubscription or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DaprSubscription] + :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.DaprSubscriptionsCollection] = kwargs.pop("cls", None) + + error_map = { + 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, + template_url=self.list.metadata["url"], + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DaprSubscriptionsCollection", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> _models.DaprSubscription: + """Get a dapr subscription. + + Get a dapr subscription. + + :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 name: Name of the Dapr subscription. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.DaprSubscription] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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("DaprSubscription", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: _models.DaprSubscription, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a 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 name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Required. + :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a 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 name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Required. + :type dapr_subscription_envelope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: Union[_models.DaprSubscription, IO], + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a 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 name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Is either a + DaprSubscription type or a IO type. Required. + :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.DaprSubscription] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dapr_subscription_envelope, (IOBase, bytes)): + _content = dapr_subscription_envelope + else: + _json = self._serialize.body(dapr_subscription_envelope, "DaprSubscription") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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) + + if response.status_code == 200: + deserialized = self._deserialize("DaprSubscription", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DaprSubscription", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> None: + """Delete a Dapr subscription. + + Delete a Dapr subscription from a 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 name: Name of the Dapr subscription. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 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, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}" + } 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 7a01f30b7159..15d721d3bc20 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,6 +7,7 @@ # 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, TypeVar, Union, cast, overload import urllib.parse @@ -34,10 +35,13 @@ from ...operations._jobs_operations import ( build_create_or_update_request, build_delete_request, + build_get_detector_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, + build_list_detectors_request, build_list_secrets_request, + build_proxy_get_request, build_start_request, build_stop_execution_request, build_stop_multiple_executions_request, @@ -45,6 +49,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,6 +76,213 @@ 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( + self, resource_group_name: str, job_name: str, **kwargs: Any + ) -> _models.DiagnosticsCollection: + """Get the list of diagnostics for a given Container App Job. + + Get the list of diagnostics for a Container App Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Job Name. Required. + :type job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticsCollection or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DiagnosticsCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.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, + template_url=self.list_detectors.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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("DiagnosticsCollection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_detectors.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectors" + } + + @distributed_trace_async + async def get_detector( + self, resource_group_name: str, job_name: str, detector_name: str, **kwargs: Any + ) -> _models.Diagnostics: + """Get the diagnostics data for a given Container App Job. + + Get the diagnostics data for a Container App Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Job Name. Required. + :type job_name: str + :param detector_name: Name of the Container App Job detector. Required. + :type detector_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Diagnostics or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.Diagnostics + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.Diagnostics] = kwargs.pop("cls", None) + + request = build_get_detector_request( + resource_group_name=resource_group_name, + job_name=job_name, + detector_name=detector_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_detector.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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("Diagnostics", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_detector.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectors/{detectorName}" + } + + @distributed_trace_async + async def proxy_get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models.Job: + """Get the properties for a given Container App Job. + + Get the properties of a Container App Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Job Name. Required. + :type job_name: str + :keyword api_name: Proxy API Name for Container App Job. Default value is "rootApi". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Job or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.Job + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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_name: Literal["rootApi"] = kwargs.pop("api_name", "rootApi") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Job] = kwargs.pop("cls", None) + + request = build_proxy_get_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_name=api_name, + api_version=api_version, + template_url=self.proxy_get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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("Job", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + proxy_get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectorProperties/{apiName}" + } + @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Job"]: """Get the Container Apps Jobs in a given subscription. 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 new file mode 100644 index 000000000000..c0f0dc37a360 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py @@ -0,0 +1,144 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._managed_environment_usages_operations import build_list_request +from .._vendor import ContainerAppsAPIClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ManagedEnvironmentUsagesOperations: + """ + .. 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_usages` 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.Usage"]: + """Gets the current usage information as well as the limits for 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 Environment. Required. + :type environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Usage or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.Usage] + :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.ListUsagesResult] = kwargs.pop("cls", None) + + error_map = { + 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, + template_url=self.list.metadata["url"], + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListUsagesResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/usages" + } 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 new file mode 100644 index 000000000000..730415f260da --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py @@ -0,0 +1,139 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._usages_operations import build_list_request +from .._vendor import ContainerAppsAPIClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class UsagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`usages` 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, location: str, **kwargs: Any) -> AsyncIterable["_models.Usage"]: + """Gets, for the specified location, the current resource usage information as well as the limits + under the subscription. + + :param location: The location for which resource usage is queried. Required. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Usage or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.Usage] + :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.ListUsagesResult] = kwargs.pop("cls", None) + + error_map = { + 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( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListUsagesResult", 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) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/usages"} 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 0c785f1782aa..cc95918ee8b9 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 @@ -8,8 +8,11 @@ from ._models_py3 import AllowedAudiencesValidation from ._models_py3 import AllowedPrincipals +from ._models_py3 import AppInsightsConfiguration from ._models_py3 import AppLogsConfiguration from ._models_py3 import AppRegistration +from ._models_py3 import AppResiliency +from ._models_py3 import AppResiliencyCollection from ._models_py3 import Apple from ._models_py3 import AppleRegistration from ._models_py3 import AuthConfig @@ -31,12 +34,21 @@ from ._models_py3 import BillingMeter from ._models_py3 import BillingMeterCollection from ._models_py3 import BillingMeterProperties +from ._models_py3 import BlobStorageTokenStore +from ._models_py3 import BuildCollection +from ._models_py3 import BuildConfiguration +from ._models_py3 import BuildResource +from ._models_py3 import BuildToken +from ._models_py3 import BuilderCollection +from ._models_py3 import BuilderResource +from ._models_py3 import BuilderResourceUpdate from ._models_py3 import Certificate from ._models_py3 import CertificateCollection from ._models_py3 import CertificatePatch from ._models_py3 import CertificateProperties from ._models_py3 import CheckNameAvailabilityRequest from ._models_py3 import CheckNameAvailabilityResponse +from ._models_py3 import CircuitBreakerPolicy from ._models_py3 import ClientRegistration from ._models_py3 import Configuration from ._models_py3 import ConnectedEnvironment @@ -54,6 +66,8 @@ from ._models_py3 import ContainerAppProbeHttpGetHttpHeadersItem from ._models_py3 import ContainerAppProbeTcpSocket from ._models_py3 import ContainerAppSecret +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 @@ -66,15 +80,30 @@ from ._models_py3 import CustomScaleRule from ._models_py3 import Dapr from ._models_py3 import DaprComponent +from ._models_py3 import DaprComponentResiliencyPoliciesCollection +from ._models_py3 import DaprComponentResiliencyPolicy +from ._models_py3 import DaprComponentResiliencyPolicyConfiguration +from ._models_py3 import DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration +from ._models_py3 import DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration +from ._models_py3 import DaprComponentResiliencyPolicyTimeoutPolicyConfiguration +from ._models_py3 import DaprComponentServiceBinding from ._models_py3 import DaprComponentsCollection from ._models_py3 import DaprConfiguration from ._models_py3 import DaprMetadata from ._models_py3 import DaprSecret from ._models_py3 import DaprSecretsCollection +from ._models_py3 import DaprServiceBindMetadata +from ._models_py3 import DaprSubscription +from ._models_py3 import DaprSubscriptionBulkSubscribeOptions +from ._models_py3 import DaprSubscriptionRouteRule +from ._models_py3 import DaprSubscriptionRoutes +from ._models_py3 import DaprSubscriptionsCollection +from ._models_py3 import DataDogConfiguration from ._models_py3 import DefaultAuthorizationPolicy from ._models_py3 import DefaultErrorResponse from ._models_py3 import DefaultErrorResponseError from ._models_py3 import DefaultErrorResponseErrorDetailsItem +from ._models_py3 import DestinationsConfiguration from ._models_py3 import DiagnosticDataProviderMetadata from ._models_py3 import DiagnosticDataProviderMetadataPropertyBagItem from ._models_py3 import DiagnosticDataTableResponseColumn @@ -87,8 +116,10 @@ from ._models_py3 import DiagnosticsDefinition from ._models_py3 import DiagnosticsProperties from ._models_py3 import DiagnosticsStatus +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 ErrorResponse @@ -99,11 +130,16 @@ from ._models_py3 import GithubActionConfiguration from ._models_py3 import GlobalValidation from ._models_py3 import Google +from ._models_py3 import HeaderMatch +from ._models_py3 import HttpConnectionPool +from ._models_py3 import HttpGet +from ._models_py3 import HttpRetryPolicy from ._models_py3 import HttpScaleRule from ._models_py3 import HttpSettings from ._models_py3 import HttpSettingsRoutes from ._models_py3 import IdentityProviders from ._models_py3 import Ingress +from ._models_py3 import IngressPortMapping from ._models_py3 import IngressStickySessions from ._models_py3 import InitContainer from ._models_py3 import IpSecurityRestrictionRule @@ -126,10 +162,12 @@ from ._models_py3 import JobsCollection from ._models_py3 import JwtClaimChecks from ._models_py3 import KedaConfiguration +from ._models_py3 import ListUsagesResult from ._models_py3 import LogAnalyticsConfiguration from ._models_py3 import Login from ._models_py3 import LoginRoutes from ._models_py3 import LoginScopes +from ._models_py3 import LogsConfiguration from ._models_py3 import ManagedCertificate from ._models_py3 import ManagedCertificateCollection from ._models_py3 import ManagedCertificatePatch @@ -141,14 +179,17 @@ from ._models_py3 import ManagedEnvironmentStoragesCollection from ._models_py3 import ManagedEnvironmentsCollection from ._models_py3 import ManagedServiceIdentity +from ._models_py3 import MetricsConfiguration from ._models_py3 import Mtls from ._models_py3 import Nonce from ._models_py3 import OpenIdConnectClientCredential from ._models_py3 import OpenIdConnectConfig from ._models_py3 import OpenIdConnectLogin from ._models_py3 import OpenIdConnectRegistration +from ._models_py3 import OpenTelemetryConfiguration from ._models_py3 import OperationDetail from ._models_py3 import OperationDisplay +from ._models_py3 import PreBuildStep from ._models_py3 import ProxyResource from ._models_py3 import QueueScaleRule from ._models_py3 import RegistryCredentials @@ -170,12 +211,19 @@ from ._models_py3 import SourceControl from ._models_py3 import SourceControlCollection from ._models_py3 import SystemData +from ._models_py3 import TcpConnectionPool +from ._models_py3 import TcpRetryPolicy from ._models_py3 import TcpScaleRule from ._models_py3 import Template +from ._models_py3 import TimeoutPolicy +from ._models_py3 import TokenStore +from ._models_py3 import TracesConfiguration from ._models_py3 import TrackedResource from ._models_py3 import TrafficWeight from ._models_py3 import Twitter from ._models_py3 import TwitterRegistration +from ._models_py3 import Usage +from ._models_py3 import UsageName from ._models_py3 import UserAssignedIdentity from ._models_py3 import VnetConfiguration from ._models_py3 import Volume @@ -192,7 +240,11 @@ from ._container_apps_api_client_enums import AppProtocol from ._container_apps_api_client_enums import Applicability from ._container_apps_api_client_enums import BindingType +from ._container_apps_api_client_enums import BuildProvisioningState +from ._container_apps_api_client_enums import BuildStatus +from ._container_apps_api_client_enums import BuilderProvisioningState from ._container_apps_api_client_enums import CertificateProvisioningState +from ._container_apps_api_client_enums import CertificateType from ._container_apps_api_client_enums import CheckNameAvailabilityReason from ._container_apps_api_client_enums import ConnectedEnvironmentProvisioningState from ._container_apps_api_client_enums import ContainerAppContainerRunningState @@ -227,8 +279,11 @@ __all__ = [ "AllowedAudiencesValidation", "AllowedPrincipals", + "AppInsightsConfiguration", "AppLogsConfiguration", "AppRegistration", + "AppResiliency", + "AppResiliencyCollection", "Apple", "AppleRegistration", "AuthConfig", @@ -250,12 +305,21 @@ "BillingMeter", "BillingMeterCollection", "BillingMeterProperties", + "BlobStorageTokenStore", + "BuildCollection", + "BuildConfiguration", + "BuildResource", + "BuildToken", + "BuilderCollection", + "BuilderResource", + "BuilderResourceUpdate", "Certificate", "CertificateCollection", "CertificatePatch", "CertificateProperties", "CheckNameAvailabilityRequest", "CheckNameAvailabilityResponse", + "CircuitBreakerPolicy", "ClientRegistration", "Configuration", "ConnectedEnvironment", @@ -273,6 +337,8 @@ "ContainerAppProbeHttpGetHttpHeadersItem", "ContainerAppProbeTcpSocket", "ContainerAppSecret", + "ContainerRegistry", + "ContainerRegistryWithCustomImage", "ContainerResources", "CookieExpiration", "CorsPolicy", @@ -285,15 +351,30 @@ "CustomScaleRule", "Dapr", "DaprComponent", + "DaprComponentResiliencyPoliciesCollection", + "DaprComponentResiliencyPolicy", + "DaprComponentResiliencyPolicyConfiguration", + "DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration", + "DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration", + "DaprComponentResiliencyPolicyTimeoutPolicyConfiguration", + "DaprComponentServiceBinding", "DaprComponentsCollection", "DaprConfiguration", "DaprMetadata", "DaprSecret", "DaprSecretsCollection", + "DaprServiceBindMetadata", + "DaprSubscription", + "DaprSubscriptionBulkSubscribeOptions", + "DaprSubscriptionRouteRule", + "DaprSubscriptionRoutes", + "DaprSubscriptionsCollection", + "DataDogConfiguration", "DefaultAuthorizationPolicy", "DefaultErrorResponse", "DefaultErrorResponseError", "DefaultErrorResponseErrorDetailsItem", + "DestinationsConfiguration", "DiagnosticDataProviderMetadata", "DiagnosticDataProviderMetadataPropertyBagItem", "DiagnosticDataTableResponseColumn", @@ -306,8 +387,10 @@ "DiagnosticsDefinition", "DiagnosticsProperties", "DiagnosticsStatus", + "EncryptionSettings", "EnvironmentAuthToken", "EnvironmentVar", + "EnvironmentVariable", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", @@ -318,11 +401,16 @@ "GithubActionConfiguration", "GlobalValidation", "Google", + "HeaderMatch", + "HttpConnectionPool", + "HttpGet", + "HttpRetryPolicy", "HttpScaleRule", "HttpSettings", "HttpSettingsRoutes", "IdentityProviders", "Ingress", + "IngressPortMapping", "IngressStickySessions", "InitContainer", "IpSecurityRestrictionRule", @@ -345,10 +433,12 @@ "JobsCollection", "JwtClaimChecks", "KedaConfiguration", + "ListUsagesResult", "LogAnalyticsConfiguration", "Login", "LoginRoutes", "LoginScopes", + "LogsConfiguration", "ManagedCertificate", "ManagedCertificateCollection", "ManagedCertificatePatch", @@ -360,14 +450,17 @@ "ManagedEnvironmentStoragesCollection", "ManagedEnvironmentsCollection", "ManagedServiceIdentity", + "MetricsConfiguration", "Mtls", "Nonce", "OpenIdConnectClientCredential", "OpenIdConnectConfig", "OpenIdConnectLogin", "OpenIdConnectRegistration", + "OpenTelemetryConfiguration", "OperationDetail", "OperationDisplay", + "PreBuildStep", "ProxyResource", "QueueScaleRule", "RegistryCredentials", @@ -389,12 +482,19 @@ "SourceControl", "SourceControlCollection", "SystemData", + "TcpConnectionPool", + "TcpRetryPolicy", "TcpScaleRule", "Template", + "TimeoutPolicy", + "TokenStore", + "TracesConfiguration", "TrackedResource", "TrafficWeight", "Twitter", "TwitterRegistration", + "Usage", + "UsageName", "UserAssignedIdentity", "VnetConfiguration", "Volume", @@ -410,7 +510,11 @@ "AppProtocol", "Applicability", "BindingType", + "BuildProvisioningState", + "BuildStatus", + "BuilderProvisioningState", "CertificateProvisioningState", + "CertificateType", "CheckNameAvailabilityReason", "ConnectedEnvironmentProvisioningState", "ContainerAppContainerRunningState", 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 694a6932ba5d..3952907cb753 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 @@ -71,6 +71,38 @@ class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SNI_ENABLED = "SniEnabled" +class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Resource instance provisioning state.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + + +class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Resource instance provisioning state.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + + +class BuildStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the build once it has been provisioned.""" + + NOT_STARTED = "NotStarted" + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + + class CertificateProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the certificate.""" @@ -81,6 +113,15 @@ class CertificateProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta) PENDING = "Pending" +class CertificateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the certificate. Allowed values are ``ServerSSLCertificate`` and + ``ImagePullTrustedCA``. + """ + + SERVER_SSL_CERTIFICATE = "ServerSSLCertificate" + IMAGE_PULL_TRUSTED_CA = "ImagePullTrustedCA" + + class CheckNameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The reason why the given name is not available.""" 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 4451f6940f93..329347249a86 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 @@ -78,6 +78,26 @@ def __init__( self.identities = identities +class AppInsightsConfiguration(_serialization.Model): + """Configuration of Application Insights. + + :ivar connection_string: Application Insights connection string. + :vartype connection_string: str + """ + + _attribute_map = { + "connection_string": {"key": "connectionString", "type": "str"}, + } + + def __init__(self, *, connection_string: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword connection_string: Application Insights connection string. + :paramtype connection_string: str + """ + super().__init__(**kwargs) + self.connection_string = connection_string + + class Apple(_serialization.Model): """The configuration settings of the Apple provider. @@ -291,6 +311,123 @@ def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) +class AppResiliency(ProxyResource): + """Configuration to setup App Resiliency. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar timeout_policy: Policy to set request timeouts. + :vartype timeout_policy: ~azure.mgmt.appcontainers.models.TimeoutPolicy + :ivar http_retry_policy: Policy that defines http request retry conditions. + :vartype http_retry_policy: ~azure.mgmt.appcontainers.models.HttpRetryPolicy + :ivar tcp_retry_policy: Policy that defines tcp request retry conditions. + :vartype tcp_retry_policy: ~azure.mgmt.appcontainers.models.TcpRetryPolicy + :ivar circuit_breaker_policy: Policy that defines circuit breaker conditions. + :vartype circuit_breaker_policy: ~azure.mgmt.appcontainers.models.CircuitBreakerPolicy + :ivar http_connection_pool: Defines parameters for http connection pooling. + :vartype http_connection_pool: ~azure.mgmt.appcontainers.models.HttpConnectionPool + :ivar tcp_connection_pool: Defines parameters for tcp connection pooling. + :vartype tcp_connection_pool: ~azure.mgmt.appcontainers.models.TcpConnectionPool + """ + + _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"}, + "timeout_policy": {"key": "properties.timeoutPolicy", "type": "TimeoutPolicy"}, + "http_retry_policy": {"key": "properties.httpRetryPolicy", "type": "HttpRetryPolicy"}, + "tcp_retry_policy": {"key": "properties.tcpRetryPolicy", "type": "TcpRetryPolicy"}, + "circuit_breaker_policy": {"key": "properties.circuitBreakerPolicy", "type": "CircuitBreakerPolicy"}, + "http_connection_pool": {"key": "properties.httpConnectionPool", "type": "HttpConnectionPool"}, + "tcp_connection_pool": {"key": "properties.tcpConnectionPool", "type": "TcpConnectionPool"}, + } + + def __init__( + self, + *, + timeout_policy: Optional["_models.TimeoutPolicy"] = None, + http_retry_policy: Optional["_models.HttpRetryPolicy"] = None, + tcp_retry_policy: Optional["_models.TcpRetryPolicy"] = None, + circuit_breaker_policy: Optional["_models.CircuitBreakerPolicy"] = None, + http_connection_pool: Optional["_models.HttpConnectionPool"] = None, + tcp_connection_pool: Optional["_models.TcpConnectionPool"] = None, + **kwargs: Any + ) -> None: + """ + :keyword timeout_policy: Policy to set request timeouts. + :paramtype timeout_policy: ~azure.mgmt.appcontainers.models.TimeoutPolicy + :keyword http_retry_policy: Policy that defines http request retry conditions. + :paramtype http_retry_policy: ~azure.mgmt.appcontainers.models.HttpRetryPolicy + :keyword tcp_retry_policy: Policy that defines tcp request retry conditions. + :paramtype tcp_retry_policy: ~azure.mgmt.appcontainers.models.TcpRetryPolicy + :keyword circuit_breaker_policy: Policy that defines circuit breaker conditions. + :paramtype circuit_breaker_policy: ~azure.mgmt.appcontainers.models.CircuitBreakerPolicy + :keyword http_connection_pool: Defines parameters for http connection pooling. + :paramtype http_connection_pool: ~azure.mgmt.appcontainers.models.HttpConnectionPool + :keyword tcp_connection_pool: Defines parameters for tcp connection pooling. + :paramtype tcp_connection_pool: ~azure.mgmt.appcontainers.models.TcpConnectionPool + """ + super().__init__(**kwargs) + self.timeout_policy = timeout_policy + self.http_retry_policy = http_retry_policy + self.tcp_retry_policy = tcp_retry_policy + self.circuit_breaker_policy = circuit_breaker_policy + self.http_connection_pool = http_connection_pool + self.tcp_connection_pool = tcp_connection_pool + + +class AppResiliencyCollection(_serialization.Model): + """Collection of AppResiliency policies. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.AppResiliency] + :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": "[AppResiliency]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.AppResiliency"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.AppResiliency] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + class AuthConfig(ProxyResource): """Configuration settings for the Azure ContainerApp Service Authentication / Authorization feature. @@ -323,6 +460,9 @@ class AuthConfig(ProxyResource): :ivar http_settings: The configuration settings of the HTTP requests for authentication and authorization requests made against ContainerApp Service Authentication/Authorization. :vartype http_settings: ~azure.mgmt.appcontainers.models.HttpSettings + :ivar encryption_settings: The configuration settings of the secrets references of encryption + key and signing key for ContainerApp Service Authentication/Authorization. + :vartype encryption_settings: ~azure.mgmt.appcontainers.models.EncryptionSettings """ _validation = { @@ -342,6 +482,7 @@ class AuthConfig(ProxyResource): "identity_providers": {"key": "properties.identityProviders", "type": "IdentityProviders"}, "login": {"key": "properties.login", "type": "Login"}, "http_settings": {"key": "properties.httpSettings", "type": "HttpSettings"}, + "encryption_settings": {"key": "properties.encryptionSettings", "type": "EncryptionSettings"}, } def __init__( @@ -352,6 +493,7 @@ def __init__( identity_providers: Optional["_models.IdentityProviders"] = None, login: Optional["_models.Login"] = None, http_settings: Optional["_models.HttpSettings"] = None, + encryption_settings: Optional["_models.EncryptionSettings"] = None, **kwargs: Any ) -> None: """ @@ -370,6 +512,9 @@ def __init__( :keyword http_settings: The configuration settings of the HTTP requests for authentication and authorization requests made against ContainerApp Service Authentication/Authorization. :paramtype http_settings: ~azure.mgmt.appcontainers.models.HttpSettings + :keyword encryption_settings: The configuration settings of the secrets references of + encryption key and signing key for ContainerApp Service Authentication/Authorization. + :paramtype encryption_settings: ~azure.mgmt.appcontainers.models.EncryptionSettings """ super().__init__(**kwargs) self.platform = platform @@ -377,6 +522,7 @@ def __init__( self.identity_providers = identity_providers self.login = login self.http_settings = http_settings + self.encryption_settings = encryption_settings class AuthConfigCollection(_serialization.Model): @@ -545,6 +691,8 @@ class AvailableWorkloadProfileProperties(_serialization.Model): :vartype cores: int :ivar memory_gi_b: Memory in GiB. :vartype memory_gi_b: int + :ivar gpus: Number of GPUs. + :vartype gpus: int :ivar display_name: The everyday name of the workload profile. :vartype display_name: str """ @@ -554,6 +702,7 @@ class AvailableWorkloadProfileProperties(_serialization.Model): "applicability": {"key": "applicability", "type": "str"}, "cores": {"key": "cores", "type": "int"}, "memory_gi_b": {"key": "memoryGiB", "type": "int"}, + "gpus": {"key": "gpus", "type": "int"}, "display_name": {"key": "displayName", "type": "str"}, } @@ -564,6 +713,7 @@ def __init__( applicability: Optional[Union[str, "_models.Applicability"]] = None, cores: Optional[int] = None, memory_gi_b: Optional[int] = None, + gpus: Optional[int] = None, display_name: Optional[str] = None, **kwargs: Any ) -> None: @@ -577,6 +727,8 @@ def __init__( :paramtype cores: int :keyword memory_gi_b: Memory in GiB. :paramtype memory_gi_b: int + :keyword gpus: Number of GPUs. + :paramtype gpus: int :keyword display_name: The everyday name of the workload profile. :paramtype display_name: str """ @@ -585,6 +737,7 @@ def __init__( self.applicability = applicability self.cores = cores self.memory_gi_b = memory_gi_b + self.gpus = gpus self.display_name = display_name @@ -1212,6 +1365,155 @@ def __init__( self.display_name = display_name +class BlobStorageTokenStore(_serialization.Model): + """The configuration settings of the storage of the tokens if blob storage is used. + + All required parameters must be populated in order to send to Azure. + + :ivar sas_url_setting_name: The name of the app secrets containing the SAS URL of the blob + storage containing the tokens. Required. + :vartype sas_url_setting_name: str + """ + + _validation = { + "sas_url_setting_name": {"required": True}, + } + + _attribute_map = { + "sas_url_setting_name": {"key": "sasUrlSettingName", "type": "str"}, + } + + def __init__(self, *, sas_url_setting_name: str, **kwargs: Any) -> None: + """ + :keyword sas_url_setting_name: The name of the app secrets containing the SAS URL of the blob + storage containing the tokens. Required. + :paramtype sas_url_setting_name: str + """ + super().__init__(**kwargs) + self.sas_url_setting_name = sas_url_setting_name + + +class BuildCollection(_serialization.Model): + """The response of a BuildResource list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The BuildResource items on this page. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.BuildResource] + :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": "[BuildResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.BuildResource"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The BuildResource items on this page. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.BuildResource] + :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 BuildConfiguration(_serialization.Model): + """Configuration of the build. + + :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 and + application runtime. + :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] + """ + + _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, + *, + base_os: Optional[str] = None, + platform: Optional[str] = None, + platform_version: Optional[str] = None, + environment_variables: Optional[List["_models.EnvironmentVariable"]] = None, + pre_build_steps: Optional[List["_models.PreBuildStep"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword base_os: Base OS used to build and run the app. + :paramtype base_os: str + :keyword platform: Platform to be used to build and run the app. + :paramtype platform: str + :keyword platform_version: Platform version to be used to build and run the app. + :paramtype platform_version: str + :keyword environment_variables: List of environment variables to be passed to the build and + application runtime. + :paramtype environment_variables: list[~azure.mgmt.appcontainers.models.EnvironmentVariable] + :keyword pre_build_steps: List of steps to perform before the build. + :paramtype pre_build_steps: list[~azure.mgmt.appcontainers.models.PreBuildStep] + """ + super().__init__(**kwargs) + self.base_os = base_os + self.platform = platform + self.platform_version = platform_version + self.environment_variables = environment_variables + self.pre_build_steps = pre_build_steps + + +class BuilderCollection(_serialization.Model): + """The response of a BuilderResource list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The BuilderResource items on this page. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.BuilderResource] + :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": "[BuilderResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.BuilderResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The BuilderResource items on this page. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.BuilderResource] + :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 TrackedResource(Resource): """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. @@ -1266,8 +1568,8 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class Certificate(TrackedResource): - """Certificate used for Custom Domain bindings of Container Apps in a Managed Environment. +class BuilderResource(TrackedResource): + """Information about the SourceToCloud builder resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -1288,8 +1590,17 @@ class Certificate(TrackedResource): :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar properties: Certificate resource specific properties. - :vartype properties: ~azure.mgmt.appcontainers.models.CertificateProperties + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :ivar provisioning_state: Provisioning state of a builder resource. Known values are: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.BuilderProvisioningState + :ivar environment_id: Resource ID of the container apps environment that the builder is + associated with. + :vartype environment_id: str + :ivar container_registries: List of mappings of container registries and the managed identity + used to connect to it. + :vartype container_registries: list[~azure.mgmt.appcontainers.models.ContainerRegistry] """ _validation = { @@ -1298,6 +1609,7 @@ class Certificate(TrackedResource): "type": {"readonly": True}, "system_data": {"readonly": True}, "location": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -1307,7 +1619,10 @@ class Certificate(TrackedResource): "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "CertificateProperties"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "environment_id": {"key": "properties.environmentId", "type": "str"}, + "container_registries": {"key": "properties.containerRegistries", "type": "[ContainerRegistry]"}, } def __init__( @@ -1315,7 +1630,9 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.CertificateProperties"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + environment_id: Optional[str] = None, + container_registries: Optional[List["_models.ContainerRegistry"]] = None, **kwargs: Any ) -> None: """ @@ -1323,95 +1640,332 @@ def __init__( :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str - :keyword properties: Certificate resource specific properties. - :paramtype properties: ~azure.mgmt.appcontainers.models.CertificateProperties + :keyword identity: The managed service identities assigned to this resource. + :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :keyword environment_id: Resource ID of the container apps environment that the builder is + associated with. + :paramtype environment_id: str + :keyword container_registries: List of mappings of container registries and the managed + identity used to connect to it. + :paramtype container_registries: list[~azure.mgmt.appcontainers.models.ContainerRegistry] """ super().__init__(tags=tags, location=location, **kwargs) - self.properties = properties - - -class CertificateCollection(_serialization.Model): - """Collection of Certificates. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.Certificate] - :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": "[Certificate]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.Certificate"], **kwargs: Any) -> None: - """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.Certificate] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None + self.identity = identity + self.provisioning_state = None + self.environment_id = environment_id + self.container_registries = container_registries -class CertificatePatch(_serialization.Model): - """A certificate to update. +class BuilderResourceUpdate(_serialization.Model): + """The type used for update operations of the BuilderResource. - :ivar tags: Application-specific metadata in the form of key-value pairs. + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar environment_id: Resource ID of the container apps environment that the builder is + associated with. + :vartype environment_id: str """ _attribute_map = { + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "tags": {"key": "tags", "type": "{str}"}, + "environment_id": {"key": "properties.environmentId", "type": "str"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + identity: Optional["_models.ManagedServiceIdentity"] = None, + tags: Optional[Dict[str, str]] = None, + environment_id: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword tags: Application-specific metadata in the form of key-value pairs. + :keyword identity: The managed service identities assigned to this resource. + :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword environment_id: Resource ID of the container apps environment that the builder is + associated with. + :paramtype environment_id: str """ super().__init__(**kwargs) + self.identity = identity self.tags = tags + self.environment_id = environment_id -class CertificateProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Certificate resource specific properties. +class BuildResource(ProxyResource): # pylint: disable=too-many-instance-attributes + """Information pertaining to an individual build. Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Provisioning state of the certificate. Known values are: "Succeeded", - "Failed", "Canceled", "DeleteFailed", and "Pending". - :vartype provisioning_state: str or - ~azure.mgmt.appcontainers.models.CertificateProvisioningState - :ivar password: Certificate password. - :vartype password: str - :ivar subject_name: Subject name of the certificate. - :vartype subject_name: str - :ivar subject_alternative_names: Subject alternative names the certificate applies to. - :vartype subject_alternative_names: list[str] - :ivar value: PFX or PEM blob. - :vartype value: bytes - :ivar issuer: Certificate issuer. - :vartype issuer: str - :ivar issue_date: Certificate issue Date. - :vartype issue_date: ~datetime.datetime - :ivar expiration_date: Certificate expiration date. - :vartype expiration_date: ~datetime.datetime - :ivar thumbprint: Certificate thumbprint. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar 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.BuildConfiguration + :ivar upload_endpoint: Endpoint to which the source code should be uploaded. + :vartype upload_endpoint: str + :ivar log_stream_endpoint: Endpoint from which the build logs can be streamed. + :vartype log_stream_endpoint: str + :ivar token_endpoint: Endpoint to use to retrieve an authentication token for log streaming and + uploading source code. + :vartype token_endpoint: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "build_status": {"readonly": True}, + "upload_endpoint": {"readonly": True}, + "log_stream_endpoint": {"readonly": True}, + "token_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": "BuildConfiguration"}, + "upload_endpoint": {"key": "properties.uploadEndpoint", "type": "str"}, + "log_stream_endpoint": {"key": "properties.logStreamEndpoint", "type": "str"}, + "token_endpoint": {"key": "properties.tokenEndpoint", "type": "str"}, + } + + def __init__( + self, + *, + destination_container_registry: Optional["_models.ContainerRegistryWithCustomImage"] = None, + configuration: Optional["_models.BuildConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword destination_container_registry: Container registry that the final image will be + uploaded to. + :paramtype destination_container_registry: + ~azure.mgmt.appcontainers.models.ContainerRegistryWithCustomImage + :keyword configuration: Configuration of the build. + :paramtype configuration: ~azure.mgmt.appcontainers.models.BuildConfiguration + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.build_status = None + self.destination_container_registry = destination_container_registry + self.configuration = configuration + self.upload_endpoint = None + self.log_stream_endpoint = None + self.token_endpoint = None + + +class BuildToken(_serialization.Model): + """Build Auth Token. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar token: Authentication token. + :vartype token: str + :ivar expires: Token expiration date. + :vartype expires: ~datetime.datetime + """ + + _validation = { + "token": {"readonly": True}, + "expires": {"readonly": True}, + } + + _attribute_map = { + "token": {"key": "token", "type": "str"}, + "expires": {"key": "expires", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.token = None + self.expires = None + + +class Certificate(TrackedResource): + """Certificate used for Custom Domain bindings of Container Apps in a Managed Environment. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Certificate resource specific properties. + :vartype properties: ~azure.mgmt.appcontainers.models.CertificateProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "CertificateProperties"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.CertificateProperties"] = 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 properties: Certificate resource specific properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.CertificateProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class CertificateCollection(_serialization.Model): + """Collection of Certificates. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.Certificate] + :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": "[Certificate]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Certificate"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.Certificate] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class CertificatePatch(_serialization.Model): + """A certificate to update. + + :ivar tags: Application-specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Application-specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class CertificateProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Certificate resource specific properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the certificate. Known values are: "Succeeded", + "Failed", "Canceled", "DeleteFailed", and "Pending". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.CertificateProvisioningState + :ivar password: Certificate password. + :vartype password: str + :ivar subject_name: Subject name of the certificate. + :vartype subject_name: str + :ivar subject_alternative_names: Subject alternative names the certificate applies to. + :vartype subject_alternative_names: list[str] + :ivar value: PFX or PEM blob. + :vartype value: bytes + :ivar issuer: Certificate issuer. + :vartype issuer: str + :ivar issue_date: Certificate issue Date. + :vartype issue_date: ~datetime.datetime + :ivar expiration_date: Certificate expiration date. + :vartype expiration_date: ~datetime.datetime + :ivar thumbprint: Certificate thumbprint. :vartype thumbprint: str :ivar valid: Is the certificate valid?. :vartype valid: bool :ivar public_key_hash: Public key hash. :vartype public_key_hash: str + :ivar certificate_type: The type of the certificate. Allowed values are + ``ServerSSLCertificate`` and ``ImagePullTrustedCA``. Known values are: "ServerSSLCertificate" + and "ImagePullTrustedCA". + :vartype certificate_type: str or ~azure.mgmt.appcontainers.models.CertificateType """ _validation = { @@ -1438,14 +1992,26 @@ class CertificateProperties(_serialization.Model): # pylint: disable=too-many-i "thumbprint": {"key": "thumbprint", "type": "str"}, "valid": {"key": "valid", "type": "bool"}, "public_key_hash": {"key": "publicKeyHash", "type": "str"}, + "certificate_type": {"key": "certificateType", "type": "str"}, } - def __init__(self, *, password: Optional[str] = None, value: Optional[bytes] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + password: Optional[str] = None, + value: Optional[bytes] = None, + certificate_type: Optional[Union[str, "_models.CertificateType"]] = None, + **kwargs: Any + ) -> None: """ :keyword password: Certificate password. :paramtype password: str :keyword value: PFX or PEM blob. :paramtype value: bytes + :keyword certificate_type: The type of the certificate. Allowed values are + ``ServerSSLCertificate`` and ``ImagePullTrustedCA``. Known values are: "ServerSSLCertificate" + and "ImagePullTrustedCA". + :paramtype certificate_type: str or ~azure.mgmt.appcontainers.models.CertificateType """ super().__init__(**kwargs) self.provisioning_state = None @@ -1459,6 +2025,7 @@ def __init__(self, *, password: Optional[str] = None, value: Optional[bytes] = N self.thumbprint = None self.valid = None self.public_key_hash = None + self.certificate_type = certificate_type class CheckNameAvailabilityRequest(_serialization.Model): @@ -1528,6 +2095,51 @@ def __init__( self.message = message +class CircuitBreakerPolicy(_serialization.Model): + """Policy that defines circuit breaker conditions. + + :ivar consecutive_errors: Number of consecutive errors before the circuit breaker opens. + :vartype consecutive_errors: int + :ivar interval_in_seconds: The time interval, in seconds, between endpoint checks. This can + result in opening the circuit breaker if the check fails as well as closing the circuit breaker + if the check succeeds. Defaults to 10s. + :vartype interval_in_seconds: int + :ivar max_ejection_percent: Maximum percentage of hosts that will be ejected after failure + threshold has been met. + :vartype max_ejection_percent: int + """ + + _attribute_map = { + "consecutive_errors": {"key": "consecutiveErrors", "type": "int"}, + "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, + "max_ejection_percent": {"key": "maxEjectionPercent", "type": "int"}, + } + + def __init__( + self, + *, + consecutive_errors: Optional[int] = None, + interval_in_seconds: Optional[int] = None, + max_ejection_percent: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword consecutive_errors: Number of consecutive errors before the circuit breaker opens. + :paramtype consecutive_errors: int + :keyword interval_in_seconds: The time interval, in seconds, between endpoint checks. This can + result in opening the circuit breaker if the check fails as well as closing the circuit breaker + if the check succeeds. Defaults to 10s. + :paramtype interval_in_seconds: int + :keyword max_ejection_percent: Maximum percentage of hosts that will be ejected after failure + threshold has been met. + :paramtype max_ejection_percent: int + """ + super().__init__(**kwargs) + self.consecutive_errors = consecutive_errors + self.interval_in_seconds = interval_in_seconds + self.max_ejection_percent = max_ejection_percent + + class ClientRegistration(_serialization.Model): """The configuration settings of the app registration for providers that have client ids and client secrets. @@ -2523,46 +3135,117 @@ def __init__(self, **kwargs: Any) -> None: self.key_vault_url = None -class ContainerResources(_serialization.Model): - """Container App container resource requirements. +class ContainerRegistry(_serialization.Model): + """Model representing a mapping from a container registry to the identity used to connect to it. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar cpu: Required CPU in cores, e.g. 0.5. - :vartype cpu: float - :ivar memory: Required memory, e.g. "250Mb". - :vartype memory: str - :ivar ephemeral_storage: Ephemeral Storage, e.g. "1Gi". - :vartype ephemeral_storage: str + :ivar container_registry_server: Login server of the container registry. Required. + :vartype container_registry_server: str + :ivar identity_resource_id: Resource ID of the managed identity. Required. + :vartype identity_resource_id: str """ _validation = { - "ephemeral_storage": {"readonly": True}, + "container_registry_server": {"required": True}, + "identity_resource_id": {"required": True}, } _attribute_map = { - "cpu": {"key": "cpu", "type": "float"}, - "memory": {"key": "memory", "type": "str"}, - "ephemeral_storage": {"key": "ephemeralStorage", "type": "str"}, + "container_registry_server": {"key": "containerRegistryServer", "type": "str"}, + "identity_resource_id": {"key": "identityResourceId", "type": "str"}, } - def __init__(self, *, cpu: Optional[float] = None, memory: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, container_registry_server: str, identity_resource_id: str, **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 + :keyword container_registry_server: Login server of the container registry. Required. + :paramtype container_registry_server: str + :keyword identity_resource_id: Resource ID of the managed identity. Required. + :paramtype identity_resource_id: str """ super().__init__(**kwargs) - self.cpu = cpu - self.memory = memory - self.ephemeral_storage = None + self.container_registry_server = container_registry_server + self.identity_resource_id = identity_resource_id -class CookieExpiration(_serialization.Model): - """The configuration settings of the session cookie's expiration. +class ContainerRegistryWithCustomImage(_serialization.Model): + """Container registry that the final image will be uploaded to. - :ivar convention: The convention used when determining the session cookie's expiration. Known + All required parameters must be populated in order to send to Azure. + + :ivar server: Login server of the container registry that the final image should be uploaded + to. Builder resource needs to have this container registry defined along with an identity to + use to access it. Required. + :vartype server: str + :ivar image: Full name that the final image should be uploaded as, including both image name + and tag. + :vartype image: str + """ + + _validation = { + "server": {"required": True}, + } + + _attribute_map = { + "server": {"key": "server", "type": "str"}, + "image": {"key": "image", "type": "str"}, + } + + def __init__(self, *, server: str, image: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword server: Login server of the container registry that the final image should be uploaded + to. Builder resource needs to have this container registry defined along with an identity to + use to access it. Required. + :paramtype server: str + :keyword image: Full name that the final image should be uploaded as, including both image name + and tag. + :paramtype image: str + """ + super().__init__(**kwargs) + self.server = server + self.image = image + + +class ContainerResources(_serialization.Model): + """Container App container resource requirements. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Required CPU in cores, e.g. 0.5. + :vartype cpu: float + :ivar memory: Required memory, e.g. "250Mb". + :vartype memory: str + :ivar ephemeral_storage: Ephemeral Storage, e.g. "1Gi". + :vartype ephemeral_storage: str + """ + + _validation = { + "ephemeral_storage": {"readonly": True}, + } + + _attribute_map = { + "cpu": {"key": "cpu", "type": "float"}, + "memory": {"key": "memory", "type": "str"}, + "ephemeral_storage": {"key": "ephemeralStorage", "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 + self.ephemeral_storage = None + + +class CookieExpiration(_serialization.Model): + """The configuration settings of the session cookie's expiration. + + :ivar convention: The convention used when determining the session cookie's expiration. Known values are: "FixedTime" and "IdentityProviderDerived". :vartype convention: str or ~azure.mgmt.appcontainers.models.CookieExpirationConvention :ivar time_to_expiration: The time after the request is made when the session cookie should @@ -3165,6 +3848,10 @@ class DaprComponent(ProxyResource): # pylint: disable=too-many-instance-attribu :vartype metadata: list[~azure.mgmt.appcontainers.models.DaprMetadata] :ivar scopes: Names of container apps that can use this Dapr component. :vartype scopes: list[str] + :ivar service_component_bind: List of container app services that are bound to the Dapr + component. + :vartype service_component_bind: + list[~azure.mgmt.appcontainers.models.DaprComponentServiceBinding] """ _validation = { @@ -3187,6 +3874,7 @@ class DaprComponent(ProxyResource): # pylint: disable=too-many-instance-attribu "secret_store_component": {"key": "properties.secretStoreComponent", "type": "str"}, "metadata": {"key": "properties.metadata", "type": "[DaprMetadata]"}, "scopes": {"key": "properties.scopes", "type": "[str]"}, + "service_component_bind": {"key": "properties.serviceComponentBind", "type": "[DaprComponentServiceBinding]"}, } def __init__( @@ -3200,6 +3888,7 @@ def __init__( secret_store_component: Optional[str] = None, metadata: Optional[List["_models.DaprMetadata"]] = None, scopes: Optional[List[str]] = None, + service_component_bind: Optional[List["_models.DaprComponentServiceBinding"]] = None, **kwargs: Any ) -> None: """ @@ -3219,167 +3908,716 @@ def __init__( :paramtype metadata: list[~azure.mgmt.appcontainers.models.DaprMetadata] :keyword scopes: Names of container apps that can use this Dapr component. :paramtype scopes: list[str] + :keyword service_component_bind: List of container app services that are bound to the Dapr + component. + :paramtype service_component_bind: + list[~azure.mgmt.appcontainers.models.DaprComponentServiceBinding] + """ + super().__init__(**kwargs) + self.component_type = component_type + self.version = version + self.ignore_errors = ignore_errors + self.init_timeout = init_timeout + self.secrets = secrets + self.secret_store_component = secret_store_component + self.metadata = metadata + self.scopes = scopes + self.service_component_bind = service_component_bind + + +class DaprComponentResiliencyPoliciesCollection(_serialization.Model): + """Dapr Component Resiliency Policies ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] + :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": "[DaprComponentResiliencyPolicy]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.DaprComponentResiliencyPolicy"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class DaprComponentResiliencyPolicy(ProxyResource): + """Dapr Component Resiliency Policy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar inbound_policy: The optional inbound component resiliency policy configuration. + :vartype inbound_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyConfiguration + :ivar outbound_policy: The optional outbound component resiliency policy configuration. + :vartype outbound_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyConfiguration + """ + + _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"}, + "inbound_policy": {"key": "properties.inboundPolicy", "type": "DaprComponentResiliencyPolicyConfiguration"}, + "outbound_policy": {"key": "properties.outboundPolicy", "type": "DaprComponentResiliencyPolicyConfiguration"}, + } + + def __init__( + self, + *, + inbound_policy: Optional["_models.DaprComponentResiliencyPolicyConfiguration"] = None, + outbound_policy: Optional["_models.DaprComponentResiliencyPolicyConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword inbound_policy: The optional inbound component resiliency policy configuration. + :paramtype inbound_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyConfiguration + :keyword outbound_policy: The optional outbound component resiliency policy configuration. + :paramtype outbound_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyConfiguration + """ + super().__init__(**kwargs) + self.inbound_policy = inbound_policy + self.outbound_policy = outbound_policy + + +class DaprComponentResiliencyPolicyConfiguration(_serialization.Model): + """Dapr Component Resiliency Policy Configuration. + + :ivar http_retry_policy: The optional HTTP retry policy configuration. + :vartype http_retry_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration + :ivar timeout_policy: The optional timeout policy configuration. + :vartype timeout_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration + """ + + _attribute_map = { + "http_retry_policy": { + "key": "httpRetryPolicy", + "type": "DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration", + }, + "timeout_policy": {"key": "timeoutPolicy", "type": "DaprComponentResiliencyPolicyTimeoutPolicyConfiguration"}, + } + + def __init__( + self, + *, + http_retry_policy: Optional["_models.DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration"] = None, + timeout_policy: Optional["_models.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword http_retry_policy: The optional HTTP retry policy configuration. + :paramtype http_retry_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration + :keyword timeout_policy: The optional timeout policy configuration. + :paramtype timeout_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration + """ + super().__init__(**kwargs) + self.http_retry_policy = http_retry_policy + self.timeout_policy = timeout_policy + + +class DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration(_serialization.Model): + """Dapr Component Resiliency Policy HTTP Retry Backoff Configuration. + + :ivar initial_delay_in_milliseconds: The optional initial delay in milliseconds before an + operation is retried. + :vartype initial_delay_in_milliseconds: int + :ivar max_interval_in_milliseconds: The optional maximum time interval in milliseconds between + retry attempts. + :vartype max_interval_in_milliseconds: int + """ + + _attribute_map = { + "initial_delay_in_milliseconds": {"key": "initialDelayInMilliseconds", "type": "int"}, + "max_interval_in_milliseconds": {"key": "maxIntervalInMilliseconds", "type": "int"}, + } + + def __init__( + self, + *, + initial_delay_in_milliseconds: Optional[int] = None, + max_interval_in_milliseconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword initial_delay_in_milliseconds: The optional initial delay in milliseconds before an + operation is retried. + :paramtype initial_delay_in_milliseconds: int + :keyword max_interval_in_milliseconds: The optional maximum time interval in milliseconds + between retry attempts. + :paramtype max_interval_in_milliseconds: int + """ + super().__init__(**kwargs) + self.initial_delay_in_milliseconds = initial_delay_in_milliseconds + self.max_interval_in_milliseconds = max_interval_in_milliseconds + + +class DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration(_serialization.Model): + """Dapr Component Resiliency Policy HTTP Retry Policy Configuration. + + :ivar max_retries: The optional maximum number of retries. + :vartype max_retries: int + :ivar retry_back_off: The optional retry backoff configuration. + :vartype retry_back_off: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration + """ + + _attribute_map = { + "max_retries": {"key": "maxRetries", "type": "int"}, + "retry_back_off": {"key": "retryBackOff", "type": "DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration"}, + } + + def __init__( + self, + *, + max_retries: Optional[int] = None, + retry_back_off: Optional["_models.DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword max_retries: The optional maximum number of retries. + :paramtype max_retries: int + :keyword retry_back_off: The optional retry backoff configuration. + :paramtype retry_back_off: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration + """ + super().__init__(**kwargs) + self.max_retries = max_retries + self.retry_back_off = retry_back_off + + +class DaprComponentResiliencyPolicyTimeoutPolicyConfiguration(_serialization.Model): + """Dapr Component Resiliency Policy Timeout Policy Configuration. + + :ivar response_timeout_in_seconds: The optional response timeout in seconds. + :vartype response_timeout_in_seconds: int + """ + + _attribute_map = { + "response_timeout_in_seconds": {"key": "responseTimeoutInSeconds", "type": "int"}, + } + + def __init__(self, *, response_timeout_in_seconds: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword response_timeout_in_seconds: The optional response timeout in seconds. + :paramtype response_timeout_in_seconds: int + """ + super().__init__(**kwargs) + self.response_timeout_in_seconds = response_timeout_in_seconds + + +class DaprComponentsCollection(_serialization.Model): + """Dapr Components ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.DaprComponent] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DaprComponent]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.DaprComponent"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.DaprComponent] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class DaprComponentServiceBinding(_serialization.Model): + """Configuration to bind a Dapr Component to a dev ContainerApp Service. + + :ivar name: Name of the service bind. + :vartype name: str + :ivar service_id: Resource id of the target service. + :vartype service_id: str + :ivar metadata: Service bind metadata. + :vartype metadata: ~azure.mgmt.appcontainers.models.DaprServiceBindMetadata + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "service_id": {"key": "serviceId", "type": "str"}, + "metadata": {"key": "metadata", "type": "DaprServiceBindMetadata"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + service_id: Optional[str] = None, + metadata: Optional["_models.DaprServiceBindMetadata"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the service bind. + :paramtype name: str + :keyword service_id: Resource id of the target service. + :paramtype service_id: str + :keyword metadata: Service bind metadata. + :paramtype metadata: ~azure.mgmt.appcontainers.models.DaprServiceBindMetadata + """ + super().__init__(**kwargs) + self.name = name + self.service_id = service_id + self.metadata = metadata + + +class DaprConfiguration(_serialization.Model): + """Configuration properties Dapr component. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar version: The version of Dapr. + :vartype version: str + """ + + _validation = { + "version": {"readonly": True}, + } + + _attribute_map = { + "version": {"key": "version", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.version = None + + +class DaprMetadata(_serialization.Model): + """Dapr component metadata. + + :ivar name: Metadata property name. + :vartype name: str + :ivar value: Metadata property value. + :vartype value: str + :ivar secret_ref: Name of the Dapr Component secret from which to pull the metadata property + value. + :vartype secret_ref: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + "secret_ref": {"key": "secretRef", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + secret_ref: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Metadata property name. + :paramtype name: str + :keyword value: Metadata property value. + :paramtype value: str + :keyword secret_ref: Name of the Dapr Component secret from which to pull the metadata property + value. + :paramtype secret_ref: str + """ + super().__init__(**kwargs) + self.name = name + self.value = value + self.secret_ref = secret_ref + + +class DaprSecret(_serialization.Model): + """Dapr component Secret for ListSecrets Action. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Secret Name. + :vartype name: str + :ivar value: Secret Value. + :vartype value: str + """ + + _validation = { + "name": {"readonly": True}, + "value": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.value = None + + +class DaprSecretsCollection(_serialization.Model): + """Dapr component Secrets Collection for ListSecrets Action. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Collection of secrets used by a Dapr component. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.DaprSecret] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DaprSecret]"}, + } + + def __init__(self, *, value: List["_models.DaprSecret"], **kwargs: Any) -> None: + """ + :keyword value: Collection of secrets used by a Dapr component. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.DaprSecret] + """ + super().__init__(**kwargs) + self.value = value + + +class DaprServiceBindMetadata(_serialization.Model): + """Dapr component metadata. + + :ivar name: Service bind metadata property name. + :vartype name: str + :ivar value: Service bind metadata property value. + :vartype value: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Service bind metadata property name. + :paramtype name: str + :keyword value: Service bind metadata property value. + :paramtype value: str + """ + super().__init__(**kwargs) + self.name = name + self.value = value + + +class DaprSubscription(ProxyResource): # pylint: disable=too-many-instance-attributes + """Dapr PubSub Event Subscription. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar pubsub_name: Dapr PubSub component name. + :vartype pubsub_name: str + :ivar topic: Topic name. + :vartype topic: str + :ivar dead_letter_topic: Deadletter topic name. + :vartype dead_letter_topic: str + :ivar routes: Subscription routes. + :vartype routes: ~azure.mgmt.appcontainers.models.DaprSubscriptionRoutes + :ivar scopes: Application scopes to restrict the subscription to specific apps. + :vartype scopes: list[str] + :ivar metadata: Subscription metadata. + :vartype metadata: dict[str, str] + :ivar bulk_subscribe: Bulk subscription options. + :vartype bulk_subscribe: ~azure.mgmt.appcontainers.models.DaprSubscriptionBulkSubscribeOptions + """ + + _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"}, + "pubsub_name": {"key": "properties.pubsubName", "type": "str"}, + "topic": {"key": "properties.topic", "type": "str"}, + "dead_letter_topic": {"key": "properties.deadLetterTopic", "type": "str"}, + "routes": {"key": "properties.routes", "type": "DaprSubscriptionRoutes"}, + "scopes": {"key": "properties.scopes", "type": "[str]"}, + "metadata": {"key": "properties.metadata", "type": "{str}"}, + "bulk_subscribe": {"key": "properties.bulkSubscribe", "type": "DaprSubscriptionBulkSubscribeOptions"}, + } + + def __init__( + self, + *, + pubsub_name: Optional[str] = None, + topic: Optional[str] = None, + dead_letter_topic: Optional[str] = None, + routes: Optional["_models.DaprSubscriptionRoutes"] = None, + scopes: Optional[List[str]] = None, + metadata: Optional[Dict[str, str]] = None, + bulk_subscribe: Optional["_models.DaprSubscriptionBulkSubscribeOptions"] = None, + **kwargs: Any + ) -> None: + """ + :keyword pubsub_name: Dapr PubSub component name. + :paramtype pubsub_name: str + :keyword topic: Topic name. + :paramtype topic: str + :keyword dead_letter_topic: Deadletter topic name. + :paramtype dead_letter_topic: str + :keyword routes: Subscription routes. + :paramtype routes: ~azure.mgmt.appcontainers.models.DaprSubscriptionRoutes + :keyword scopes: Application scopes to restrict the subscription to specific apps. + :paramtype scopes: list[str] + :keyword metadata: Subscription metadata. + :paramtype metadata: dict[str, str] + :keyword bulk_subscribe: Bulk subscription options. + :paramtype bulk_subscribe: + ~azure.mgmt.appcontainers.models.DaprSubscriptionBulkSubscribeOptions """ super().__init__(**kwargs) - self.component_type = component_type - self.version = version - self.ignore_errors = ignore_errors - self.init_timeout = init_timeout - self.secrets = secrets - self.secret_store_component = secret_store_component - self.metadata = metadata + self.pubsub_name = pubsub_name + self.topic = topic + self.dead_letter_topic = dead_letter_topic + self.routes = routes self.scopes = scopes + self.metadata = metadata + self.bulk_subscribe = bulk_subscribe -class DaprComponentsCollection(_serialization.Model): - """Dapr Components ARM resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. +class DaprSubscriptionBulkSubscribeOptions(_serialization.Model): + """Dapr PubSub Bulk Subscription Options. - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.DaprComponent] - :ivar next_link: Link to next page of resources. - :vartype next_link: str + :ivar enabled: Enable bulk subscription. + :vartype enabled: bool + :ivar max_messages_count: Maximum number of messages to deliver in a bulk message. + :vartype max_messages_count: int + :ivar max_await_duration_ms: Maximum duration in milliseconds to wait before a bulk message is + sent to the app. + :vartype max_await_duration_ms: int """ - _validation = { - "value": {"required": True}, - "next_link": {"readonly": True}, - } - _attribute_map = { - "value": {"key": "value", "type": "[DaprComponent]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "enabled": {"key": "enabled", "type": "bool"}, + "max_messages_count": {"key": "maxMessagesCount", "type": "int"}, + "max_await_duration_ms": {"key": "maxAwaitDurationMs", "type": "int"}, } - def __init__(self, *, value: List["_models.DaprComponent"], **kwargs: Any) -> None: + def __init__( + self, + *, + enabled: bool = False, + max_messages_count: Optional[int] = None, + max_await_duration_ms: Optional[int] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.DaprComponent] + :keyword enabled: Enable bulk subscription. + :paramtype enabled: bool + :keyword max_messages_count: Maximum number of messages to deliver in a bulk message. + :paramtype max_messages_count: int + :keyword max_await_duration_ms: Maximum duration in milliseconds to wait before a bulk message + is sent to the app. + :paramtype max_await_duration_ms: int """ super().__init__(**kwargs) - self.value = value - self.next_link = None - + self.enabled = enabled + self.max_messages_count = max_messages_count + self.max_await_duration_ms = max_await_duration_ms -class DaprConfiguration(_serialization.Model): - """Configuration properties Dapr component. - Variables are only populated by the server, and will be ignored when sending a request. +class DaprSubscriptionRouteRule(_serialization.Model): + """Dapr Pubsub Event Subscription Route Rule is used to specify the condition for sending a + message to a specific path. - :ivar version: The version of Dapr. - :vartype version: str + :ivar match: The optional CEL expression used to match the event. If the match is not + specified, then the route is considered the default. The rules are tested in the order + specified, so they should be define from most-to-least specific. The default route should + appear last in the list. + :vartype match: str + :ivar path: The path for events that match this rule. + :vartype path: str """ - _validation = { - "version": {"readonly": True}, - } - _attribute_map = { - "version": {"key": "version", "type": "str"}, + "match": {"key": "match", "type": "str"}, + "path": {"key": "path", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, match: Optional[str] = None, path: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword match: The optional CEL expression used to match the event. If the match is not + specified, then the route is considered the default. The rules are tested in the order + specified, so they should be define from most-to-least specific. The default route should + appear last in the list. + :paramtype match: str + :keyword path: The path for events that match this rule. + :paramtype path: str + """ super().__init__(**kwargs) - self.version = None + self.match = match + self.path = path -class DaprMetadata(_serialization.Model): - """Dapr component metadata. +class DaprSubscriptionRoutes(_serialization.Model): + """Dapr PubSub Event Subscription Routes configuration. - :ivar name: Metadata property name. - :vartype name: str - :ivar value: Metadata property value. - :vartype value: str - :ivar secret_ref: Name of the Dapr Component secret from which to pull the metadata property - value. - :vartype secret_ref: str + :ivar rules: The list of Dapr PubSub Event Subscription Route Rules. + :vartype rules: list[~azure.mgmt.appcontainers.models.DaprSubscriptionRouteRule] + :ivar default: The default path to deliver events that do not match any of the rules. + :vartype default: str """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, - "secret_ref": {"key": "secretRef", "type": "str"}, + "rules": {"key": "rules", "type": "[DaprSubscriptionRouteRule]"}, + "default": {"key": "default", "type": "str"}, } def __init__( self, *, - name: Optional[str] = None, - value: Optional[str] = None, - secret_ref: Optional[str] = None, + rules: Optional[List["_models.DaprSubscriptionRouteRule"]] = None, + default: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword name: Metadata property name. - :paramtype name: str - :keyword value: Metadata property value. - :paramtype value: str - :keyword secret_ref: Name of the Dapr Component secret from which to pull the metadata property - value. - :paramtype secret_ref: str + :keyword rules: The list of Dapr PubSub Event Subscription Route Rules. + :paramtype rules: list[~azure.mgmt.appcontainers.models.DaprSubscriptionRouteRule] + :keyword default: The default path to deliver events that do not match any of the rules. + :paramtype default: str """ super().__init__(**kwargs) - self.name = name - self.value = value - self.secret_ref = secret_ref + self.rules = rules + self.default = default -class DaprSecret(_serialization.Model): - """Dapr component Secret for ListSecrets Action. +class DaprSubscriptionsCollection(_serialization.Model): + """Dapr Subscriptions ARM resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Secret Name. - :vartype name: str - :ivar value: Secret Value. - :vartype value: str + All required parameters must be populated in order to send to Azure. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.DaprSubscription] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ _validation = { - "name": {"readonly": True}, - "value": {"readonly": True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, + "value": {"key": "value", "type": "[DaprSubscription]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, value: List["_models.DaprSubscription"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.DaprSubscription] + """ super().__init__(**kwargs) - self.name = None - self.value = None - + self.value = value + self.next_link = None -class DaprSecretsCollection(_serialization.Model): - """Dapr component Secrets Collection for ListSecrets Action. - All required parameters must be populated in order to send to Azure. +class DataDogConfiguration(_serialization.Model): + """Configuration of datadog. - :ivar value: Collection of secrets used by a Dapr component. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.DaprSecret] + :ivar site: The data dog site. + :vartype site: str + :ivar key: The data dog api key. + :vartype key: str """ - _validation = { - "value": {"required": True}, - } - _attribute_map = { - "value": {"key": "value", "type": "[DaprSecret]"}, + "site": {"key": "site", "type": "str"}, + "key": {"key": "key", "type": "str"}, } - def __init__(self, *, value: List["_models.DaprSecret"], **kwargs: Any) -> None: + def __init__(self, *, site: Optional[str] = None, key: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: Collection of secrets used by a Dapr component. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.DaprSecret] + :keyword site: The data dog site. + :paramtype site: str + :keyword key: The data dog api key. + :paramtype key: str """ super().__init__(**kwargs) - self.value = value + self.site = site + self.key = key class DefaultAuthorizationPolicy(_serialization.Model): @@ -3521,6 +4759,28 @@ def __init__(self, **kwargs: Any) -> None: self.target = None +class DestinationsConfiguration(_serialization.Model): + """Configuration of Open Telemetry destinations. + + :ivar data_dog_configuration: Open telemetry datadog destination configuration. + :vartype data_dog_configuration: ~azure.mgmt.appcontainers.models.DataDogConfiguration + """ + + _attribute_map = { + "data_dog_configuration": {"key": "dataDogConfiguration", "type": "DataDogConfiguration"}, + } + + def __init__( + self, *, data_dog_configuration: Optional["_models.DataDogConfiguration"] = None, **kwargs: Any + ) -> None: + """ + :keyword data_dog_configuration: Open telemetry datadog destination configuration. + :paramtype data_dog_configuration: ~azure.mgmt.appcontainers.models.DataDogConfiguration + """ + super().__init__(**kwargs) + self.data_dog_configuration = data_dog_configuration + + class DiagnosticDataProviderMetadata(_serialization.Model): """Details of a diagnostics data provider. @@ -3988,6 +5248,43 @@ def __init__(self, **kwargs: Any) -> None: self.pes_id = None +class EncryptionSettings(_serialization.Model): + """The configuration settings of the secrets references of encryption key and signing key for + ContainerApp Service Authentication/Authorization. + + :ivar container_app_auth_encryption_secret_name: The secret name which is referenced for + EncryptionKey. + :vartype container_app_auth_encryption_secret_name: str + :ivar container_app_auth_signing_secret_name: The secret name which is referenced for + SigningKey. + :vartype container_app_auth_signing_secret_name: str + """ + + _attribute_map = { + "container_app_auth_encryption_secret_name": {"key": "containerAppAuthEncryptionSecretName", "type": "str"}, + "container_app_auth_signing_secret_name": {"key": "containerAppAuthSigningSecretName", "type": "str"}, + } + + def __init__( + self, + *, + container_app_auth_encryption_secret_name: Optional[str] = None, + container_app_auth_signing_secret_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword container_app_auth_encryption_secret_name: The secret name which is referenced for + EncryptionKey. + :paramtype container_app_auth_encryption_secret_name: str + :keyword container_app_auth_signing_secret_name: The secret name which is referenced for + SigningKey. + :paramtype container_app_auth_signing_secret_name: str + """ + super().__init__(**kwargs) + self.container_app_auth_encryption_secret_name = container_app_auth_encryption_secret_name + self.container_app_auth_signing_secret_name = container_app_auth_signing_secret_name + + class EnvironmentAuthToken(TrackedResource): """Environment Auth Token. @@ -4090,6 +5387,39 @@ def __init__( self.secret_ref = secret_ref +class EnvironmentVariable(_serialization.Model): + """Model representing an environment variable. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Environment variable name. Required. + :vartype name: str + :ivar value: Environment variable value. Required. + :vartype value: str + """ + + _validation = { + "name": {"required": True}, + "value": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, name: str, value: str, **kwargs: Any) -> None: + """ + :keyword name: Environment variable name. Required. + :paramtype name: str + :keyword value: Environment variable value. Required. + :paramtype value: str + """ + super().__init__(**kwargs) + self.name = name + self.value = value + + class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. @@ -4528,11 +5858,197 @@ def __init__( flow. :paramtype validation: ~azure.mgmt.appcontainers.models.AllowedAudiencesValidation """ - super().__init__(**kwargs) - self.enabled = enabled - self.registration = registration - self.login = login - self.validation = validation + super().__init__(**kwargs) + self.enabled = enabled + self.registration = registration + self.login = login + self.validation = validation + + +class HeaderMatch(_serialization.Model): + """Conditions required to match a header. + + :ivar header: Name of the header. + :vartype header: str + :ivar exact_match: Exact value of the header. + :vartype exact_match: str + :ivar prefix_match: Prefix value of the header. + :vartype prefix_match: str + :ivar suffix_match: Suffix value of the header. + :vartype suffix_match: str + :ivar regex_match: Regex value of the header. + :vartype regex_match: str + """ + + _attribute_map = { + "header": {"key": "header", "type": "str"}, + "exact_match": {"key": "match.exactMatch", "type": "str"}, + "prefix_match": {"key": "match.prefixMatch", "type": "str"}, + "suffix_match": {"key": "match.suffixMatch", "type": "str"}, + "regex_match": {"key": "match.regexMatch", "type": "str"}, + } + + def __init__( + self, + *, + header: Optional[str] = None, + exact_match: Optional[str] = None, + prefix_match: Optional[str] = None, + suffix_match: Optional[str] = None, + regex_match: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword header: Name of the header. + :paramtype header: str + :keyword exact_match: Exact value of the header. + :paramtype exact_match: str + :keyword prefix_match: Prefix value of the header. + :paramtype prefix_match: str + :keyword suffix_match: Suffix value of the header. + :paramtype suffix_match: str + :keyword regex_match: Regex value of the header. + :paramtype regex_match: str + """ + super().__init__(**kwargs) + self.header = header + self.exact_match = exact_match + self.prefix_match = prefix_match + self.suffix_match = suffix_match + self.regex_match = regex_match + + +class HttpConnectionPool(_serialization.Model): + """Defines parameters for http connection pooling. + + :ivar http1_max_pending_requests: Maximum number of pending http1 requests allowed. + :vartype http1_max_pending_requests: int + :ivar http2_max_requests: Maximum number of http2 requests allowed. + :vartype http2_max_requests: int + """ + + _attribute_map = { + "http1_max_pending_requests": {"key": "http1MaxPendingRequests", "type": "int"}, + "http2_max_requests": {"key": "http2MaxRequests", "type": "int"}, + } + + def __init__( + self, + *, + http1_max_pending_requests: Optional[int] = None, + http2_max_requests: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword http1_max_pending_requests: Maximum number of pending http1 requests allowed. + :paramtype http1_max_pending_requests: int + :keyword http2_max_requests: Maximum number of http2 requests allowed. + :paramtype http2_max_requests: int + """ + super().__init__(**kwargs) + self.http1_max_pending_requests = http1_max_pending_requests + self.http2_max_requests = http2_max_requests + + +class HttpGet(_serialization.Model): + """Model representing a http get request. + + All required parameters must be populated in order to send to Azure. + + :ivar url: URL to make HTTP GET request against. Required. + :vartype url: str + :ivar file_name: Name of the file that the request should be saved to. + :vartype file_name: str + :ivar headers: List of headers to send with the request. + :vartype headers: list[str] + """ + + _validation = { + "url": {"required": True}, + } + + _attribute_map = { + "url": {"key": "url", "type": "str"}, + "file_name": {"key": "fileName", "type": "str"}, + "headers": {"key": "headers", "type": "[str]"}, + } + + def __init__( + self, *, url: str, file_name: Optional[str] = None, headers: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :keyword url: URL to make HTTP GET request against. Required. + :paramtype url: str + :keyword file_name: Name of the file that the request should be saved to. + :paramtype file_name: str + :keyword headers: List of headers to send with the request. + :paramtype headers: list[str] + """ + super().__init__(**kwargs) + self.url = url + self.file_name = file_name + self.headers = headers + + +class HttpRetryPolicy(_serialization.Model): + """Policy that defines http request retry conditions. + + :ivar max_retries: Maximum number of times a request will retry. + :vartype max_retries: int + :ivar headers: Headers that must be present for a request to be retried. + :vartype headers: list[~azure.mgmt.appcontainers.models.HeaderMatch] + :ivar http_status_codes: Additional http status codes that can trigger a retry. + :vartype http_status_codes: list[int] + :ivar errors: Errors that can trigger a retry. + :vartype errors: list[str] + :ivar initial_delay_in_milliseconds: Initial delay, in milliseconds, before retrying a request. + :vartype initial_delay_in_milliseconds: int + :ivar max_interval_in_milliseconds: Maximum interval, in milliseconds, between retries. + :vartype max_interval_in_milliseconds: int + """ + + _attribute_map = { + "max_retries": {"key": "maxRetries", "type": "int"}, + "headers": {"key": "matches.headers", "type": "[HeaderMatch]"}, + "http_status_codes": {"key": "matches.httpStatusCodes", "type": "[int]"}, + "errors": {"key": "matches.errors", "type": "[str]"}, + "initial_delay_in_milliseconds": {"key": "retryBackOff.initialDelayInMilliseconds", "type": "int"}, + "max_interval_in_milliseconds": {"key": "retryBackOff.maxIntervalInMilliseconds", "type": "int"}, + } + + def __init__( + self, + *, + max_retries: Optional[int] = None, + headers: Optional[List["_models.HeaderMatch"]] = None, + http_status_codes: Optional[List[int]] = None, + errors: Optional[List[str]] = None, + initial_delay_in_milliseconds: Optional[int] = None, + max_interval_in_milliseconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword max_retries: Maximum number of times a request will retry. + :paramtype max_retries: int + :keyword headers: Headers that must be present for a request to be retried. + :paramtype headers: list[~azure.mgmt.appcontainers.models.HeaderMatch] + :keyword http_status_codes: Additional http status codes that can trigger a retry. + :paramtype http_status_codes: list[int] + :keyword errors: Errors that can trigger a retry. + :paramtype errors: list[str] + :keyword initial_delay_in_milliseconds: Initial delay, in milliseconds, before retrying a + request. + :paramtype initial_delay_in_milliseconds: int + :keyword max_interval_in_milliseconds: Maximum interval, in milliseconds, between retries. + :paramtype max_interval_in_milliseconds: int + """ + super().__init__(**kwargs) + self.max_retries = max_retries + self.headers = headers + self.http_status_codes = http_status_codes + self.errors = errors + self.initial_delay_in_milliseconds = initial_delay_in_milliseconds + self.max_interval_in_milliseconds = max_interval_in_milliseconds class HttpScaleRule(_serialization.Model): @@ -4753,6 +6269,8 @@ class Ingress(_serialization.Model): # pylint: disable=too-many-instance-attrib ~azure.mgmt.appcontainers.models.IngressClientCertificateMode :ivar cors_policy: CORS policy for container app. :vartype cors_policy: ~azure.mgmt.appcontainers.models.CorsPolicy + :ivar additional_port_mappings: Settings to expose additional ports on container app. + :vartype additional_port_mappings: list[~azure.mgmt.appcontainers.models.IngressPortMapping] """ _validation = { @@ -4772,6 +6290,7 @@ class Ingress(_serialization.Model): # pylint: disable=too-many-instance-attrib "sticky_sessions": {"key": "stickySessions", "type": "IngressStickySessions"}, "client_certificate_mode": {"key": "clientCertificateMode", "type": "str"}, "cors_policy": {"key": "corsPolicy", "type": "CorsPolicy"}, + "additional_port_mappings": {"key": "additionalPortMappings", "type": "[IngressPortMapping]"}, } def __init__( @@ -4788,6 +6307,7 @@ def __init__( sticky_sessions: Optional["_models.IngressStickySessions"] = None, client_certificate_mode: Optional[Union[str, "_models.IngressClientCertificateMode"]] = None, cors_policy: Optional["_models.CorsPolicy"] = None, + additional_port_mappings: Optional[List["_models.IngressPortMapping"]] = None, **kwargs: Any ) -> None: """ @@ -4820,6 +6340,8 @@ def __init__( ~azure.mgmt.appcontainers.models.IngressClientCertificateMode :keyword cors_policy: CORS policy for container app. :paramtype cors_policy: ~azure.mgmt.appcontainers.models.CorsPolicy + :keyword additional_port_mappings: Settings to expose additional ports on container app. + :paramtype additional_port_mappings: list[~azure.mgmt.appcontainers.models.IngressPortMapping] """ super().__init__(**kwargs) self.fqdn = None @@ -4834,6 +6356,50 @@ def __init__( self.sticky_sessions = sticky_sessions self.client_certificate_mode = client_certificate_mode self.cors_policy = cors_policy + self.additional_port_mappings = additional_port_mappings + + +class IngressPortMapping(_serialization.Model): + """Port mappings of container app ingress. + + All required parameters must be populated in order to send to Azure. + + :ivar external: Specifies whether the app port is accessible outside of the environment. + Required. + :vartype external: bool + :ivar target_port: Specifies the port user's container listens on. Required. + :vartype target_port: int + :ivar exposed_port: Specifies the exposed port for the target port. If not specified, it + defaults to target port. + :vartype exposed_port: int + """ + + _validation = { + "external": {"required": True}, + "target_port": {"required": True}, + } + + _attribute_map = { + "external": {"key": "external", "type": "bool"}, + "target_port": {"key": "targetPort", "type": "int"}, + "exposed_port": {"key": "exposedPort", "type": "int"}, + } + + def __init__(self, *, external: bool, target_port: int, exposed_port: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword external: Specifies whether the app port is accessible outside of the environment. + Required. + :paramtype external: bool + :keyword target_port: Specifies the port user's container listens on. Required. + :paramtype target_port: int + :keyword exposed_port: Specifies the exposed port for the target port. If not specified, it + defaults to target port. + :paramtype exposed_port: int + """ + super().__init__(**kwargs) + self.external = external + self.target_port = target_port + self.exposed_port = exposed_port class IngressStickySessions(_serialization.Model): @@ -5005,6 +6571,8 @@ class Job(TrackedResource): # pylint: disable=too-many-instance-attributes :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str + :ivar extended_location: The complex type of the extended location. + :vartype extended_location: ~azure.mgmt.appcontainers.models.ExtendedLocation :ivar identity: Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials in code. :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity @@ -5043,6 +6611,7 @@ class Job(TrackedResource): # pylint: disable=too-many-instance-attributes "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "environment_id": {"key": "properties.environmentId", "type": "str"}, @@ -5058,6 +6627,7 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, environment_id: Optional[str] = None, workload_profile_name: Optional[str] = None, @@ -5070,6 +6640,8 @@ def __init__( :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str + :keyword extended_location: The complex type of the extended location. + :paramtype extended_location: ~azure.mgmt.appcontainers.models.ExtendedLocation :keyword identity: Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials in code. :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity @@ -5083,6 +6655,7 @@ def __init__( :paramtype template: ~azure.mgmt.appcontainers.models.JobTemplate """ super().__init__(tags=tags, location=location, **kwargs) + self.extended_location = extended_location self.identity = identity self.provisioning_state = None self.environment_id = environment_id @@ -5534,6 +7107,8 @@ def __init__( class JobPatchProperties(_serialization.Model): """Container Apps Job resource specific properties. + :ivar extended_location: The complex type of the extended location. + :vartype extended_location: ~azure.mgmt.appcontainers.models.ExtendedLocation :ivar identity: Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials in code. :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity @@ -5544,6 +7119,7 @@ class JobPatchProperties(_serialization.Model): """ _attribute_map = { + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "tags": {"key": "tags", "type": "{str}"}, "properties": {"key": "properties", "type": "JobPatchPropertiesProperties"}, @@ -5552,12 +7128,15 @@ class JobPatchProperties(_serialization.Model): def __init__( self, *, + extended_location: Optional["_models.ExtendedLocation"] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, tags: Optional[Dict[str, str]] = None, properties: Optional["_models.JobPatchPropertiesProperties"] = None, **kwargs: Any ) -> None: """ + :keyword extended_location: The complex type of the extended location. + :paramtype extended_location: ~azure.mgmt.appcontainers.models.ExtendedLocation :keyword identity: Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials in code. :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity @@ -5567,6 +7146,7 @@ def __init__( :paramtype properties: ~azure.mgmt.appcontainers.models.JobPatchPropertiesProperties """ super().__init__(**kwargs) + self.extended_location = extended_location self.identity = identity self.tags = tags self.properties = properties @@ -5877,6 +7457,36 @@ def __init__(self, **kwargs: Any) -> None: self.version = None +class ListUsagesResult(_serialization.Model): + """ListUsagesResult. + + :ivar value: The list of compute resource usages. + :vartype value: list[~azure.mgmt.appcontainers.models.Usage] + :ivar next_link: The URI to fetch the next page of compute resource usage information. Call + ListNext() with this to fetch the next page of compute resource usage information. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Usage]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.Usage"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The list of compute resource usages. + :paramtype value: list[~azure.mgmt.appcontainers.models.Usage] + :keyword next_link: The URI to fetch the next page of compute resource usage information. Call + ListNext() with this to fetch the next page of compute resource usage information. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + class LogAnalyticsConfiguration(_serialization.Model): """Log Analytics configuration, must only be provided when destination is configured as 'log-analytics'. @@ -5885,23 +7495,38 @@ class LogAnalyticsConfiguration(_serialization.Model): :vartype customer_id: str :ivar shared_key: Log analytics customer key. :vartype shared_key: str + :ivar dynamic_json_columns: Boolean indicating whether to parse json string log into dynamic + json columns. + :vartype dynamic_json_columns: bool """ _attribute_map = { "customer_id": {"key": "customerId", "type": "str"}, "shared_key": {"key": "sharedKey", "type": "str"}, + "dynamic_json_columns": {"key": "dynamicJsonColumns", "type": "bool"}, } - def __init__(self, *, customer_id: Optional[str] = None, shared_key: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + customer_id: Optional[str] = None, + shared_key: Optional[str] = None, + dynamic_json_columns: Optional[bool] = None, + **kwargs: Any + ) -> None: """ :keyword customer_id: Log analytics customer id. :paramtype customer_id: str :keyword shared_key: Log analytics customer key. :paramtype shared_key: str + :keyword dynamic_json_columns: Boolean indicating whether to parse json string log into dynamic + json columns. + :paramtype dynamic_json_columns: bool """ super().__init__(**kwargs) self.customer_id = customer_id self.shared_key = shared_key + self.dynamic_json_columns = dynamic_json_columns class Login(_serialization.Model): @@ -5910,6 +7535,8 @@ class Login(_serialization.Model): :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 @@ -5926,6 +7553,7 @@ class Login(_serialization.Model): _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"}, @@ -5936,6 +7564,7 @@ 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, @@ -5945,6 +7574,8 @@ def __init__( """ :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`. :paramtype preserve_url_fragments_for_logins: bool @@ -5960,6 +7591,7 @@ def __init__( """ super().__init__(**kwargs) self.routes = routes + self.token_store = token_store self.preserve_url_fragments_for_logins = preserve_url_fragments_for_logins self.allowed_external_redirect_urls = allowed_external_redirect_urls self.cookie_expiration = cookie_expiration @@ -6006,6 +7638,26 @@ def __init__(self, *, scopes: Optional[List[str]] = None, **kwargs: Any) -> None self.scopes = scopes +class LogsConfiguration(_serialization.Model): + """Configuration of Open Telemetry logs. + + :ivar destinations: Open telemetry logs destinations. + :vartype destinations: list[str] + """ + + _attribute_map = { + "destinations": {"key": "destinations", "type": "[str]"}, + } + + def __init__(self, *, destinations: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword destinations: Open telemetry logs destinations. + :paramtype destinations: list[str] + """ + super().__init__(**kwargs) + self.destinations = destinations + + class ManagedCertificate(TrackedResource): """Managed certificates used for Custom Domain bindings of Container Apps in a Managed Environment. @@ -6230,6 +7882,11 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- app logs to a destination. Currently only "log-analytics" is supported. :vartype app_logs_configuration: ~azure.mgmt.appcontainers.models.AppLogsConfiguration + :ivar app_insights_configuration: Environment level Application Insights configuration. + :vartype app_insights_configuration: ~azure.mgmt.appcontainers.models.AppInsightsConfiguration + :ivar open_telemetry_configuration: Environment Open Telemetry configuration. + :vartype open_telemetry_configuration: + ~azure.mgmt.appcontainers.models.OpenTelemetryConfiguration :ivar zone_redundant: Whether or not this Managed Environment is zone-redundant. :vartype zone_redundant: bool :ivar custom_domain_configuration: Custom domain configuration for the environment. @@ -6281,6 +7938,14 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- "default_domain": {"key": "properties.defaultDomain", "type": "str"}, "static_ip": {"key": "properties.staticIp", "type": "str"}, "app_logs_configuration": {"key": "properties.appLogsConfiguration", "type": "AppLogsConfiguration"}, + "app_insights_configuration": { + "key": "properties.appInsightsConfiguration", + "type": "AppInsightsConfiguration", + }, + "open_telemetry_configuration": { + "key": "properties.openTelemetryConfiguration", + "type": "OpenTelemetryConfiguration", + }, "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"}, "custom_domain_configuration": { "key": "properties.customDomainConfiguration", @@ -6297,7 +7962,7 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- }, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -6307,6 +7972,8 @@ def __init__( dapr_ai_connection_string: Optional[str] = None, vnet_configuration: Optional["_models.VnetConfiguration"] = None, app_logs_configuration: Optional["_models.AppLogsConfiguration"] = None, + app_insights_configuration: Optional["_models.AppInsightsConfiguration"] = None, + open_telemetry_configuration: Optional["_models.OpenTelemetryConfiguration"] = None, zone_redundant: Optional[bool] = None, custom_domain_configuration: Optional["_models.CustomDomainConfiguration"] = None, workload_profiles: Optional[List["_models.WorkloadProfile"]] = None, @@ -6335,6 +8002,12 @@ def __init__( app logs to a destination. Currently only "log-analytics" is supported. :paramtype app_logs_configuration: ~azure.mgmt.appcontainers.models.AppLogsConfiguration + :keyword app_insights_configuration: Environment level Application Insights configuration. + :paramtype app_insights_configuration: + ~azure.mgmt.appcontainers.models.AppInsightsConfiguration + :keyword open_telemetry_configuration: Environment Open Telemetry configuration. + :paramtype open_telemetry_configuration: + ~azure.mgmt.appcontainers.models.OpenTelemetryConfiguration :keyword zone_redundant: Whether or not this Managed Environment is zone-redundant. :paramtype zone_redundant: bool :keyword custom_domain_configuration: Custom domain configuration for the environment. @@ -6364,6 +8037,8 @@ def __init__( self.default_domain = None self.static_ip = None self.app_logs_configuration = app_logs_configuration + self.app_insights_configuration = app_insights_configuration + self.open_telemetry_configuration = open_telemetry_configuration self.zone_redundant = zone_redundant self.custom_domain_configuration = custom_domain_configuration self.event_stream_endpoint = None @@ -6583,6 +8258,26 @@ def __init__( self.user_assigned_identities = user_assigned_identities +class MetricsConfiguration(_serialization.Model): + """Configuration of Open Telemetry metrics. + + :ivar destinations: Open telemetry metrics destinations. + :vartype destinations: list[str] + """ + + _attribute_map = { + "destinations": {"key": "destinations", "type": "[str]"}, + } + + def __init__(self, *, destinations: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword destinations: Open telemetry metrics destinations. + :paramtype destinations: list[str] + """ + super().__init__(**kwargs) + self.destinations = destinations + + class Mtls(_serialization.Model): """Configuration properties for mutual TLS authentication. @@ -6797,6 +8492,53 @@ def __init__( self.open_id_connect_configuration = open_id_connect_configuration +class OpenTelemetryConfiguration(_serialization.Model): + """Configuration of Open Telemetry. + + :ivar destinations_configuration: Open telemetry destinations configuration. + :vartype destinations_configuration: ~azure.mgmt.appcontainers.models.DestinationsConfiguration + :ivar traces_configuration: Open telemetry trace configuration. + :vartype traces_configuration: ~azure.mgmt.appcontainers.models.TracesConfiguration + :ivar logs_configuration: Open telemetry logs configuration. + :vartype logs_configuration: ~azure.mgmt.appcontainers.models.LogsConfiguration + :ivar metrics_configuration: Open telemetry metrics configuration. + :vartype metrics_configuration: ~azure.mgmt.appcontainers.models.MetricsConfiguration + """ + + _attribute_map = { + "destinations_configuration": {"key": "destinationsConfiguration", "type": "DestinationsConfiguration"}, + "traces_configuration": {"key": "tracesConfiguration", "type": "TracesConfiguration"}, + "logs_configuration": {"key": "logsConfiguration", "type": "LogsConfiguration"}, + "metrics_configuration": {"key": "metricsConfiguration", "type": "MetricsConfiguration"}, + } + + def __init__( + self, + *, + destinations_configuration: Optional["_models.DestinationsConfiguration"] = None, + traces_configuration: Optional["_models.TracesConfiguration"] = None, + logs_configuration: Optional["_models.LogsConfiguration"] = None, + metrics_configuration: Optional["_models.MetricsConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword destinations_configuration: Open telemetry destinations configuration. + :paramtype destinations_configuration: + ~azure.mgmt.appcontainers.models.DestinationsConfiguration + :keyword traces_configuration: Open telemetry trace configuration. + :paramtype traces_configuration: ~azure.mgmt.appcontainers.models.TracesConfiguration + :keyword logs_configuration: Open telemetry logs configuration. + :paramtype logs_configuration: ~azure.mgmt.appcontainers.models.LogsConfiguration + :keyword metrics_configuration: Open telemetry metrics configuration. + :paramtype metrics_configuration: ~azure.mgmt.appcontainers.models.MetricsConfiguration + """ + super().__init__(**kwargs) + self.destinations_configuration = destinations_configuration + self.traces_configuration = traces_configuration + self.logs_configuration = logs_configuration + self.metrics_configuration = metrics_configuration + + class OperationDetail(_serialization.Model): """Operation detail payload. @@ -6889,6 +8631,45 @@ def __init__( self.description = description +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 QueueScaleRule(_serialization.Model): """Container App container Azure Queue based scaling rule. @@ -7585,23 +9366,43 @@ class ServiceBind(_serialization.Model): :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, **kwargs: Any) -> None: + 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 SourceControl(ProxyResource): @@ -7781,6 +9582,46 @@ def __init__( self.last_modified_at = last_modified_at +class TcpConnectionPool(_serialization.Model): + """Defines parameters for tcp connection pooling. + + :ivar max_connections: Maximum number of tcp connections allowed. + :vartype max_connections: int + """ + + _attribute_map = { + "max_connections": {"key": "maxConnections", "type": "int"}, + } + + def __init__(self, *, max_connections: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword max_connections: Maximum number of tcp connections allowed. + :paramtype max_connections: int + """ + super().__init__(**kwargs) + self.max_connections = max_connections + + +class TcpRetryPolicy(_serialization.Model): + """Policy that defines tcp request retry conditions. + + :ivar max_connect_attempts: Maximum number of attempts to connect to the tcp service. + :vartype max_connect_attempts: int + """ + + _attribute_map = { + "max_connect_attempts": {"key": "maxConnectAttempts", "type": "int"}, + } + + def __init__(self, *, max_connect_attempts: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword max_connect_attempts: Maximum number of attempts to connect to the tcp service. + :paramtype max_connect_attempts: int + """ + super().__init__(**kwargs) + self.max_connect_attempts = max_connect_attempts + + class TcpScaleRule(_serialization.Model): """Container App container Tcp scaling rule. @@ -7890,6 +9731,109 @@ def __init__( self.service_binds = service_binds +class TimeoutPolicy(_serialization.Model): + """Policy to set request timeouts. + + :ivar response_timeout_in_seconds: Timeout, in seconds, for a request to respond. + :vartype response_timeout_in_seconds: int + :ivar connection_timeout_in_seconds: Timeout, in seconds, for a request to initiate a + connection. + :vartype connection_timeout_in_seconds: int + """ + + _attribute_map = { + "response_timeout_in_seconds": {"key": "responseTimeoutInSeconds", "type": "int"}, + "connection_timeout_in_seconds": {"key": "connectionTimeoutInSeconds", "type": "int"}, + } + + def __init__( + self, + *, + response_timeout_in_seconds: Optional[int] = None, + connection_timeout_in_seconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword response_timeout_in_seconds: Timeout, in seconds, for a request to respond. + :paramtype response_timeout_in_seconds: int + :keyword connection_timeout_in_seconds: Timeout, in seconds, for a request to initiate a + connection. + :paramtype connection_timeout_in_seconds: int + """ + super().__init__(**kwargs) + self.response_timeout_in_seconds = response_timeout_in_seconds + self.connection_timeout_in_seconds = connection_timeout_in_seconds + + +class TokenStore(_serialization.Model): + """The configuration settings of the token store. + + :ivar enabled: :code:`true` to durably store platform-specific security tokens + that are obtained during login flows; otherwise, :code:`false`. + The default is :code:`false`. + :vartype enabled: bool + :ivar token_refresh_extension_hours: The number of hours after session token expiration that a + session token can be used to + call the token refresh API. The default is 72 hours. + :vartype token_refresh_extension_hours: float + :ivar azure_blob_storage: The configuration settings of the storage of the tokens if blob + storage is used. + :vartype azure_blob_storage: ~azure.mgmt.appcontainers.models.BlobStorageTokenStore + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "token_refresh_extension_hours": {"key": "tokenRefreshExtensionHours", "type": "float"}, + "azure_blob_storage": {"key": "azureBlobStorage", "type": "BlobStorageTokenStore"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + token_refresh_extension_hours: Optional[float] = None, + azure_blob_storage: Optional["_models.BlobStorageTokenStore"] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled: :code:`true` to durably store platform-specific security tokens + that are obtained during login flows; otherwise, :code:`false`. + The default is :code:`false`. + :paramtype enabled: bool + :keyword token_refresh_extension_hours: The number of hours after session token expiration that + a session token can be used to + call the token refresh API. The default is 72 hours. + :paramtype token_refresh_extension_hours: float + :keyword azure_blob_storage: The configuration settings of the storage of the tokens if blob + storage is used. + :paramtype azure_blob_storage: ~azure.mgmt.appcontainers.models.BlobStorageTokenStore + """ + super().__init__(**kwargs) + self.enabled = enabled + self.token_refresh_extension_hours = token_refresh_extension_hours + self.azure_blob_storage = azure_blob_storage + + +class TracesConfiguration(_serialization.Model): + """Configuration of Open Telemetry traces. + + :ivar destinations: Open telemetry traces destinations. + :vartype destinations: list[str] + """ + + _attribute_map = { + "destinations": {"key": "destinations", "type": "[str]"}, + } + + def __init__(self, *, destinations: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword destinations: Open telemetry traces destinations. + :paramtype destinations: list[str] + """ + super().__init__(**kwargs) + self.destinations = destinations + + class TrafficWeight(_serialization.Model): """Traffic weight assigned to a revision. @@ -8009,6 +9953,81 @@ def __init__( self.consumer_secret_setting_name = consumer_secret_setting_name +class Usage(_serialization.Model): + """Describes Compute Resource Usage. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar unit: An enum describing the unit of usage measurement. Required. Default value is + "Count". + :vartype unit: str + :ivar current_value: The current usage of the resource. Required. + :vartype current_value: float + :ivar limit: The maximum permitted usage of the resource. Required. + :vartype limit: float + :ivar name: The name of the type of usage. Required. + :vartype name: ~azure.mgmt.appcontainers.models.UsageName + """ + + _validation = { + "unit": {"required": True, "constant": True}, + "current_value": {"required": True}, + "limit": {"required": True}, + "name": {"required": True}, + } + + _attribute_map = { + "unit": {"key": "unit", "type": "str"}, + "current_value": {"key": "currentValue", "type": "float"}, + "limit": {"key": "limit", "type": "float"}, + "name": {"key": "name", "type": "UsageName"}, + } + + unit = "Count" + + def __init__(self, *, current_value: float, limit: float, name: "_models.UsageName", **kwargs: Any) -> None: + """ + :keyword current_value: The current usage of the resource. Required. + :paramtype current_value: float + :keyword limit: The maximum permitted usage of the resource. Required. + :paramtype limit: float + :keyword name: The name of the type of usage. Required. + :paramtype name: ~azure.mgmt.appcontainers.models.UsageName + """ + super().__init__(**kwargs) + self.current_value = current_value + self.limit = limit + self.name = name + + +class UsageName(_serialization.Model): + """The Usage Names. + + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "str"}, + "localized_value": {"key": "localizedValue", "type": "str"}, + } + + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The name of the resource. + :paramtype value: str + :keyword localized_value: The localized name of the resource. + :paramtype localized_value: str + """ + super().__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + class UserAssignedIdentity(_serialization.Model): """User assigned identity properties. 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 839be84fdb2f..63382b7b45ad 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 @@ -6,9 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._app_resiliency_operations import AppResiliencyOperations from ._container_apps_auth_configs_operations import ContainerAppsAuthConfigsOperations from ._available_workload_profiles_operations import AvailableWorkloadProfilesOperations from ._billing_meters_operations import BillingMetersOperations +from ._builders_operations import BuildersOperations +from ._builds_operations import BuildsOperations from ._connected_environments_operations import ConnectedEnvironmentsOperations from ._connected_environments_certificates_operations import ConnectedEnvironmentsCertificatesOperations from ._connected_environments_dapr_components_operations import ConnectedEnvironmentsDaprComponentsOperations @@ -19,8 +22,8 @@ from ._container_apps_diagnostics_operations import ContainerAppsDiagnosticsOperations from ._managed_environment_diagnostics_operations import ManagedEnvironmentDiagnosticsOperations from ._managed_environments_diagnostics_operations import ManagedEnvironmentsDiagnosticsOperations -from ._operations import Operations from ._jobs_operations import JobsOperations +from ._operations import Operations from ._jobs_executions_operations import JobsExecutionsOperations from ._container_apps_api_client_operations import ContainerAppsAPIClientOperationsMixin from ._managed_environments_operations import ManagedEnvironmentsOperations @@ -28,17 +31,24 @@ from ._managed_certificates_operations import ManagedCertificatesOperations from ._namespaces_operations import NamespacesOperations from ._dapr_components_operations import DaprComponentsOperations +from ._dapr_component_resiliency_policies_operations import DaprComponentResiliencyPoliciesOperations +from ._dapr_subscriptions_operations import DaprSubscriptionsOperations from ._managed_environments_storages_operations import ManagedEnvironmentsStoragesOperations from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations +from ._usages_operations import UsagesOperations +from ._managed_environment_usages_operations import ManagedEnvironmentUsagesOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ + "AppResiliencyOperations", "ContainerAppsAuthConfigsOperations", "AvailableWorkloadProfilesOperations", "BillingMetersOperations", + "BuildersOperations", + "BuildsOperations", "ConnectedEnvironmentsOperations", "ConnectedEnvironmentsCertificatesOperations", "ConnectedEnvironmentsDaprComponentsOperations", @@ -49,8 +59,8 @@ "ContainerAppsDiagnosticsOperations", "ManagedEnvironmentDiagnosticsOperations", "ManagedEnvironmentsDiagnosticsOperations", - "Operations", "JobsOperations", + "Operations", "JobsExecutionsOperations", "ContainerAppsAPIClientOperationsMixin", "ManagedEnvironmentsOperations", @@ -58,8 +68,12 @@ "ManagedCertificatesOperations", "NamespacesOperations", "DaprComponentsOperations", + "DaprComponentResiliencyPoliciesOperations", + "DaprSubscriptionsOperations", "ManagedEnvironmentsStoragesOperations", "ContainerAppsSourceControlsOperations", + "UsagesOperations", + "ManagedEnvironmentUsagesOperations", ] __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 new file mode 100644 index 000000000000..e1ab505115cc --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_app_resiliency_operations.py @@ -0,0 +1,778 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_or_update_request( + resource_group_name: str, app_name: str, 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", "2023-08-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}", + ) # 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 + ), + "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", 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_update_request( + resource_group_name: str, app_name: str, 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", "2023-08-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}", + ) # 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 + ), + "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", 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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, app_name: str, 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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}", + ) # 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 + ), + "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", 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_get_request( + resource_group_name: str, app_name: str, 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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}", + ) # 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 + ), + "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", 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_list_request(resource_group_name: str, 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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies", + ) # 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 + ), + "appName": _SERIALIZER.url("app_name", 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 AppResiliencyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`app_resiliency` 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") + + @overload + def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: _models.AppResiliency, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Required. + :type resiliency_envelope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: Union[_models.AppResiliency, IO], + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Is either a + AppResiliency type or a IO type. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.AppResiliency] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resiliency_envelope, (IOBase, bytes)): + _content = resiliency_envelope + else: + _json = self._serialize.body(resiliency_envelope, "AppResiliency") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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) + + if response.status_code == 200: + deserialized = self._deserialize("AppResiliency", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("AppResiliency", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}" + } + + @overload + def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: _models.AppResiliency, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Required. + :type resiliency_envelope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: Union[_models.AppResiliency, IO], + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Is either a AppResiliency type or + a IO type. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.AppResiliency] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resiliency_envelope, (IOBase, bytes)): + _content = resiliency_envelope + else: + _json = self._serialize.body(resiliency_envelope, "AppResiliency") + + request = build_update_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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("AppResiliency", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, app_name: str, name: str, **kwargs: Any + ) -> None: + """Delete an application's resiliency policy. + + Delete container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 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, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}" + } + + @distributed_trace + def get(self, resource_group_name: str, app_name: str, name: str, **kwargs: Any) -> _models.AppResiliency: + """Get an application's resiliency policy. + + Get container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.AppResiliency] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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("AppResiliency", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}" + } + + @distributed_trace + def list(self, resource_group_name: str, app_name: str, **kwargs: Any) -> Iterable["_models.AppResiliency"]: + """List an application's resiliency policies. + + List container app resiliency policies. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppResiliency or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.AppResiliency] + :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.AppResiliencyCollection] = kwargs.pop("cls", None) + + error_map = { + 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, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AppResiliencyCollection", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies" + } 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 a4512d46ae92..ceafe5a72275 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 @@ -40,7 +40,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +49,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt "/subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/availableManagedEnvironmentsWorkloadProfileTypes", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str", min_length=1), } 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 c14efc555e25..a5f73bd520e4 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 @@ -38,7 +38,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -46,7 +46,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/billingMeters" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str", min_length=1), } 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 new file mode 100644 index 000000000000..a6ce049a944d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py @@ -0,0 +1,1069 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, 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.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request + +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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/builders") + 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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders", + ) # 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, builder_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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}", + ) # 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 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, 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_create_or_update_request( + resource_group_name: str, builder_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", "2023-08-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}", + ) # 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 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, 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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, builder_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", "2023-08-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}", + ) # 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 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, 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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, builder_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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}", + ) # 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 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, 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 BuildersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`builders` 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.BuilderResource"]: + """List BuilderResource resources by subscription ID. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] + :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.BuilderCollection] = kwargs.pop("cls", None) + + error_map = { + 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, + template_url=self.list_by_subscription.metadata["url"], + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderCollection", 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) + + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/builders"} + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.BuilderResource"]: + """List BuilderResource resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] + :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.BuilderCollection] = kwargs.pop("cls", None) + + error_map = { + 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, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderCollection", 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) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders" + } + + @distributed_trace + def get(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> _models.BuilderResource: + """Get a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuilderResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuilderResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.BuilderResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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("BuilderResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO], + **kwargs: Any + ) -> _models.BuilderResource: + error_map = { + 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.BuilderResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_envelope, (IOBase, bytes)): + _content = builder_envelope + else: + _json = self._serialize.body(builder_envelope, "BuilderResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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) + + 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) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: _models.BuilderResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Required. + :type builder_envelope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO], + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Is either a BuilderResource type or a IO + type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :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.BuilderResource] = 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, + builder_name=builder_name, + builder_envelope=builder_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + def _update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO], + **kwargs: Any + ) -> Optional[_models.BuilderResource]: + error_map = { + 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[Optional[_models.BuilderResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_envelope, (IOBase, bytes)): + _content = builder_envelope + else: + _json = self._serialize.body(builder_envelope, "BuilderResourceUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = 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")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: _models.BuilderResourceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Required. + :type builder_envelope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO], + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Is either a + BuilderResourceUpdate type or a IO type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :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.BuilderResource] = 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, + builder_name=builder_name, + builder_envelope=builder_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, builder_name: str, **kwargs: Any + ) -> None: + error_map = { + 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, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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 [202, 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) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + builder_name=builder_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } 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 new file mode 100644 index 000000000000..160dacf58764 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py @@ -0,0 +1,844 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, 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.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request + +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_builder_resource_request( + resource_group_name: str, builder_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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/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 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, 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_get_request( + resource_group_name: str, builder_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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/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 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, 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_create_or_update_request( + resource_group_name: str, builder_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", "2023-08-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/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 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, 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 + 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, builder_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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/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 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, 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) + + +def build_list_auth_token_request( + resource_group_name: str, builder_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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}/listAuthToken", + ) # 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 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, 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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class BuildsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`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 list_by_builder_resource( + self, resource_group_name: str, builder_name: str, **kwargs: Any + ) -> Iterable["_models.BuildResource"]: + """List BuildResource resources by BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.BuildResource] + :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.BuildCollection] = kwargs.pop("cls", None) + + error_map = { + 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_builder_resource_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_builder_resource.metadata["url"], + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuildCollection", 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) + + list_by_builder_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds" + } + + @distributed_trace + def get(self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any) -> _models.BuildResource: + """Get a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.BuildResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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("BuildResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO], + **kwargs: Any + ) -> _models.BuildResource: + error_map = { + 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.BuildResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(build_envelope, (IOBase, bytes)): + _content = build_envelope + else: + _json = self._serialize.body(build_envelope, "BuildResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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) + + 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) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: _models.BuildResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Required. + :type build_envelope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO], + **kwargs: Any + ) -> LROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Is either a BuildResource type or + a IO type. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :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.BuildResource] = 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, + builder_name=builder_name, + build_name=build_name, + build_envelope=build_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> None: + error_map = { + 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, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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 [202, 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) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: 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( # type: ignore + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + } + + @distributed_trace + def list_auth_token( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> _models.BuildToken: + """Gets the token used to connect to the endpoint where source code can be uploaded for a build. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildToken or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildToken + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.BuildToken] = kwargs.pop("cls", None) + + request = build_list_auth_token_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_auth_token.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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("BuildToken", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_auth_token.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}/listAuthToken" + } 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 27f61a142e07..c622830504fc 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 @@ -43,7 +43,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -76,7 +76,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -110,7 +110,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +120,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -147,7 +147,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +156,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -181,7 +181,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -191,7 +191,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), 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 62a998e48a9b..a6436ab23b31 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 @@ -43,7 +43,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -80,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +89,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -118,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +128,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -159,7 +159,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +168,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -197,7 +197,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -207,7 +207,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), 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 231c1e56afd3..e0ebbe732eaf 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 @@ -43,7 +43,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -76,7 +76,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -110,7 +110,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +120,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -147,7 +147,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +156,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -181,7 +181,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,7 +190,7 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), 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 df60ba17c572..9933a61084c0 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 @@ -43,13 +43,13 @@ 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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/connectedEnvironments") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -67,7 +67,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +76,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -99,7 +99,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +108,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -132,7 +132,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -142,7 +142,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -168,7 +168,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -177,7 +177,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -201,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -210,7 +210,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -234,7 +234,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -244,7 +244,7 @@ def build_check_name_availability_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/checkNameAvailability", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), 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 137b91f69a70..bbe14c8a5784 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 @@ -41,7 +41,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,7 +50,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -74,7 +74,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +83,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -108,7 +108,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -118,7 +118,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -145,7 +145,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +154,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), 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 32fc8b154350..8a0448a4130c 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 @@ -40,7 +40,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +49,7 @@ def build_job_execution_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -70,6 +70,32 @@ def build_job_execution_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_get_custom_domain_verification_id_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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/getCustomDomainVerificationId" + ) # pylint: disable=line-too-long + 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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class ContainerAppsAPIClientOperationsMixin(ContainerAppsAPIClientMixinABC): @distributed_trace def job_execution( @@ -140,3 +166,59 @@ def job_execution( job_execution.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}" } + + @distributed_trace + def get_custom_domain_verification_id(self, **kwargs: Any) -> str: + """Get the verification id of a subscription used for verifying custom domains. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str or the result of cls(response) + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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_get_custom_domain_verification_id_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_custom_domain_verification_id.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_custom_domain_verification_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/getCustomDomainVerificationId" + } 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 4d5a8ba42b0b..8405729f7ae9 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 @@ -43,7 +43,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_list_by_container_app_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -76,7 +76,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -110,7 +110,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +120,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -147,7 +147,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +156,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), 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 c0b74244ccaa..8607201c0fd6 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 @@ -42,7 +42,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +51,7 @@ def build_list_detectors_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -75,7 +75,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +84,7 @@ def build_get_detector_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors/{detectorName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -114,7 +114,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +123,7 @@ def build_list_revisions_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -149,7 +149,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +158,7 @@ def build_get_revision_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/{revisionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -183,7 +183,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +192,7 @@ def build_get_root_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/rootApi/", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), 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 c34634c1b3c5..0ab7ee7d61c4 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 @@ -43,13 +43,13 @@ 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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -67,7 +67,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +76,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -99,7 +99,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +108,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -132,7 +132,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -142,7 +142,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -168,7 +168,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -177,7 +177,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -201,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -211,7 +211,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -242,7 +242,7 @@ def build_list_custom_host_name_analysis_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -251,7 +251,7 @@ def build_list_custom_host_name_analysis_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listCustomHostNameAnalysis", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -277,7 +277,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -286,7 +286,7 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -310,7 +310,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -319,7 +319,7 @@ def build_get_auth_token_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/getAuthtoken", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -343,7 +343,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -352,7 +352,7 @@ def build_start_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/start", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -378,7 +378,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -387,7 +387,7 @@ def build_stop_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/stop", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), 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 07d96073dab9..31e63554d8d4 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 @@ -45,7 +45,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_get_replica_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{replicaName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -80,7 +80,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +89,7 @@ def build_list_replicas_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), 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 f3b824f57146..b33cff86c492 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 @@ -47,7 +47,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_revisions_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -82,7 +82,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +91,7 @@ def build_get_revision_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -116,7 +116,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -125,7 +125,7 @@ def build_activate_revision_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/activate", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -150,7 +150,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -159,7 +159,7 @@ def build_deactivate_revision_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/deactivate", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -184,7 +184,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -193,7 +193,7 @@ def build_restart_revision_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/restart", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), 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 b63b5e798db5..5eecf79010e5 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 @@ -45,7 +45,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_list_by_container_app_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -78,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +87,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -112,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -122,7 +122,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -149,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +158,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), 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 new file mode 100644 index 000000000000..34d3b0a9da16 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_component_resiliency_policies_operations.py @@ -0,0 +1,617 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request + +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, component_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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies", + ) # 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\._\(\)]+$"), + "componentName": _SERIALIZER.url("component_name", component_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, component_name: str, 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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}", + ) # 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\._\(\)]+$"), + "componentName": _SERIALIZER.url("component_name", component_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", 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, component_name: str, 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", "2023-08-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}", + ) # 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\._\(\)]+$"), + "componentName": _SERIALIZER.url("component_name", component_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", 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, component_name: str, 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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}", + ) # 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\._\(\)]+$"), + "componentName": _SERIALIZER.url("component_name", component_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", 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 DaprComponentResiliencyPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`dapr_component_resiliency_policies` 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, component_name: str, **kwargs: Any + ) -> Iterable["_models.DaprComponentResiliencyPolicy"]: + """Get the resiliency policies for a Dapr component. + + Get the resiliency policies for a Dapr component. + + :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 component_name: Name of the Dapr Component. Required. + :type component_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DaprComponentResiliencyPolicy or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] + :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.DaprComponentResiliencyPoliciesCollection] = kwargs.pop("cls", None) + + error_map = { + 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, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DaprComponentResiliencyPoliciesCollection", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies" + } + + @distributed_trace + def get( + self, resource_group_name: str, environment_name: str, component_name: str, name: str, **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Get a Dapr component resiliency policy. + + Get a Dapr component resiliency policy. + + :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 component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.DaprComponentResiliencyPolicy] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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("DaprComponentResiliencyPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: _models.DaprComponentResiliencyPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :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 component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Required. + :type dapr_component_resiliency_policy_envelope: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :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 component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Required. + :type dapr_component_resiliency_policy_envelope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: Union[_models.DaprComponentResiliencyPolicy, IO], + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :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 component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Is either a DaprComponentResiliencyPolicy type or a IO type. Required. + :type dapr_component_resiliency_policy_envelope: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.DaprComponentResiliencyPolicy] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dapr_component_resiliency_policy_envelope, (IOBase, bytes)): + _content = dapr_component_resiliency_policy_envelope + else: + _json = self._serialize.body(dapr_component_resiliency_policy_envelope, "DaprComponentResiliencyPolicy") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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) + + if response.status_code == 200: + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, component_name: str, name: str, **kwargs: Any + ) -> None: + """Delete a Dapr component resiliency policy. + + Delete a resiliency policy for a Dapr component. + + :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 component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 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, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}" + } 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 13bdf064e305..d4dfd3cdc6b5 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 @@ -43,7 +43,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -76,7 +76,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -110,7 +110,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +120,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -147,7 +147,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +156,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -181,7 +181,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,7 +190,7 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), 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 new file mode 100644 index 000000000000..52140e0bc8ee --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_subscriptions_operations.py @@ -0,0 +1,588 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request + +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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions", + ) # 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, 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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}", + ) # 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\._\(\)]+$"), + "name": _SERIALIZER.url("name", 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, 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", "2023-08-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}", + ) # 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\._\(\)]+$"), + "name": _SERIALIZER.url("name", 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, 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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}", + ) # 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\._\(\)]+$"), + "name": _SERIALIZER.url("name", 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 DaprSubscriptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`dapr_subscriptions` 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.DaprSubscription"]: + """Get the Dapr subscriptions for a managed environment. + + Get the Dapr subscriptions for a 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DaprSubscription or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DaprSubscription] + :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.DaprSubscriptionsCollection] = kwargs.pop("cls", None) + + error_map = { + 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, + template_url=self.list.metadata["url"], + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DaprSubscriptionsCollection", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions" + } + + @distributed_trace + def get( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> _models.DaprSubscription: + """Get a dapr subscription. + + Get a dapr subscription. + + :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 name: Name of the Dapr subscription. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.DaprSubscription] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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("DaprSubscription", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: _models.DaprSubscription, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a 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 name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Required. + :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a 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 name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Required. + :type dapr_subscription_envelope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: Union[_models.DaprSubscription, IO], + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a 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 name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Is either a + DaprSubscription type or a IO type. Required. + :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.DaprSubscription] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dapr_subscription_envelope, (IOBase, bytes)): + _content = dapr_subscription_envelope + else: + _json = self._serialize.body(dapr_subscription_envelope, "DaprSubscription") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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) + + if response.status_code == 200: + deserialized = self._deserialize("DaprSubscription", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DaprSubscription", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> None: + """Delete a Dapr subscription. + + Delete a Dapr subscription from a 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 name: Name of the Dapr subscription. Required. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 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, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}" + } 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 8fb796cc10bb..c5f9bc79a4d2 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 @@ -42,7 +42,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +51,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), 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 8c365448a72c..d8bddab9a149 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,6 +7,7 @@ # 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, TypeVar, Union, cast, overload import urllib.parse @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,17 +44,119 @@ _SERIALIZER.client_side_validation = False +def build_list_detectors_request( + resource_group_name: str, job_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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectors", + ) # 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 + ), + "jobName": _SERIALIZER.url("job_name", job_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_detector_request( + resource_group_name: str, job_name: str, detector_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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectors/{detectorName}", + ) # 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 + ), + "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "detectorName": _SERIALIZER.url("detector_name", detector_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_proxy_get_request( + resource_group_name: str, job_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_name: Literal["rootApi"] = kwargs.pop("api_name", "rootApi") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectorProperties/{apiName}", + ) # 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 + ), + "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "apiName": _SERIALIZER.url("api_name", api_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_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", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/jobs") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -67,7 +174,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +183,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -97,7 +204,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,7 +213,7 @@ def build_get_request(resource_group_name: str, job_name: str, subscription_id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -130,7 +237,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -140,7 +247,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -164,7 +271,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -173,7 +280,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -195,7 +302,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -205,7 +312,7 @@ def build_update_request(resource_group_name: str, job_name: str, subscription_i "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -229,7 +336,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -239,7 +346,7 @@ def build_start_request(resource_group_name: str, job_name: str, subscription_id "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/start", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -265,7 +372,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -274,7 +381,7 @@ def build_stop_execution_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}/stop", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -301,7 +408,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,7 +417,7 @@ def build_stop_multiple_executions_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/stop", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -334,7 +441,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -343,7 +450,7 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -380,6 +487,211 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list_detectors(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models.DiagnosticsCollection: + """Get the list of diagnostics for a given Container App Job. + + Get the list of diagnostics for a Container App Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Job Name. Required. + :type job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DiagnosticsCollection or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DiagnosticsCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.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, + template_url=self.list_detectors.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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("DiagnosticsCollection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_detectors.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectors" + } + + @distributed_trace + def get_detector( + self, resource_group_name: str, job_name: str, detector_name: str, **kwargs: Any + ) -> _models.Diagnostics: + """Get the diagnostics data for a given Container App Job. + + Get the diagnostics data for a Container App Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Job Name. Required. + :type job_name: str + :param detector_name: Name of the Container App Job detector. Required. + :type detector_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Diagnostics or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.Diagnostics + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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.Diagnostics] = kwargs.pop("cls", None) + + request = build_get_detector_request( + resource_group_name=resource_group_name, + job_name=job_name, + detector_name=detector_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_detector.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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("Diagnostics", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_detector.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectors/{detectorName}" + } + + @distributed_trace + def proxy_get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models.Job: + """Get the properties for a given Container App Job. + + Get the properties of a Container App Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Job Name. Required. + :type job_name: str + :keyword api_name: Proxy API Name for Container App Job. Default value is "rootApi". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Job or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.Job + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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_name: Literal["rootApi"] = kwargs.pop("api_name", "rootApi") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Job] = kwargs.pop("cls", None) + + request = build_proxy_get_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_name=api_name, + api_version=api_version, + template_url=self.proxy_get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + 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("Job", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + proxy_get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectorProperties/{apiName}" + } + @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Job"]: """Get the Container Apps Jobs in a given subscription. 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 fae571bdf1bf..a7aa0bb2a8b8 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 @@ -45,7 +45,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -79,7 +79,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -89,7 +89,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -116,7 +116,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -125,7 +125,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -150,7 +150,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -160,7 +160,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -187,7 +187,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -196,7 +196,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), 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 d1bcbc91fd4b..85154ee83d9a 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 @@ -40,7 +40,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +49,7 @@ def build_list_detectors_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -73,7 +73,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +82,7 @@ def build_get_detector_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors/{detectorName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), 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 new file mode 100644 index 000000000000..82d23c9d932d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py @@ -0,0 +1,179 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request + +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", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/usages", + ) # 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 ManagedEnvironmentUsagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`managed_environment_usages` 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.Usage"]: + """Gets the current usage information as well as the limits for 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 Environment. Required. + :type environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Usage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.Usage] + :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.ListUsagesResult] = kwargs.pop("cls", None) + + error_map = { + 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, + template_url=self.list.metadata["url"], + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListUsagesResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/usages" + } 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 c3f01b2462f7..9d573afc8c94 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 @@ -40,7 +40,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +49,7 @@ def build_get_root_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectorProperties/rootApi/", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), 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 79a74f4d0ccc..6339f486d378 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 @@ -43,13 +43,13 @@ 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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -67,7 +67,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +76,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -99,7 +99,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +108,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -132,7 +132,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -142,7 +142,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -168,7 +168,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -177,7 +177,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -201,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -211,7 +211,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -237,7 +237,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -246,7 +246,7 @@ def build_get_auth_token_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/getAuthtoken", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -270,7 +270,7 @@ def build_list_workload_profile_states_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -279,7 +279,7 @@ def build_list_workload_profile_states_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/workloadProfileStates", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), 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 733f73c8967d..310bad16895d 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 @@ -41,7 +41,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,7 +50,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -74,7 +74,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +83,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -108,7 +108,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -118,7 +118,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -145,7 +145,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +154,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), 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 c18e4e341a53..4ad23e396846 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 @@ -41,7 +41,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -51,7 +51,7 @@ def build_check_name_availability_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/checkNameAvailability", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), 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 72dfb15cee16..ff1598a09bc2 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 @@ -40,7 +40,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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL 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 new file mode 100644 index 000000000000..32493dcf2b34 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py @@ -0,0 +1,168 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request + +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(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/usages" + ) + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), + "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) + + +class UsagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`usages` 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, location: str, **kwargs: Any) -> Iterable["_models.Usage"]: + """Gets, for the specified location, the current resource usage information as well as the limits + under the subscription. + + :param location: The location for which resource usage is queried. Required. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Usage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.Usage] + :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.ListUsagesResult] = kwargs.pop("cls", None) + + error_map = { + 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( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListUsagesResult", 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) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/usages"} 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 new file mode 100644 index 000000000000..1507068cdbb1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_create_or_update.py @@ -0,0 +1,60 @@ +# 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 app_resiliency_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(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.app_resiliency.create_or_update( + resource_group_name="rg", + app_name="testcontainerApp0", + name="resiliency-policy-1", + resiliency_envelope={ + "properties": { + "circuitBreakerPolicy": {"consecutiveErrors": 5, "intervalInSeconds": 10, "maxEjectionPercent": 50}, + "httpConnectionPool": {"http1MaxPendingRequests": 1024, "http2MaxRequests": 1024}, + "httpRetryPolicy": { + "matches": { + "errors": ["5xx", "connect-failure", "reset", "retriable-headers", "retriable-status-codes"], + "headers": [{"header": "X-Content-Type", "match": {"prefixMatch": "GOATS"}}], + "httpStatusCodes": [502, 503], + }, + "maxRetries": 5, + "retryBackOff": {"initialDelayInMilliseconds": 1000, "maxIntervalInMilliseconds": 10000}, + }, + "tcpConnectionPool": {"maxConnections": 100}, + "tcpRetryPolicy": {"maxConnectAttempts": 3}, + "timeoutPolicy": {"connectionTimeoutInSeconds": 5, "responseTimeoutInSeconds": 15}, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..57df744c46af --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_delete.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 app_resiliency_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(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + client.app_resiliency.delete( + resource_group_name="rg", + app_name="testcontainerApp0", + name="resiliency-policy-1", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..bbb249bcdb03 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_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 app_resiliency_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(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.app_resiliency.get( + resource_group_name="rg", + app_name="testcontainerApp0", + name="resiliency-policy-1", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..57a2b2d2acb1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_list.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 app_resiliency_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(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.app_resiliency.list( + resource_group_name="rg", + app_name="testcontainerApp0", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..7be419e585ce --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.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 app_resiliency_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, + 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(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.app_resiliency.update( + resource_group_name="rg", + app_name="testcontainerApp0", + name="resiliency-policy-1", + resiliency_envelope={ + "properties": {"timeoutPolicy": {"connectionTimeoutInSeconds": 40, "responseTimeoutInSeconds": 30}} + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 e933e3c96b01..0f65aa8c24b1 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 @@ -35,6 +35,10 @@ def main(): auth_config_name="current", auth_config_envelope={ "properties": { + "encryptionSettings": { + "containerAppAuthEncryptionSecretName": "testEncryptionSecretName", + "containerAppAuthSigningSecretName": "testSigningSecretName", + }, "globalValidation": {"unauthenticatedClientAction": "AllowAnonymous"}, "identityProviders": { "facebook": {"registration": {"appId": "123", "appSecretSettingName": "facebook-secret"}} @@ -46,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/AuthConfigs_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 d913c3efce8c..69bdd889b308 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 @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/AuthConfigs_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 c9d09e41f997..9fd36dac92e3 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/AuthConfigs_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 370df7f6cdaf..f3379ef0bf9b 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/AuthConfigs_ListByContainer.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 8ebff8a5ac89..de8d507738f4 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 @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/AvailableWorkloadProfiles_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 a5f9b32efea8..f9fab88a0aa5 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 @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/BillingMeters_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..eed3c8179a06 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py @@ -0,0 +1,64 @@ +# 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 builders_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(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builders.begin_create_or_update( + resource_group_name="rg", + builder_name="testBuilder", + builder_envelope={ + "identity": { + "type": "SystemAssigned,UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": {} + }, + }, + "location": "eastus", + "properties": { + "containerRegistries": [ + { + "containerRegistryServer": "test.azurecr.io", + "identityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", + }, + { + "containerRegistryServer": "test2.azurecr.io", + "identityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", + }, + ], + "environmentId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/managedEnvironments/testEnv", + }, + "tags": {"company": "Microsoft"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..3d88937d9888 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_delete.py @@ -0,0 +1,40 @@ +# 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 builders_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(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.builders.begin_delete( + resource_group_name="rg", + builder_name="testBuilder", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..d99b90eeea0d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_get.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 builders_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(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builders.get( + resource_group_name="rg", + builder_name="testBuilder", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..f63e6f240d02 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.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 builders_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(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builders.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/2023-08-01-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 new file mode 100644 index 000000000000..ee02a0f54f6e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.py @@ -0,0 +1,39 @@ +# 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 builders_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(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builders.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..dfaf6c2ef5f9 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.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 builders_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(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builders.begin_update( + resource_group_name="rg", + builder_name="testBuilder", + builder_envelope={"tags": {"mytag1": "myvalue1"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..f19acb7e3798 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py @@ -0,0 +1,69 @@ +# 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 builds_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(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builds.begin_create_or_update( + resource_group_name="rg", + builder_name="testBuilder", + build_name="testBuild-123456789az", + build_envelope={ + "properties": { + "configuration": { + "baseOs": "DebianBullseye", + "environmentVariables": [{"name": "foo1", "value": "bar1"}, {"name": "foo2", "value": "bar2"}], + "platform": "dotnetcore", + "platformVersion": "7.0", + "preBuildSteps": [ + { + "description": "First pre build step.", + "httpGet": { + "fileName": "output.txt", + "headers": ["foo", "bar"], + "url": "https://microsoft.com", + }, + "scripts": ["echo 'hello'", "echo 'world'"], + }, + { + "description": "Second pre build step.", + "httpGet": {"fileName": "output.txt", "headers": ["foo"], "url": "https://microsoft.com"}, + "scripts": ["echo 'hello'", "echo 'again'"], + }, + ], + }, + "destinationContainerRegistry": {"image": "test.azurecr.io/repo:tag", "server": "test.azurecr.io"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..83a6df1ed2eb --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_delete.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 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(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.builds.begin_delete( + resource_group_name="rg", + builder_name="testBuilder", + build_name="testBuild", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..dd36e8978bf5 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_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 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(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builds.get( + resource_group_name="rg", + builder_name="testBuilder", + build_name="testBuild", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..a6b6f9c60c5c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.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 builds_list_auth_token.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(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builds.list_auth_token( + resource_group_name="rg", + builder_name="testBuilder", + build_name="testBuild", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..b21f82058688 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.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 builds_list_by_builder_resource.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(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builds.list_by_builder_resource( + resource_group_name="rg", + builder_name="testBuilder", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 dea5245c2589..92fda68b9570 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Certificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-preview/examples/Certificate_CreateOrUpdate.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 9bedcdc0d2c4..c417939124d0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Certificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 62539bee8b81..8c452e283a4a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Certificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 af5b1bdad649..f39ae4da3e89 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 @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Certificates_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 680006d38a36..2a3fd0f3da48 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Certificates_ListByManagedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 1f2f47e01827..d4908aac0805 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Certificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 5dc0509c4cf9..c5d8e3c4e825 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsCertificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 2633d9418944..bf0827a41b09 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 @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsCertificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 546e64901b68..a4229bdf8f94 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsCertificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 e5ccd5834d34..a7b34371addc 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 @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsCertificates_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 9d5231c54a61..de45c44f2dfb 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsCertificates_ListByConnectedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 50ac15f55c98..0c0586b587e7 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsCertificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 024b703035d0..864eaf5bb223 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 @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironments_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 30ab1302e2e4..cdaae2f80bad 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 @@ -46,6 +46,13 @@ def main(): ], "scopes": ["container-app-1", "container-app-2"], "secrets": [{"name": "masterkey", "value": "keyvalue"}], + "serviceComponentBind": [ + { + "metadata": {"name": "daprcomponentBind", "value": "redis-bind"}, + "name": "statestore", + "serviceId": "/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis", + } + ], "version": "v1", } }, @@ -53,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsDaprComponents_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 94be51b901ab..6ed16e2332d3 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 @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsDaprComponents_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 034e8c27c470..96c726ba28fa 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsDaprComponents_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 929659d36ee9..abb3ea1f6f1c 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsDaprComponents_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 ea1924799cfe..192952e8d7fb 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 e91c1a4ad166..cbbe46445552 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 @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironments_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 8ecda7c844be..d78865b91946 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironments_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 a7437b6acabe..9e994f58c0dd 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 @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironments_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 31d38cb5e5dd..243f8b0e093e 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 @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironments_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 af6d619d9777..fc30767b823e 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironments_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 e4e7ab5a9df6..b6673b439cf6 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 @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsStorages_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 bca28941a160..c974c2d5e937 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 @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsStorages_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 97a62f342dd5..30cd118db2af 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsStorages_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 a90a72645a73..ae40445a310f 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsStorages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-preview/examples/ConnectedEnvironmentsStorages_List.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 5c35e5a4779f..0484638674bf 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 10fe12cf4049..89dc29d8c817 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 @@ -46,6 +46,10 @@ def main(): "logLevel": "debug", }, "ingress": { + "additionalPortMappings": [ + {"external": True, "targetPort": 1234}, + {"exposedPort": 3456, "external": False, "targetPort": 2345}, + ], "clientCertificateMode": "accept", "corsPolicy": { "allowCredentials": True, @@ -130,6 +134,8 @@ def main(): }, "serviceBinds": [ { + "clientType": "dotnet", + "customizedKeys": {"DesiredKey": "defaultKey"}, "name": "redisService", "serviceId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/redisService", } @@ -142,6 +148,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..c8eed1cbc2b2 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py @@ -0,0 +1,147 @@ +# 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_create_or_update_connected_environment.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(), + 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={ + "extendedLocation": { + "name": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation", + "type": "CustomLocation", + }, + "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/connectedEnvironments/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/connectedEnvironments/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, + }, + "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/connectedEnvironments/demokube", + "template": { + "containers": [ + { + "image": "repo/testcontainerApp0:v1", + "name": "testcontainerApp0", + "probes": [ + { + "httpGet": { + "httpHeaders": [{"name": "Custom-Header", "value": "Awesome"}], + "path": "/health", + "port": 8080, + }, + "initialDelaySeconds": 3, + "periodSeconds": 3, + "type": "Liveness", + } + ], + } + ], + "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", + } + ], + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 48c2756b876f..cb45bac0e929 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 @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 0761a61c008a..b5d800e86af8 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerAppsDiagnostics_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 5aa2868ba2f0..e3cf8b2170d5 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerAppsDiagnostics_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 c2559b742b38..0e6f4d6ebcb3 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 85cbd920a7aa..09e2659bc20e 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_GetAuthToken.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-preview/examples/ContainerApps_GetAuthToken.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 73845482b33c..33f72ac9927f 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 @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 ce7078802744..4ede7729306b 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 @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 2eae969a7545..95ec0782a29f 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_ListCustomHostNameAnalysis.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 231a13c9fcfd..41dbebc9eba6 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 3133e2bdfcdd..299cfb68a12b 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 @@ -73,6 +73,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_ManagedBy_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 3e56a5045fd9..7d83f8b96dbf 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 @@ -118,6 +118,8 @@ def main(): }, "serviceBinds": [ { + "clientType": "dotnet", + "customizedKeys": {"DesiredKey": "defaultKey"}, "name": "service", "serviceId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/service", } @@ -130,6 +132,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-preview/examples/ContainerApps_Patch.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 71164ee29964..c112ab0fb7ca 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_Start.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 c0d7fd44776d..51d9a4e0ad91 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_Stop.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 a0c0482f4f7f..b7d6e9e219a4 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 @@ -72,6 +72,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_TcpApp_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..5102961f874f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.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 dapr_component_resiliency_policies_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(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.dapr_component_resiliency_policies.delete( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + name="myresiliencypolicy", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..520a856ed37b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.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 dapr_component_resiliency_policies_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(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_component_resiliency_policies.get( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + name="myresiliencypolicy", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..77e06bf84146 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.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 dapr_component_resiliency_policies_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(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_component_resiliency_policies.list( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..8bc0074d50dc --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.py @@ -0,0 +1,61 @@ +# 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 dapr_component_resiliency_policy_create_or_update_all_options.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(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_component_resiliency_policies.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + name="myresiliencypolicy", + dapr_component_resiliency_policy_envelope={ + "properties": { + "inboundPolicy": { + "httpRetryPolicy": { + "maxRetries": 15, + "retryBackOff": {"initialDelayInMilliseconds": 2000, "maxIntervalInMilliseconds": 5500}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 30}, + }, + "outboundPolicy": { + "httpRetryPolicy": { + "maxRetries": 5, + "retryBackOff": {"initialDelayInMilliseconds": 100, "maxIntervalInMilliseconds": 30000}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 12}, + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..a43a699ccbed --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.py @@ -0,0 +1,54 @@ +# 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 dapr_component_resiliency_policy_create_or_update_outbound_only.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(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_component_resiliency_policies.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + name="myresiliencypolicy", + dapr_component_resiliency_policy_envelope={ + "properties": { + "outboundPolicy": { + "httpRetryPolicy": { + "maxRetries": 5, + "retryBackOff": {"initialDelayInMilliseconds": 100, "maxIntervalInMilliseconds": 30000}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 12}, + } + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..a3daf16609b1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.py @@ -0,0 +1,54 @@ +# 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 dapr_component_resiliency_policy_create_or_update_sparse_options.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(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_component_resiliency_policies.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + name="myresiliencypolicy", + dapr_component_resiliency_policy_envelope={ + "properties": { + "inboundPolicy": { + "httpRetryPolicy": { + "maxRetries": 5, + "retryBackOff": {"initialDelayInMilliseconds": 2000, "maxIntervalInMilliseconds": 5500}, + } + }, + "outboundPolicy": {"timeoutPolicy": {"responseTimeoutInSeconds": 12}}, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 bb315049008e..ce5a4be16e01 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 @@ -46,6 +46,13 @@ def main(): ], "scopes": ["container-app-1", "container-app-2"], "secretStoreComponent": "my-secret-store", + "serviceComponentBind": [ + { + "metadata": {"name": "daprcomponentBind", "value": "redis-bind"}, + "name": "statestore", + "serviceId": "/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis", + } + ], "version": "v1", } }, @@ -53,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/DaprComponents_CreateOrUpdate_SecretStoreComponent.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 39a7b6e29848..6c0c5bccb8be 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 @@ -46,6 +46,13 @@ def main(): ], "scopes": ["container-app-1", "container-app-2"], "secrets": [{"name": "masterkey", "value": "keyvalue"}], + "serviceComponentBind": [ + { + "metadata": {"name": "daprcomponentBind", "value": "redis-bind"}, + "name": "statestore", + "serviceId": "/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis", + } + ], "version": "v1", } }, @@ -53,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/DaprComponents_CreateOrUpdate_Secrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 2324831379ea..17a8788ba918 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 @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/DaprComponents_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 09054b947037..8b0f7a2a4894 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/DaprComponents_Get_SecretStoreComponent.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 3c46e8ecf802..2e27a0877a13 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/DaprComponents_Get_Secrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 a965910cf0cb..57d73a89d76e 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/DaprComponents_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 8f12f74c815f..c68fc713e55c 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/DaprComponents_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..b8e7f14b7685 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py @@ -0,0 +1,51 @@ +# 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 dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.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(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mysubscription", + dapr_subscription_envelope={ + "properties": { + "bulkSubscribe": {"enabled": True, "maxAwaitDurationMs": 500, "maxMessagesCount": 123}, + "pubsubName": "mypubsubcomponent", + "routes": {"default": "/products"}, + "scopes": ["warehouseapp", "customersupportapp"], + "topic": "inventory", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..e4b907301010 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.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 dapr_subscriptions_create_or_update_default_route.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(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mysubscription", + dapr_subscription_envelope={ + "properties": {"pubsubName": "mypubsubcomponent", "routes": {"default": "/products"}, "topic": "inventory"} + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..ef17a2d19e4a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py @@ -0,0 +1,56 @@ +# 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 dapr_subscriptions_create_or_update_route_rules_and_metadata.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(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mysubscription", + dapr_subscription_envelope={ + "properties": { + "metadata": {"foo": "bar", "hello": "world"}, + "pubsubName": "mypubsubcomponent", + "routes": { + "default": "/products", + "rules": [ + {"match": "event.type == 'widget'", "path": "/widgets"}, + {"match": "event.type == 'gadget'", "path": "/gadgets"}, + ], + }, + "topic": "inventory", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..67b82e46dfaa --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_delete.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 dapr_subscriptions_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(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.dapr_subscriptions.delete( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mysubscription", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..8362836e0547 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.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 dapr_subscriptions_get_bulk_subscribe_and_scopes.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(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mypubsubcomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..bd7325d565b9 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.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 dapr_subscriptions_get_default_route.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(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mypubsubcomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..3949a23aea63 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.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 dapr_subscriptions_get_route_rules_and_metadata.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(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mypubsubcomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..e7b3303da64e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_list.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 dapr_subscriptions_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(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.list( + resource_group_name="examplerg", + environment_name="myenvironment", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-preview/examples/DaprSubscriptions_List.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 5d2531451ea8..f6b887f0c4c5 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 @@ -77,6 +77,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_CreateorUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..486c24e99038 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_connected_environment.py @@ -0,0 +1,86 @@ +# 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 job_createor_update_connected_environment.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(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.jobs.begin_create_or_update( + resource_group_name="rg", + job_name="testcontainerAppsJob0", + job_envelope={ + "extendedLocation": { + "name": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation", + "type": "CustomLocation", + }, + "location": "East US", + "properties": { + "configuration": { + "manualTriggerConfig": {"parallelism": 4, "replicaCompletionCount": 1}, + "replicaRetryLimit": 10, + "replicaTimeout": 10, + "triggerType": "Manual", + }, + "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/connectedEnvironments/demokube", + "template": { + "containers": [ + { + "image": "repo/testcontainerAppsJob0:v1", + "name": "testcontainerAppsJob0", + "probes": [ + { + "httpGet": { + "httpHeaders": [{"name": "Custom-Header", "value": "Awesome"}], + "path": "/health", + "port": 8080, + }, + "initialDelaySeconds": 5, + "periodSeconds": 3, + "type": "Liveness", + } + ], + } + ], + "initContainers": [ + { + "args": ["-c", "while true; do echo hello; sleep 10;done"], + "command": ["/bin/sh"], + "image": "repo/testcontainerAppsJob0:v4", + "name": "testinitcontainerAppsJob0", + "resources": {"cpu": 0.2, "memory": "100Mi"}, + } + ], + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 e8a7418aa1b0..cf4da67627cb 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 @@ -75,6 +75,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_CreateorUpdate_EventTrigger.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 67bf62912f9e..ed86daa3c6e1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 9040eb4aaee7..7876eb2c4f4e 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_Execution_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 f374a86cd237..7901a19da6ca 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_Executions_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 489e21ab3c9a..133690324c8f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..024bb3feb2de --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.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 job_get_detector.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(), + subscription_id="f07f3711-b45e-40fe-a941-4e6d93f851e6", + ) + + response = client.jobs.get_detector( + resource_group_name="mikono-workerapp-test-rg", + job_name="mikonojob1", + detector_name="containerappjobnetworkIO", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..f6b1d14cde0d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.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 job_list_detectors.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(), + subscription_id="f07f3711-b45e-40fe-a941-4e6d93f851e6", + ) + + response = client.jobs.list_detectors( + resource_group_name="mikono-workerapp-test-rg", + job_name="mikonojob1", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 68992384b2e4..bdf6dfdcbbd9 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 654850772d0a..981eda4f5df0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py @@ -75,6 +75,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..a8ccd5ec0098 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.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 job_proxy_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(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.jobs.proxy_get( + resource_group_name="rg", + job_name="testcontainerAppsJob0", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 b1bd6eb6eb1b..bf74aca4b8b6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_Start.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 34e063182943..70f8f42e3820 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 @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_Stop_Execution.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 ad671acce7fa..21869e7bc83b 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_Stop_Multiple.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 974f1948ea56..85491bdbcc1b 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 @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Jobs_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 dbf9fb00334f..ec7d1d45e31b 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 @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Jobs_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-preview/examples/Jobs_ListBySubscription.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 59cf78f978dc..a90cc5af9875 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedCertificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 3f20a343dbe5..55e9390f50ac 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 @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedCertificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 d9b1fd94cdc5..19f2050386c0 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedCertificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 05a25fd05c2c..d22d4d327694 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedCertificates_ListByManagedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 5653b6bcde0a..34a8daa30a81 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedCertificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 d5481f13e31e..e5c80f3e7a28 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironmentDiagnostics_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 8e6dcc86a300..5c3dd9dfdaae 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironmentDiagnostics_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-preview/examples/ManagedEnvironmentDiagnostics_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 new file mode 100644 index 000000000000..b429a8a904f5 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.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 managed_environment_usages_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(), + subscription_id="subid", + ) + + response = client.managed_environment_usages.list( + resource_group_name="examplerg", + environment_name="jlaw-demo1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 46827d450f11..34555612b377 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 @@ -35,13 +35,30 @@ def main(): environment_envelope={ "location": "East US", "properties": { - "appLogsConfiguration": {"logAnalyticsConfiguration": {"customerId": "string", "sharedKey": "string"}}, + "appInsightsConfiguration": { + "connectionString": "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://eastus-8.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/" + }, + "appLogsConfiguration": { + "logAnalyticsConfiguration": { + "customerId": "string", + "dynamicJsonColumns": True, + "sharedKey": "string", + } + }, "customDomainConfiguration": { "certificatePassword": "1234", "certificateValue": "Y2VydA==", "dnsSuffix": "www.my-name.com", }, "daprAIConnectionString": "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://northcentralus-0.in.applicationinsights.azure.com/", + "openTelemetryConfiguration": { + "destinationsConfiguration": { + "dataDogConfiguration": {"key": "000000000000000000000000", "site": "string"} + }, + "logsConfiguration": {"destinations": ["appInsights"]}, + "metricsConfiguration": {"destinations": ["dataDog"]}, + "tracesConfiguration": {"destinations": ["appInsights"]}, + }, "peerAuthentication": {"mtls": {"enabled": True}}, "vnetConfiguration": { "infrastructureSubnetId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/VNetName/subnets/subnetName1" @@ -74,6 +91,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironments_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 fd5232fae232..902bb8610dc4 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 @@ -74,6 +74,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironments_CustomInfrastructureResourceGroup_Create.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 ddf5bc40e33b..e7f5ed08f449 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 @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironments_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 e4873afecaa8..419282bc5576 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironments_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-preview/examples/ManagedEnvironments_Get.json if __name__ == "__main__": 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 56e3171f8129..41ddd1c7674c 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironments_GetAuthToken.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 d0e3555d080e..196b3e7f22b6 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 @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironments_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 48105b604bb0..7f2d77337e0c 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 @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironments_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 73b67ee3f603..fa5867893e72 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironments_ListWorkloadProfileStates.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 96b6650b2bcd..999541513f7d 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironments_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 da74a2c75c5d..fc34e60b94b4 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 @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate.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 60a920675098..5d26eafb149f 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 @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironmentsStorages_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 8a534fd74c8d..c1374d73a873 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironmentsStorages_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-preview/examples/ManagedEnvironmentsStorages_Get.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 27117ddea822..2da2c951aebf 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironmentsStorages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 e04bb66279db..44df2fce3802 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Operations_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 e0780e406120..2e89382bd21d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Replicas_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 59dae6a808c3..40a22524be1a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Replicas_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 07aa985c27a9..4c2988b77d11 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Revisions_Activate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 f1c8b953f9b5..4fa76a135908 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Revisions_Deactivate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 c9a7dbf05f90..5ba6f5fd8229 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Revisions_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 4df2b7c55692..4afe76c9a0ce 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Revisions_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 126a3c1a84a3..4d7cf11d1bc5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Revisions_Restart.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-preview/examples/Revisions_Restart.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/source_controls_create_or_update.py index bcfcea00137e..acb3201e9123 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py @@ -59,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/SourceControls_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-preview/examples/SourceControls_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/source_controls_delete.py index c4da8857288c..997201018f57 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/SourceControls_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-preview/examples/SourceControls_Delete.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 cb0dd31f2206..fff4742d3b6d 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/SourceControls_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 6c7178b74834..fe1844096be5 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/SourceControls_ListByContainer.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..1dc8327eb1fa --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py @@ -0,0 +1,38 @@ +# 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 subscriptions_get_custom_domain_verification_id.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(), + subscription_id="d27c3573-f76e-4b26-b871-0ccd2203d08c", + ) + + response = client.get_custom_domain_verification_id() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-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 new file mode 100644 index 000000000000..44069624621c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.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 usages_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(), + subscription_id="subid", + ) + + response = client.usages.list( + location="westus", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-08-01-preview/examples/Usages_List.json +if __name__ == "__main__": + main()