diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json b/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json index bbe75cc919e3..26a5990deb1c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json +++ b/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json @@ -1,11 +1,11 @@ { - "commit": "c4b33165c43ba9253bb5b36a8c907dbef570bb6f", + "commit": "e1a566fd7580219dcce2df096f337172e8c7ce8e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.17.0", + "@autorest/python@6.19.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/app/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --tag=package-2024-03 --use=@autorest/python@6.17.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/app/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/app/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py index 6b5bc3fc5696..4f9ddd750225 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py @@ -26,15 +26,15 @@ class ContainerAppsAPIClientConfiguration: # pylint: disable=too-many-instance- :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param 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 "2024-03-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-10-02-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-03-01") + api_version: str = kwargs.pop("api_version", "2024-10-02-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 f39b86b8ebb1..f40a77a0bf18 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 @@ -19,8 +19,13 @@ from ._configuration import ContainerAppsAPIClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( + AppResiliencyOperations, AvailableWorkloadProfilesOperations, BillingMetersOperations, + BuildAuthTokenOperations, + BuildersOperations, + BuildsByBuilderResourceOperations, + BuildsOperations, CertificatesOperations, ConnectedEnvironmentsCertificatesOperations, ConnectedEnvironmentsDaprComponentsOperations, @@ -28,16 +33,31 @@ ConnectedEnvironmentsStoragesOperations, ContainerAppsAPIClientOperationsMixin, ContainerAppsAuthConfigsOperations, + ContainerAppsBuildsByContainerAppOperations, + ContainerAppsBuildsOperations, ContainerAppsDiagnosticsOperations, + ContainerAppsLabelHistoryOperations, ContainerAppsOperations, + ContainerAppsPatchesOperations, ContainerAppsRevisionReplicasOperations, ContainerAppsRevisionsOperations, + ContainerAppsSessionPoolsOperations, ContainerAppsSourceControlsOperations, + DaprComponentResiliencyPoliciesOperations, DaprComponentsOperations, + DaprSubscriptionsOperations, + DotNetComponentsOperations, + FunctionsExtensionOperations, + HttpRouteConfigOperations, + JavaComponentsOperations, JobsExecutionsOperations, JobsOperations, + LogicAppsOperations, + MaintenanceConfigurationsOperations, ManagedCertificatesOperations, ManagedEnvironmentDiagnosticsOperations, + ManagedEnvironmentPrivateEndpointConnectionsOperations, + ManagedEnvironmentPrivateLinkResourcesOperations, ManagedEnvironmentUsagesOperations, ManagedEnvironmentsDiagnosticsOperations, ManagedEnvironmentsOperations, @@ -55,8 +75,12 @@ class ContainerAppsAPIClient( ContainerAppsAPIClientOperationsMixin ): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """ContainerAppsAPIClient. + """Functions is an extension resource to revisions and the api listed is used to proxy the call + from Web RP to the function app's host process, this api is not exposed to users and only Web + RP is allowed to invoke functions extension resource. + :ivar app_resiliency: AppResiliencyOperations operations + :vartype app_resiliency: azure.mgmt.appcontainers.operations.AppResiliencyOperations :ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations :vartype container_apps_auth_configs: azure.mgmt.appcontainers.operations.ContainerAppsAuthConfigsOperations @@ -65,6 +89,15 @@ 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_by_builder_resource: BuildsByBuilderResourceOperations operations + :vartype builds_by_builder_resource: + azure.mgmt.appcontainers.operations.BuildsByBuilderResourceOperations + :ivar builds: BuildsOperations operations + :vartype builds: azure.mgmt.appcontainers.operations.BuildsOperations + :ivar build_auth_token: BuildAuthTokenOperations operations + :vartype build_auth_token: azure.mgmt.appcontainers.operations.BuildAuthTokenOperations :ivar connected_environments: ConnectedEnvironmentsOperations operations :vartype connected_environments: azure.mgmt.appcontainers.operations.ConnectedEnvironmentsOperations @@ -81,6 +114,19 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.operations.ConnectedEnvironmentsStoragesOperations :ivar container_apps: ContainerAppsOperations operations :vartype container_apps: azure.mgmt.appcontainers.operations.ContainerAppsOperations + :ivar container_apps_builds_by_container_app: ContainerAppsBuildsByContainerAppOperations + operations + :vartype container_apps_builds_by_container_app: + azure.mgmt.appcontainers.operations.ContainerAppsBuildsByContainerAppOperations + :ivar container_apps_builds: ContainerAppsBuildsOperations operations + :vartype container_apps_builds: + azure.mgmt.appcontainers.operations.ContainerAppsBuildsOperations + :ivar container_apps_patches: ContainerAppsPatchesOperations operations + :vartype container_apps_patches: + azure.mgmt.appcontainers.operations.ContainerAppsPatchesOperations + :ivar container_apps_label_history: ContainerAppsLabelHistoryOperations operations + :vartype container_apps_label_history: + azure.mgmt.appcontainers.operations.ContainerAppsLabelHistoryOperations :ivar container_apps_revisions: ContainerAppsRevisionsOperations operations :vartype container_apps_revisions: azure.mgmt.appcontainers.operations.ContainerAppsRevisionsOperations @@ -98,10 +144,18 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.operations.ManagedEnvironmentsDiagnosticsOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.appcontainers.operations.JobsOperations + :ivar dot_net_components: DotNetComponentsOperations operations + :vartype dot_net_components: azure.mgmt.appcontainers.operations.DotNetComponentsOperations + :ivar functions_extension: FunctionsExtensionOperations operations + :vartype functions_extension: azure.mgmt.appcontainers.operations.FunctionsExtensionOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appcontainers.operations.Operations + :ivar java_components: JavaComponentsOperations operations + :vartype java_components: azure.mgmt.appcontainers.operations.JavaComponentsOperations :ivar jobs_executions: JobsExecutionsOperations operations :vartype jobs_executions: azure.mgmt.appcontainers.operations.JobsExecutionsOperations + :ivar logic_apps: LogicAppsOperations operations + :vartype logic_apps: azure.mgmt.appcontainers.operations.LogicAppsOperations :ivar managed_environments: ManagedEnvironmentsOperations operations :vartype managed_environments: azure.mgmt.appcontainers.operations.ManagedEnvironmentsOperations @@ -112,11 +166,32 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.operations.ManagedCertificatesOperations :ivar namespaces: NamespacesOperations operations :vartype namespaces: azure.mgmt.appcontainers.operations.NamespacesOperations + :ivar managed_environment_private_endpoint_connections: + ManagedEnvironmentPrivateEndpointConnectionsOperations operations + :vartype managed_environment_private_endpoint_connections: + azure.mgmt.appcontainers.operations.ManagedEnvironmentPrivateEndpointConnectionsOperations + :ivar managed_environment_private_link_resources: + ManagedEnvironmentPrivateLinkResourcesOperations operations + :vartype managed_environment_private_link_resources: + azure.mgmt.appcontainers.operations.ManagedEnvironmentPrivateLinkResourcesOperations + :ivar dapr_component_resiliency_policies: DaprComponentResiliencyPoliciesOperations operations + :vartype dapr_component_resiliency_policies: + azure.mgmt.appcontainers.operations.DaprComponentResiliencyPoliciesOperations :ivar dapr_components: DaprComponentsOperations operations :vartype dapr_components: azure.mgmt.appcontainers.operations.DaprComponentsOperations + :ivar dapr_subscriptions: DaprSubscriptionsOperations operations + :vartype dapr_subscriptions: azure.mgmt.appcontainers.operations.DaprSubscriptionsOperations + :ivar http_route_config: HttpRouteConfigOperations operations + :vartype http_route_config: azure.mgmt.appcontainers.operations.HttpRouteConfigOperations + :ivar maintenance_configurations: MaintenanceConfigurationsOperations operations + :vartype maintenance_configurations: + azure.mgmt.appcontainers.operations.MaintenanceConfigurationsOperations :ivar managed_environments_storages: ManagedEnvironmentsStoragesOperations operations :vartype managed_environments_storages: azure.mgmt.appcontainers.operations.ManagedEnvironmentsStoragesOperations + :ivar container_apps_session_pools: ContainerAppsSessionPoolsOperations operations + :vartype container_apps_session_pools: + azure.mgmt.appcontainers.operations.ContainerAppsSessionPoolsOperations :ivar container_apps_source_controls: ContainerAppsSourceControlsOperations operations :vartype container_apps_source_controls: azure.mgmt.appcontainers.operations.ContainerAppsSourceControlsOperations @@ -127,12 +202,12 @@ class ContainerAppsAPIClient( 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 "2024-03-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-10-02-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -172,6 +247,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 ) @@ -179,6 +255,12 @@ 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_by_builder_resource = BuildsByBuilderResourceOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.builds = BuildsOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_auth_token = BuildAuthTokenOperations(self._client, self._config, self._serialize, self._deserialize) self.connected_environments = ConnectedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -192,6 +274,18 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.container_apps = ContainerAppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_apps_builds_by_container_app = ContainerAppsBuildsByContainerAppOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_builds = ContainerAppsBuildsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_patches = ContainerAppsPatchesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_label_history = ContainerAppsLabelHistoryOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.container_apps_revisions = ContainerAppsRevisionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -208,8 +302,16 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dot_net_components = DotNetComponentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.functions_extension = FunctionsExtensionOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.java_components = JavaComponentsOperations(self._client, self._config, self._serialize, self._deserialize) self.jobs_executions = JobsExecutionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.logic_apps = LogicAppsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_environments = ManagedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -218,10 +320,31 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_environment_private_endpoint_connections = ManagedEnvironmentPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_environment_private_link_resources = ManagedEnvironmentPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.dapr_component_resiliency_policies = DaprComponentResiliencyPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.dapr_components = DaprComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dapr_subscriptions = DaprSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.http_route_config = HttpRouteConfigOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.managed_environments_storages = ManagedEnvironmentsStoragesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.container_apps_session_pools = ContainerAppsSessionPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.container_apps_source_controls = ContainerAppsSourceControlsOperations( self._client, self._config, self._serialize, self._deserialize ) 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 47babc28d5ed..e5754a47ce68 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.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 4b656c0dc270..36434a81d4f8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py @@ -26,15 +26,15 @@ class ContainerAppsAPIClientConfiguration: # pylint: disable=too-many-instance- :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param 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 "2024-03-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-10-02-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-03-01") + api_version: str = kwargs.pop("api_version", "2024-10-02-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 9737997ee424..32d22465acfb 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 @@ -19,8 +19,13 @@ from .._serialization import Deserializer, Serializer from ._configuration import ContainerAppsAPIClientConfiguration from .operations import ( + AppResiliencyOperations, AvailableWorkloadProfilesOperations, BillingMetersOperations, + BuildAuthTokenOperations, + BuildersOperations, + BuildsByBuilderResourceOperations, + BuildsOperations, CertificatesOperations, ConnectedEnvironmentsCertificatesOperations, ConnectedEnvironmentsDaprComponentsOperations, @@ -28,16 +33,31 @@ ConnectedEnvironmentsStoragesOperations, ContainerAppsAPIClientOperationsMixin, ContainerAppsAuthConfigsOperations, + ContainerAppsBuildsByContainerAppOperations, + ContainerAppsBuildsOperations, ContainerAppsDiagnosticsOperations, + ContainerAppsLabelHistoryOperations, ContainerAppsOperations, + ContainerAppsPatchesOperations, ContainerAppsRevisionReplicasOperations, ContainerAppsRevisionsOperations, + ContainerAppsSessionPoolsOperations, ContainerAppsSourceControlsOperations, + DaprComponentResiliencyPoliciesOperations, DaprComponentsOperations, + DaprSubscriptionsOperations, + DotNetComponentsOperations, + FunctionsExtensionOperations, + HttpRouteConfigOperations, + JavaComponentsOperations, JobsExecutionsOperations, JobsOperations, + LogicAppsOperations, + MaintenanceConfigurationsOperations, ManagedCertificatesOperations, ManagedEnvironmentDiagnosticsOperations, + ManagedEnvironmentPrivateEndpointConnectionsOperations, + ManagedEnvironmentPrivateLinkResourcesOperations, ManagedEnvironmentUsagesOperations, ManagedEnvironmentsDiagnosticsOperations, ManagedEnvironmentsOperations, @@ -55,8 +75,12 @@ class ContainerAppsAPIClient( ContainerAppsAPIClientOperationsMixin ): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """ContainerAppsAPIClient. + """Functions is an extension resource to revisions and the api listed is used to proxy the call + from Web RP to the function app's host process, this api is not exposed to users and only Web + RP is allowed to invoke functions extension resource. + :ivar app_resiliency: AppResiliencyOperations operations + :vartype app_resiliency: azure.mgmt.appcontainers.aio.operations.AppResiliencyOperations :ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations :vartype container_apps_auth_configs: azure.mgmt.appcontainers.aio.operations.ContainerAppsAuthConfigsOperations @@ -65,6 +89,15 @@ 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_by_builder_resource: BuildsByBuilderResourceOperations operations + :vartype builds_by_builder_resource: + azure.mgmt.appcontainers.aio.operations.BuildsByBuilderResourceOperations + :ivar builds: BuildsOperations operations + :vartype builds: azure.mgmt.appcontainers.aio.operations.BuildsOperations + :ivar build_auth_token: BuildAuthTokenOperations operations + :vartype build_auth_token: azure.mgmt.appcontainers.aio.operations.BuildAuthTokenOperations :ivar connected_environments: ConnectedEnvironmentsOperations operations :vartype connected_environments: azure.mgmt.appcontainers.aio.operations.ConnectedEnvironmentsOperations @@ -81,6 +114,19 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.aio.operations.ConnectedEnvironmentsStoragesOperations :ivar container_apps: ContainerAppsOperations operations :vartype container_apps: azure.mgmt.appcontainers.aio.operations.ContainerAppsOperations + :ivar container_apps_builds_by_container_app: ContainerAppsBuildsByContainerAppOperations + operations + :vartype container_apps_builds_by_container_app: + azure.mgmt.appcontainers.aio.operations.ContainerAppsBuildsByContainerAppOperations + :ivar container_apps_builds: ContainerAppsBuildsOperations operations + :vartype container_apps_builds: + azure.mgmt.appcontainers.aio.operations.ContainerAppsBuildsOperations + :ivar container_apps_patches: ContainerAppsPatchesOperations operations + :vartype container_apps_patches: + azure.mgmt.appcontainers.aio.operations.ContainerAppsPatchesOperations + :ivar container_apps_label_history: ContainerAppsLabelHistoryOperations operations + :vartype container_apps_label_history: + azure.mgmt.appcontainers.aio.operations.ContainerAppsLabelHistoryOperations :ivar container_apps_revisions: ContainerAppsRevisionsOperations operations :vartype container_apps_revisions: azure.mgmt.appcontainers.aio.operations.ContainerAppsRevisionsOperations @@ -98,10 +144,19 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsDiagnosticsOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.appcontainers.aio.operations.JobsOperations + :ivar dot_net_components: DotNetComponentsOperations operations + :vartype dot_net_components: azure.mgmt.appcontainers.aio.operations.DotNetComponentsOperations + :ivar functions_extension: FunctionsExtensionOperations operations + :vartype functions_extension: + azure.mgmt.appcontainers.aio.operations.FunctionsExtensionOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appcontainers.aio.operations.Operations + :ivar java_components: JavaComponentsOperations operations + :vartype java_components: azure.mgmt.appcontainers.aio.operations.JavaComponentsOperations :ivar jobs_executions: JobsExecutionsOperations operations :vartype jobs_executions: azure.mgmt.appcontainers.aio.operations.JobsExecutionsOperations + :ivar logic_apps: LogicAppsOperations operations + :vartype logic_apps: azure.mgmt.appcontainers.aio.operations.LogicAppsOperations :ivar managed_environments: ManagedEnvironmentsOperations operations :vartype managed_environments: azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsOperations @@ -112,11 +167,33 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.aio.operations.ManagedCertificatesOperations :ivar namespaces: NamespacesOperations operations :vartype namespaces: azure.mgmt.appcontainers.aio.operations.NamespacesOperations + :ivar managed_environment_private_endpoint_connections: + ManagedEnvironmentPrivateEndpointConnectionsOperations operations + :vartype managed_environment_private_endpoint_connections: + azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentPrivateEndpointConnectionsOperations + :ivar managed_environment_private_link_resources: + ManagedEnvironmentPrivateLinkResourcesOperations operations + :vartype managed_environment_private_link_resources: + azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentPrivateLinkResourcesOperations + :ivar dapr_component_resiliency_policies: DaprComponentResiliencyPoliciesOperations operations + :vartype dapr_component_resiliency_policies: + azure.mgmt.appcontainers.aio.operations.DaprComponentResiliencyPoliciesOperations :ivar dapr_components: DaprComponentsOperations operations :vartype dapr_components: azure.mgmt.appcontainers.aio.operations.DaprComponentsOperations + :ivar dapr_subscriptions: DaprSubscriptionsOperations operations + :vartype dapr_subscriptions: + azure.mgmt.appcontainers.aio.operations.DaprSubscriptionsOperations + :ivar http_route_config: HttpRouteConfigOperations operations + :vartype http_route_config: azure.mgmt.appcontainers.aio.operations.HttpRouteConfigOperations + :ivar maintenance_configurations: MaintenanceConfigurationsOperations operations + :vartype maintenance_configurations: + azure.mgmt.appcontainers.aio.operations.MaintenanceConfigurationsOperations :ivar managed_environments_storages: ManagedEnvironmentsStoragesOperations operations :vartype managed_environments_storages: azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsStoragesOperations + :ivar container_apps_session_pools: ContainerAppsSessionPoolsOperations operations + :vartype container_apps_session_pools: + azure.mgmt.appcontainers.aio.operations.ContainerAppsSessionPoolsOperations :ivar container_apps_source_controls: ContainerAppsSourceControlsOperations operations :vartype container_apps_source_controls: azure.mgmt.appcontainers.aio.operations.ContainerAppsSourceControlsOperations @@ -127,12 +204,12 @@ class ContainerAppsAPIClient( 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 "2024-03-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-10-02-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -172,6 +249,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 ) @@ -179,6 +257,12 @@ 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_by_builder_resource = BuildsByBuilderResourceOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.builds = BuildsOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_auth_token = BuildAuthTokenOperations(self._client, self._config, self._serialize, self._deserialize) self.connected_environments = ConnectedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -192,6 +276,18 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.container_apps = ContainerAppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_apps_builds_by_container_app = ContainerAppsBuildsByContainerAppOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_builds = ContainerAppsBuildsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_patches = ContainerAppsPatchesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_label_history = ContainerAppsLabelHistoryOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.container_apps_revisions = ContainerAppsRevisionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -208,8 +304,16 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dot_net_components = DotNetComponentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.functions_extension = FunctionsExtensionOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.java_components = JavaComponentsOperations(self._client, self._config, self._serialize, self._deserialize) self.jobs_executions = JobsExecutionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.logic_apps = LogicAppsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_environments = ManagedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -218,10 +322,31 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_environment_private_endpoint_connections = ManagedEnvironmentPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_environment_private_link_resources = ManagedEnvironmentPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.dapr_component_resiliency_policies = DaprComponentResiliencyPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.dapr_components = DaprComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dapr_subscriptions = DaprSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.http_route_config = HttpRouteConfigOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.managed_environments_storages = ManagedEnvironmentsStoragesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.container_apps_session_pools = ContainerAppsSessionPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.container_apps_source_controls = ContainerAppsSourceControlsOperations( self._client, self._config, self._serialize, self._deserialize ) 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 1d1af7c18205..fed77a5ed4ea 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,29 +6,51 @@ # 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_by_builder_resource_operations import BuildsByBuilderResourceOperations +from ._builds_operations import BuildsOperations +from ._build_auth_token_operations import BuildAuthTokenOperations from ._connected_environments_operations import ConnectedEnvironmentsOperations from ._connected_environments_certificates_operations import ConnectedEnvironmentsCertificatesOperations from ._connected_environments_dapr_components_operations import ConnectedEnvironmentsDaprComponentsOperations from ._connected_environments_storages_operations import ConnectedEnvironmentsStoragesOperations from ._container_apps_operations import ContainerAppsOperations +from ._container_apps_builds_by_container_app_operations import ContainerAppsBuildsByContainerAppOperations +from ._container_apps_builds_operations import ContainerAppsBuildsOperations +from ._container_apps_patches_operations import ContainerAppsPatchesOperations +from ._container_apps_label_history_operations import ContainerAppsLabelHistoryOperations from ._container_apps_revisions_operations import ContainerAppsRevisionsOperations from ._container_apps_revision_replicas_operations import ContainerAppsRevisionReplicasOperations from ._container_apps_diagnostics_operations import ContainerAppsDiagnosticsOperations from ._managed_environment_diagnostics_operations import ManagedEnvironmentDiagnosticsOperations from ._managed_environments_diagnostics_operations import ManagedEnvironmentsDiagnosticsOperations from ._jobs_operations import JobsOperations +from ._dot_net_components_operations import DotNetComponentsOperations +from ._functions_extension_operations import FunctionsExtensionOperations from ._operations import Operations +from ._java_components_operations import JavaComponentsOperations from ._jobs_executions_operations import JobsExecutionsOperations from ._container_apps_api_client_operations import ContainerAppsAPIClientOperationsMixin +from ._logic_apps_operations import LogicAppsOperations from ._managed_environments_operations import ManagedEnvironmentsOperations from ._certificates_operations import CertificatesOperations from ._managed_certificates_operations import ManagedCertificatesOperations from ._namespaces_operations import NamespacesOperations +from ._managed_environment_private_endpoint_connections_operations import ( + ManagedEnvironmentPrivateEndpointConnectionsOperations, +) +from ._managed_environment_private_link_resources_operations import ManagedEnvironmentPrivateLinkResourcesOperations +from ._dapr_component_resiliency_policies_operations import DaprComponentResiliencyPoliciesOperations from ._dapr_components_operations import DaprComponentsOperations +from ._dapr_subscriptions_operations import DaprSubscriptionsOperations +from ._http_route_config_operations import HttpRouteConfigOperations +from ._maintenance_configurations_operations import MaintenanceConfigurationsOperations from ._managed_environments_storages_operations import ManagedEnvironmentsStoragesOperations +from ._container_apps_session_pools_operations import ContainerAppsSessionPoolsOperations from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations from ._usages_operations import UsagesOperations from ._managed_environment_usages_operations import ManagedEnvironmentUsagesOperations @@ -38,29 +60,49 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ + "AppResiliencyOperations", "ContainerAppsAuthConfigsOperations", "AvailableWorkloadProfilesOperations", "BillingMetersOperations", + "BuildersOperations", + "BuildsByBuilderResourceOperations", + "BuildsOperations", + "BuildAuthTokenOperations", "ConnectedEnvironmentsOperations", "ConnectedEnvironmentsCertificatesOperations", "ConnectedEnvironmentsDaprComponentsOperations", "ConnectedEnvironmentsStoragesOperations", "ContainerAppsOperations", + "ContainerAppsBuildsByContainerAppOperations", + "ContainerAppsBuildsOperations", + "ContainerAppsPatchesOperations", + "ContainerAppsLabelHistoryOperations", "ContainerAppsRevisionsOperations", "ContainerAppsRevisionReplicasOperations", "ContainerAppsDiagnosticsOperations", "ManagedEnvironmentDiagnosticsOperations", "ManagedEnvironmentsDiagnosticsOperations", "JobsOperations", + "DotNetComponentsOperations", + "FunctionsExtensionOperations", "Operations", + "JavaComponentsOperations", "JobsExecutionsOperations", "ContainerAppsAPIClientOperationsMixin", + "LogicAppsOperations", "ManagedEnvironmentsOperations", "CertificatesOperations", "ManagedCertificatesOperations", "NamespacesOperations", + "ManagedEnvironmentPrivateEndpointConnectionsOperations", + "ManagedEnvironmentPrivateLinkResourcesOperations", + "DaprComponentResiliencyPoliciesOperations", "DaprComponentsOperations", + "DaprSubscriptionsOperations", + "HttpRouteConfigOperations", + "MaintenanceConfigurationsOperations", "ManagedEnvironmentsStoragesOperations", + "ContainerAppsSessionPoolsOperations", "ContainerAppsSourceControlsOperations", "UsagesOperations", "ManagedEnvironmentUsagesOperations", 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..4ca3515c3463 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_app_resiliency_operations.py @@ -0,0 +1,562 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._app_resiliency_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class 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 + :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[bytes], + *, + 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[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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[bytes]], + **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[bytes] type. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO[bytes] + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @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 + :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[bytes], + *, + 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[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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[bytes]], + **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[bytes] type. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO[bytes] + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, 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 + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_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 + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @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 + :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: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py index d4e268c8e17e..007b7f9e95dc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py @@ -27,7 +27,6 @@ from ... import models as _models from ...operations._available_workload_profiles_operations import build_get_request -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_billing_meters_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_billing_meters_operations.py index 5fb56bf3db61..11596186fb1a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_billing_meters_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_billing_meters_operations.py @@ -25,7 +25,6 @@ from ... import models as _models from ...operations._billing_meters_operations import build_get_request -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_build_auth_token_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_build_auth_token_operations.py new file mode 100644 index 000000000000..a875471941c0 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_build_auth_token_operations.py @@ -0,0 +1,115 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._build_auth_token_operations import build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildAuthTokenOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`build_auth_token` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def list( + self, resource_group_name: str, 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 + :return: BuildToken or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildToken + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildToken] = kwargs.pop("cls", None) + + _request = build_list_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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildToken", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py new file mode 100644 index 000000000000..5d01584d4431 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py @@ -0,0 +1,792 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._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, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class 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. + + :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: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.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 + :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: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, resource_group_name: str, 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 + :return: BuilderResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuilderResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @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 + :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[bytes], + *, + 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[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either 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[bytes]], + **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[bytes] type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource or IO[bytes] + :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 + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BuilderResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BuilderResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + 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 + :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[bytes], + *, + 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[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either 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[bytes]], + **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[bytes] type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate or IO[bytes] + :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 + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BuilderResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BuilderResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, 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 + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_by_builder_resource_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_by_builder_resource_operations.py new file mode 100644 index 000000000000..56a53acdbbfb --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_by_builder_resource_operations.py @@ -0,0 +1,140 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._builds_by_builder_resource_operations import build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildsByBuilderResourceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`builds_by_builder_resource` 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, 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 + :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: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py new file mode 100644 index 000000000000..72103545763f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py @@ -0,0 +1,450 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._builds_operations import build_create_or_update_request, build_delete_request, build_get_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class 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_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 + :return: BuildResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @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 + :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[bytes], + *, + 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[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either 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[bytes]], + **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[bytes] type. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource or IO[bytes] + :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 + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BuildResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BuildResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, 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 + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py index 08246e05e1fa..bada5159b51f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py @@ -35,7 +35,6 @@ build_list_request, build_update_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_certificates_operations.py index b54c47d0ef4a..ac26f3621ebd 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_certificates_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,14 +18,18 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ...operations._connected_environments_certificates_operations import ( @@ -35,7 +39,6 @@ build_list_request, build_update_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -213,8 +216,80 @@ async def get( return deserialized # type: ignore + async def _create_or_update_initial( + self, + resource_group_name: str, + connected_environment_name: str, + certificate_name: str, + certificate_envelope: Optional[Union[_models.Certificate, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_envelope, (IOBase, bytes)): + _content = certificate_envelope + else: + if certificate_envelope is not None: + _json = self._serialize.body(certificate_envelope, "Certificate") + else: + _json = None + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @overload - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, @@ -223,7 +298,7 @@ async def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Certificate: + ) -> AsyncLROPoller[_models.Certificate]: """Create or Update a Certificate. Create or Update a Certificate. @@ -240,13 +315,14 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of AsyncLROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, @@ -255,7 +331,7 @@ async def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Certificate: + ) -> AsyncLROPoller[_models.Certificate]: """Create or Update a Certificate. Create or Update a Certificate. @@ -272,20 +348,21 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of AsyncLROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, certificate_name: str, certificate_envelope: Optional[Union[_models.Certificate, IO[bytes]]] = None, **kwargs: Any - ) -> _models.Certificate: + ) -> AsyncLROPoller[_models.Certificate]: """Create or Update a Certificate. Create or Update a Certificate. @@ -300,10 +377,65 @@ async def create_or_update( :param certificate_envelope: Certificate to be created or updated. Is either a Certificate type or a IO[bytes] type. Default value is None. :type certificate_envelope: ~azure.mgmt.appcontainers.models.Certificate or IO[bytes] - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of AsyncLROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Certificate] :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.Certificate] = 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, + connected_environment_name=connected_environment_name, + certificate_name=certificate_name, + certificate_envelope=certificate_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Certificate", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Certificate].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Certificate]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, connected_environment_name: str, certificate_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -312,61 +444,55 @@ async def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_envelope, (IOBase, bytes)): - _content = certificate_envelope - else: - if certificate_envelope is not None: - _json = self._serialize.body(certificate_envelope, "Certificate") - else: - _json = None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_create_or_update_request( + _request = build_delete_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, certificate_name=certificate_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, connected_environment_name: str, certificate_name: str, **kwargs: Any - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes the specified Certificate. Deletes the specified Certificate. @@ -378,10 +504,61 @@ async def delete( # pylint: disable=inconsistent-return-statements :type connected_environment_name: str :param certificate_name: Name of the Certificate. Required. :type certificate_name: str - :return: None or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + certificate_name=certificate_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + connected_environment_name: str, + certificate_name: str, + certificate_envelope: Union[_models.CertificatePatch, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -390,40 +567,65 @@ async def delete( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_delete_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_envelope, (IOBase, bytes)): + _content = certificate_envelope + else: + _json = self._serialize.body(certificate_envelope, "CertificatePatch") + + _request = build_update_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, certificate_name=certificate_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload - async def update( + async def begin_update( self, resource_group_name: str, connected_environment_name: str, @@ -432,7 +634,7 @@ async def update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Certificate: + ) -> AsyncLROPoller[_models.Certificate]: """Update properties of a certificate. Patches a certificate. Currently only patching of tags is supported. @@ -449,13 +651,14 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of AsyncLROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update( + async def begin_update( self, resource_group_name: str, connected_environment_name: str, @@ -464,7 +667,7 @@ async def update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Certificate: + ) -> AsyncLROPoller[_models.Certificate]: """Update properties of a certificate. Patches a certificate. Currently only patching of tags is supported. @@ -481,20 +684,21 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of AsyncLROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def update( + async def begin_update( self, resource_group_name: str, connected_environment_name: str, certificate_name: str, certificate_envelope: Union[_models.CertificatePatch, IO[bytes]], **kwargs: Any - ) -> _models.Certificate: + ) -> AsyncLROPoller[_models.Certificate]: """Update properties of a certificate. Patches a certificate. Currently only patching of tags is supported. @@ -509,62 +713,57 @@ async def update( :param certificate_envelope: Properties of a certificate that need to be updated. Is either a CertificatePatch type or a IO[bytes] type. Required. :type certificate_envelope: ~azure.mgmt.appcontainers.models.CertificatePatch or IO[bytes] - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of AsyncLROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Certificate] = 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, + connected_environment_name=connected_environment_name, + certificate_name=certificate_name, + certificate_envelope=certificate_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_envelope, (IOBase, bytes)): - _content = certificate_envelope - else: - _json = self._serialize.body(certificate_envelope, "CertificatePatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - connected_environment_name=connected_environment_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Certificate", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Certificate].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Certificate]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Certificate", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_dapr_components_operations.py index fbf413a22135..16ad32e823c7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_dapr_components_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,14 +18,18 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ...operations._connected_environments_dapr_components_operations import ( @@ -35,7 +39,6 @@ build_list_request, build_list_secrets_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -67,7 +70,7 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list( self, resource_group_name: str, connected_environment_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DaprComponent"]: + ) -> AsyncIterable["_models.ConnectedEnvironmentDaprComponent"]: """Get the Dapr Components for a connected environment. Get the Dapr Components for a connected environment. @@ -77,15 +80,17 @@ def list( :type resource_group_name: str :param connected_environment_name: Name of the connected environment. Required. :type connected_environment_name: str - :return: An iterator like instance of either DaprComponent or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DaprComponent] + :return: An iterator like instance of either ConnectedEnvironmentDaprComponent or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent] :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.DaprComponentsCollection] = kwargs.pop("cls", None) + cls: ClsType[_models.ConnectedEnvironmentDaprComponentsCollection] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -126,7 +131,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("DaprComponentsCollection", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironmentDaprComponentsCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -153,7 +158,7 @@ async def get_next(next_link=None): @distributed_trace_async async def get( self, resource_group_name: str, connected_environment_name: str, component_name: str, **kwargs: Any - ) -> _models.DaprComponent: + ) -> _models.ConnectedEnvironmentDaprComponent: """Get a dapr component. Get a dapr component. @@ -165,8 +170,8 @@ async def get( :type connected_environment_name: str :param component_name: Name of the Dapr Component. Required. :type component_name: str - :return: DaprComponent or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponent + :return: ConnectedEnvironmentDaprComponent or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -181,7 +186,7 @@ async def get( _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.DaprComponent] = kwargs.pop("cls", None) + cls: ClsType[_models.ConnectedEnvironmentDaprComponent] = kwargs.pop("cls", None) _request = build_get_request( resource_group_name=resource_group_name, @@ -206,7 +211,76 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) + deserialized = self._deserialize("ConnectedEnvironmentDaprComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + connected_environment_name: str, + component_name: str, + dapr_component_envelope: Union[_models.ConnectedEnvironmentDaprComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dapr_component_envelope, (IOBase, bytes)): + _content = dapr_component_envelope + else: + _json = self._serialize.body(dapr_component_envelope, "ConnectedEnvironmentDaprComponent") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -214,16 +288,16 @@ async def get( return deserialized # type: ignore @overload - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, component_name: str, - dapr_component_envelope: _models.DaprComponent, + dapr_component_envelope: _models.ConnectedEnvironmentDaprComponent, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DaprComponent: + ) -> AsyncLROPoller[_models.ConnectedEnvironmentDaprComponent]: """Creates or updates a Dapr Component. Creates or updates a Dapr Component in a connected environment. @@ -236,17 +310,20 @@ async def create_or_update( :param component_name: Name of the Dapr Component. Required. :type component_name: str :param dapr_component_envelope: Configuration details of the Dapr Component. Required. - :type dapr_component_envelope: ~azure.mgmt.appcontainers.models.DaprComponent + :type dapr_component_envelope: + ~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: DaprComponent or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponent + :return: An instance of AsyncLROPoller that returns either ConnectedEnvironmentDaprComponent or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, @@ -255,7 +332,7 @@ async def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DaprComponent: + ) -> AsyncLROPoller[_models.ConnectedEnvironmentDaprComponent]: """Creates or updates a Dapr Component. Creates or updates a Dapr Component in a connected environment. @@ -272,20 +349,22 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: DaprComponent or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponent + :return: An instance of AsyncLROPoller that returns either ConnectedEnvironmentDaprComponent or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, component_name: str, - dapr_component_envelope: Union[_models.DaprComponent, IO[bytes]], + dapr_component_envelope: Union[_models.ConnectedEnvironmentDaprComponent, IO[bytes]], **kwargs: Any - ) -> _models.DaprComponent: + ) -> AsyncLROPoller[_models.ConnectedEnvironmentDaprComponent]: """Creates or updates a Dapr Component. Creates or updates a Dapr Component in a connected environment. @@ -298,12 +377,69 @@ async def create_or_update( :param component_name: Name of the Dapr Component. Required. :type component_name: str :param dapr_component_envelope: Configuration details of the Dapr Component. Is either a - DaprComponent type or a IO[bytes] type. Required. - :type dapr_component_envelope: ~azure.mgmt.appcontainers.models.DaprComponent or IO[bytes] - :return: DaprComponent or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponent + ConnectedEnvironmentDaprComponent type or a IO[bytes] type. Required. + :type dapr_component_envelope: + ~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ConnectedEnvironmentDaprComponent or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent] :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.ConnectedEnvironmentDaprComponent] = 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, + connected_environment_name=connected_environment_name, + component_name=component_name, + dapr_component_envelope=dapr_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConnectedEnvironmentDaprComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ConnectedEnvironmentDaprComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ConnectedEnvironmentDaprComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, connected_environment_name: str, component_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -312,58 +448,55 @@ async def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DaprComponent] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dapr_component_envelope, (IOBase, bytes)): - _content = dapr_component_envelope - else: - _json = self._serialize.body(dapr_component_envelope, "DaprComponent") - - _request = build_create_or_update_request( + _request = build_delete_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, component_name=component_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, connected_environment_name: str, component_name: str, **kwargs: Any - ) -> None: + ) -> AsyncLROPoller[None]: """Delete a Dapr Component. Delete a Dapr Component from a connected environment. @@ -375,49 +508,52 @@ async def delete( # pylint: disable=inconsistent-return-statements :type connected_environment_name: str :param component_name: Name of the Dapr Component. Required. :type component_name: str - :return: None or the result of cls(response) - :rtype: None + :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: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + component_name=component_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - _request = build_delete_request( - resource_group_name=resource_group_name, - connected_environment_name=connected_environment_name, - component_name=component_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - if cls: - return cls(pipeline_response, None, {}) # type: ignore + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def list_secrets( diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py index 6191edaee4a3..921acd30a914 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py @@ -41,7 +41,6 @@ build_list_by_subscription_request, build_update_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_storages_operations.py index 70da937ebbc0..fae30450a8e6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_storages_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,13 +16,17 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ...operations._connected_environments_storages_operations import ( @@ -31,7 +35,6 @@ build_get_request, build_list_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -183,8 +186,77 @@ async def get( return deserialized # type: ignore + async def _create_or_update_initial( + self, + resource_group_name: str, + connected_environment_name: str, + storage_name: str, + storage_envelope: Union[_models.ConnectedEnvironmentStorage, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(storage_envelope, (IOBase, bytes)): + _content = storage_envelope + else: + _json = self._serialize.body(storage_envelope, "ConnectedEnvironmentStorage") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + storage_name=storage_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @overload - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, @@ -193,7 +265,7 @@ async def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ConnectedEnvironmentStorage: + ) -> AsyncLROPoller[_models.ConnectedEnvironmentStorage]: """Create or update storage for a connectedEnvironment. Create or update storage for a connectedEnvironment. @@ -210,13 +282,15 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ConnectedEnvironmentStorage or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage + :return: An instance of AsyncLROPoller that returns either ConnectedEnvironmentStorage or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, @@ -225,7 +299,7 @@ async def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ConnectedEnvironmentStorage: + ) -> AsyncLROPoller[_models.ConnectedEnvironmentStorage]: """Create or update storage for a connectedEnvironment. Create or update storage for a connectedEnvironment. @@ -242,20 +316,22 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: ConnectedEnvironmentStorage or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage + :return: An instance of AsyncLROPoller that returns either ConnectedEnvironmentStorage or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, storage_name: str, storage_envelope: Union[_models.ConnectedEnvironmentStorage, IO[bytes]], **kwargs: Any - ) -> _models.ConnectedEnvironmentStorage: + ) -> AsyncLROPoller[_models.ConnectedEnvironmentStorage]: """Create or update storage for a connectedEnvironment. Create or update storage for a connectedEnvironment. @@ -271,10 +347,66 @@ async def create_or_update( ConnectedEnvironmentStorage type or a IO[bytes] type. Required. :type storage_envelope: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage or IO[bytes] - :return: ConnectedEnvironmentStorage or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage + :return: An instance of AsyncLROPoller that returns either ConnectedEnvironmentStorage or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage] :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.ConnectedEnvironmentStorage] = 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, + connected_environment_name=connected_environment_name, + storage_name=storage_name, + storage_envelope=storage_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ConnectedEnvironmentStorage].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ConnectedEnvironmentStorage]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, connected_environment_name: str, storage_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -283,58 +415,55 @@ async def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConnectedEnvironmentStorage] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_envelope, (IOBase, bytes)): - _content = storage_envelope - else: - _json = self._serialize.body(storage_envelope, "ConnectedEnvironmentStorage") - - _request = build_create_or_update_request( + _request = build_delete_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, storage_name=storage_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, connected_environment_name: str, storage_name: str, **kwargs: Any - ) -> None: + ) -> AsyncLROPoller[None]: """Delete storage for a connectedEnvironment. Delete storage for a connectedEnvironment. @@ -346,46 +475,49 @@ async def delete( # pylint: disable=inconsistent-return-statements :type connected_environment_name: str :param storage_name: Name of the storage. Required. :type storage_name: str - :return: None or the result of cls(response) - :rtype: None + :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: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - connected_environment_name=connected_environment_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + storage_name=storage_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py index 25573af0b0d6..5f7d8adfd62e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py @@ -34,7 +34,6 @@ build_get_request, build_list_by_container_app_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_by_container_app_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_by_container_app_operations.py new file mode 100644 index 000000000000..4a1965d111b0 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_by_container_app_operations.py @@ -0,0 +1,142 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._container_apps_builds_by_container_app_operations import build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContainerAppsBuildsByContainerAppOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_builds_by_container_app` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, container_app_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ContainerAppsBuildResource"]: + """List Container Apps Build resources by Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :return: An iterator like instance of either ContainerAppsBuildResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ContainerAppsBuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsBuildCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ContainerAppsBuildCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_operations.py new file mode 100644 index 000000000000..c2caea4ecb4e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_operations.py @@ -0,0 +1,235 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._container_apps_builds_operations import build_delete_request, build_get_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContainerAppsBuildsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_builds` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> _models.ContainerAppsBuildResource: + """Get a Container Apps Build resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: ContainerAppsBuildResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ContainerAppsBuildResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsBuildResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ContainerAppsBuildResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Container Apps Build resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py index 05113d05b56b..22cf063d8766 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py @@ -34,7 +34,6 @@ build_list_detectors_request, build_list_revisions_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_label_history_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_label_history_operations.py new file mode 100644 index 000000000000..c122bb4f8ae3 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_label_history_operations.py @@ -0,0 +1,212 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._container_apps_label_history_operations import ( + build_get_label_history_request, + build_list_label_history_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContainerAppsLabelHistoryOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_label_history` 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_label_history( + self, resource_group_name: str, container_app_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.LabelHistory"]: + """Get the Label History for a given Container App. + + Get the Label History for a given Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param filter: The filter to apply on the operation. Default value is None. + :type filter: str + :return: An iterator like instance of either LabelHistory or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.LabelHistory] + :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.LabelHistoryCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_label_history_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("LabelHistoryCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_label_history( + self, resource_group_name: str, container_app_name: str, label_name: str, **kwargs: Any + ) -> _models.LabelHistory: + """Get the history of a label. + + Get the history of a label. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param label_name: Name of the Container App label. Required. + :type label_name: str + :return: LabelHistory or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LabelHistory + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabelHistory] = kwargs.pop("cls", None) + + _request = build_get_label_history_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + label_name=label_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LabelHistory", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py index 73af128a7a96..7b5d63dcf798 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py @@ -45,7 +45,6 @@ build_stop_request, build_update_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_patches_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_patches_operations.py new file mode 100644 index 000000000000..7860b774654c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_patches_operations.py @@ -0,0 +1,664 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._container_apps_patches_operations import ( + build_apply_request, + build_delete_request, + build_get_request, + build_list_by_container_app_request, + build_skip_configure_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContainerAppsPatchesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_patches` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_container_app( + self, resource_group_name: str, container_app_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.ContainerAppsPatchResource"]: + """List Container Apps Patch resources by ContainerApp. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param filter: The filter to apply on the operation. For example, + $filter=properties/patchApplyStatus eq 'Succeeded'. Default value is None. + :type filter: str + :return: An iterator like instance of either ContainerAppsPatchResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PatchCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_container_app_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PatchCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> _models.ContainerAppsPatchResource: + """Get details for specific Container Apps Patch by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: ContainerAppsPatchResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ContainerAppsPatchResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsPatchResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ContainerAppsPatchResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete specific Container Apps Patch by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _skip_configure_initial( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: Union[_models.PatchSkipConfig, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(patch_skip_config, (IOBase, bytes)): + _content = patch_skip_config + else: + _json = self._serialize.body(patch_skip_config, "PatchSkipConfig") + + _request = build_skip_configure_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: _models.PatchSkipConfig, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Required. + :type patch_skip_config: ~azure.mgmt.appcontainers.models.PatchSkipConfig + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Required. + :type patch_skip_config: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: Union[_models.PatchSkipConfig, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Is either a PatchSkipConfig + type or a IO[bytes] type. Required. + :type patch_skip_config: ~azure.mgmt.appcontainers.models.PatchSkipConfig or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._skip_configure_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + patch_skip_config=patch_skip_config, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _apply_initial( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_apply_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_apply( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ContainerAppsPatchResource]: + """Apply a Container Apps Patch resource with patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: An instance of AsyncLROPoller that returns either ContainerAppsPatchResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsPatchResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._apply_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ContainerAppsPatchResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ContainerAppsPatchResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ContainerAppsPatchResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py index 7657e4cccb21..3b22ff21655a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py @@ -28,7 +28,6 @@ build_get_replica_request, build_list_replicas_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py index 08a0379c363c..40a69d7b2126 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py @@ -34,7 +34,6 @@ build_list_revisions_request, build_restart_revision_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_session_pools_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_session_pools_operations.py new file mode 100644 index 000000000000..a5a3cec4ed59 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_session_pools_operations.py @@ -0,0 +1,808 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._container_apps_session_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContainerAppsSessionPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_session_pools` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SessionPool"]: + """Get the session pools in a given subscription. + + Get the session pools in a given subscription. + + :return: An iterator like instance of either SessionPool or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionPoolCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SessionPoolCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.SessionPool"]: + """Get the session pools in a given resource group of a subscription. + + Get the session pools in a given resource group of a subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either SessionPool or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionPoolCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SessionPoolCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, resource_group_name: str, session_pool_name: str, **kwargs: Any) -> _models.SessionPool: + """Get the properties of a session pool. + + Get the properties of a session pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :return: SessionPool or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.SessionPool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionPool] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionPool", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: Union[_models.SessionPool, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_pool_envelope, (IOBase, bytes)): + _content = session_pool_envelope + else: + _json = self._serialize.body(session_pool_envelope, "SessionPool") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: _models.SessionPool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionPool]: + """Create or update a session pool. + + Create or update a session pool with the given properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionPool]: + """Create or update a session pool. + + Create or update a session pool with the given properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: Union[_models.SessionPool, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionPool]: + """Create or update a session pool. + + Create or update a session pool with the given properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Is either a SessionPool + type or a IO[bytes] type. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPool or IO[bytes] + :return: An instance of AsyncLROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SessionPool] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + session_pool_envelope=session_pool_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SessionPool", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.SessionPool].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SessionPool]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: Union[_models.SessionPoolUpdatableProperties, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_pool_envelope, (IOBase, bytes)): + _content = session_pool_envelope + else: + _json = self._serialize.body(session_pool_envelope, "SessionPoolUpdatableProperties") + + _request = build_update_request( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: _models.SessionPoolUpdatableProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionPool]: + """Update properties of a session pool. + + Patches a session pool using JSON merge patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPoolUpdatableProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionPool]: + """Update properties of a session pool. + + Patches a session pool using JSON merge patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: Union[_models.SessionPoolUpdatableProperties, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionPool]: + """Update properties of a session pool. + + Patches a session pool using JSON merge patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Is either a + SessionPoolUpdatableProperties type or a IO[bytes] type. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPoolUpdatableProperties or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SessionPool] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + session_pool_envelope=session_pool_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SessionPool", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.SessionPool].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SessionPool]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, session_pool_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, session_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a session pool. + + Delete the session pool with the given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py index 43a0e201411f..8b1407ce04f5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py @@ -38,7 +38,6 @@ build_get_request, build_list_by_container_app_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -222,6 +221,7 @@ async def _create_or_update_initial( container_app_name: str, source_control_name: str, source_control_envelope: Union[_models.SourceControl, IO[bytes]], + x_ms_github_auxiliary: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -252,6 +252,7 @@ async def _create_or_update_initial( container_app_name=container_app_name, source_control_name=source_control_name, subscription_id=self._config.subscription_id, + x_ms_github_auxiliary=x_ms_github_auxiliary, api_version=api_version, content_type=content_type, json=_json, @@ -292,6 +293,7 @@ async def begin_create_or_update( container_app_name: str, source_control_name: str, source_control_envelope: _models.SourceControl, + x_ms_github_auxiliary: Optional[str] = None, *, content_type: str = "application/json", **kwargs: Any @@ -310,6 +312,9 @@ async def begin_create_or_update( :param source_control_envelope: Properties used to create a Container App SourceControl. Required. :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -326,6 +331,7 @@ async def begin_create_or_update( container_app_name: str, source_control_name: str, source_control_envelope: IO[bytes], + x_ms_github_auxiliary: Optional[str] = None, *, content_type: str = "application/json", **kwargs: Any @@ -344,6 +350,9 @@ async def begin_create_or_update( :param source_control_envelope: Properties used to create a Container App SourceControl. Required. :type source_control_envelope: IO[bytes] + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -360,6 +369,7 @@ async def begin_create_or_update( container_app_name: str, source_control_name: str, source_control_envelope: Union[_models.SourceControl, IO[bytes]], + x_ms_github_auxiliary: Optional[str] = None, **kwargs: Any ) -> AsyncLROPoller[_models.SourceControl]: """Create or update the SourceControl for a Container App. @@ -376,6 +386,9 @@ async def begin_create_or_update( :param source_control_envelope: Properties used to create a Container App SourceControl. Is either a SourceControl type or a IO[bytes] type. Required. :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl or IO[bytes] + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str :return: An instance of AsyncLROPoller that returns either SourceControl or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SourceControl] @@ -396,6 +409,7 @@ async def begin_create_or_update( container_app_name=container_app_name, source_control_name=source_control_name, source_control_envelope=source_control_envelope, + x_ms_github_auxiliary=x_ms_github_auxiliary, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -430,7 +444,14 @@ def get_long_running_output(pipeline_response): ) async def _delete_initial( - self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any + self, + resource_group_name: str, + container_app_name: str, + source_control_name: str, + x_ms_github_auxiliary: Optional[str] = None, + ignore_workflow_deletion_failure: Optional[bool] = None, + delete_workflow: Optional[bool] = None, + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -451,6 +472,9 @@ async def _delete_initial( container_app_name=container_app_name, source_control_name=source_control_name, subscription_id=self._config.subscription_id, + x_ms_github_auxiliary=x_ms_github_auxiliary, + ignore_workflow_deletion_failure=ignore_workflow_deletion_failure, + delete_workflow=delete_workflow, api_version=api_version, headers=_headers, params=_params, @@ -483,7 +507,14 @@ async def _delete_initial( @distributed_trace_async async def begin_delete( - self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any + self, + resource_group_name: str, + container_app_name: str, + source_control_name: str, + x_ms_github_auxiliary: Optional[str] = None, + ignore_workflow_deletion_failure: Optional[bool] = None, + delete_workflow: Optional[bool] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Delete a Container App SourceControl. @@ -496,6 +527,14 @@ async def begin_delete( :type container_app_name: str :param source_control_name: Name of the Container App SourceControl. Required. :type source_control_name: str + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str + :param ignore_workflow_deletion_failure: Ignore Workflow Deletion Failure. Default value is + None. + :type ignore_workflow_deletion_failure: bool + :param delete_workflow: Delete workflow. Default value is None. + :type delete_workflow: bool :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -513,6 +552,9 @@ async def begin_delete( resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, + x_ms_github_auxiliary=x_ms_github_auxiliary, + ignore_workflow_deletion_failure=ignore_workflow_deletion_failure, + delete_workflow=delete_workflow, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, 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..83bef2cb2959 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_component_resiliency_policies_operations.py @@ -0,0 +1,444 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._dapr_component_resiliency_policies_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DaprComponentResiliencyPoliciesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`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 + :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: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + @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 + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + 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 + :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[bytes], + *, + 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[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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[bytes]], + **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[bytes] type. + Required. + :type dapr_component_resiliency_policy_envelope: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy or IO[bytes] + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, 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 + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py index 8af3e37345a3..000354f1d838 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py @@ -35,7 +35,6 @@ build_list_request, build_list_secrets_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping 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..6f92d52e2b97 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_subscriptions_operations.py @@ -0,0 +1,420 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._dapr_subscriptions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class 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 + :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: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + @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 + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprSubscription", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + 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 + :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[bytes], + *, + 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[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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[bytes]], + **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[bytes] type. Required. + :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription or + IO[bytes] + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprSubscription", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, 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 + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dot_net_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dot_net_components_operations.py new file mode 100644 index 000000000000..cbf95800c59a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dot_net_components_operations.py @@ -0,0 +1,765 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._dot_net_components_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DotNetComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`dot_net_components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DotNetComponent"]: + """Get the .NET Components for a managed environment. + + Get the .NET Components 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 + :return: An iterator like instance of either DotNetComponent or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DotNetComponent] + :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.DotNetComponentsCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DotNetComponentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> _models.DotNetComponent: + """Get a .NET Component. + + Get a .NET 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 name: Name of the .NET Component. Required. + :type name: str + :return: DotNetComponent or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DotNetComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DotNetComponent] = 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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dot_net_component_envelope, (IOBase, bytes)): + _content = dot_net_component_envelope + else: + _json = self._serialize.body(dot_net_component_envelope, "DotNetComponent") + + _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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: _models.DotNetComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component 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 .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component 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 .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component 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 .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Is either a + DotNetComponent type or a IO[bytes] type. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :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.DotNetComponent] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + dot_net_component_envelope=dot_net_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DotNetComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DotNetComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dot_net_component_envelope, (IOBase, bytes)): + _content = dot_net_component_envelope + else: + _json = self._serialize.body(dot_net_component_envelope, "DotNetComponent") + + _request = build_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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: _models.DotNetComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Is either a + DotNetComponent type or a IO[bytes] type. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :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.DotNetComponent] = 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, + environment_name=environment_name, + name=name, + dot_net_component_envelope=dot_net_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DotNetComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DotNetComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a .NET Component. + + Delete a .NET 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 name: Name of the .NET Component. Required. + :type name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_functions_extension_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_functions_extension_operations.py new file mode 100644 index 000000000000..5842f2f55257 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_functions_extension_operations.py @@ -0,0 +1,125 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._functions_extension_operations import build_invoke_functions_host_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class FunctionsExtensionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`functions_extension` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def invoke_functions_host( + self, + resource_group_name: str, + container_app_name: str, + revision_name: str, + function_app_name: str, + **kwargs: Any + ) -> str: + """Proxies a Functions host call to the function app backed by the container app. + + Proxies a Functions host call to the function app backed by the container app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param revision_name: Name of the Container App Revision, the parent resource. Required. + :type revision_name: str + :param function_app_name: Name of the Function App, the extension resource. Required. + :type function_app_name: str + :return: str or the result of cls(response) + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_invoke_functions_host_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + revision_name=revision_name, + function_app_name=function_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("str", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_http_route_config_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_http_route_config_operations.py new file mode 100644 index 000000000000..32e2415b65c1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_http_route_config_operations.py @@ -0,0 +1,574 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._http_route_config_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class HttpRouteConfigOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`http_route_config` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, http_route_name: str, **kwargs: Any + ) -> _models.HttpRouteConfig: + """Get the specified Managed Http Route Config. + + Get the specified Managed Http Route Config. + + :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 http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.HttpRouteConfig] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + http_route_name=http_route_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HttpRouteConfig", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: Optional[_models.HttpRouteConfig] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Create or Update a Http Route Config. + + Create or Update a Http Route Config. + + :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 http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Http Route config to be created or updated. Default value is + None. + :type http_route_config_envelope: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Create or Update a Http Route Config. + + Create or Update a Http Route Config. + + :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 http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Http Route config to be created or updated. Default value is + None. + :type http_route_config_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: Optional[Union[_models.HttpRouteConfig, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Create or Update a Http Route Config. + + Create or Update a Http Route Config. + + :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 http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Http Route config to be created or updated. Is either a + HttpRouteConfig type or a IO[bytes] type. Default value is None. + :type http_route_config_envelope: ~azure.mgmt.appcontainers.models.HttpRouteConfig or IO[bytes] + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HttpRouteConfig] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(http_route_config_envelope, (IOBase, bytes)): + _content = http_route_config_envelope + else: + if http_route_config_envelope is not None: + _json = self._serialize.body(http_route_config_envelope, "HttpRouteConfig") + else: + _json = None + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + http_route_name=http_route_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HttpRouteConfig", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: _models.HttpRouteConfig, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Update tags of a manged http route object. + + Patches an http route config resource. Only patching of tags is supported. + + :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 http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Properties of http route config that need to be updated. + Required. + :type http_route_config_envelope: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Update tags of a manged http route object. + + Patches an http route config resource. Only patching of tags is supported. + + :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 http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Properties of http route config that need to be updated. + Required. + :type http_route_config_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: Union[_models.HttpRouteConfig, IO[bytes]], + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Update tags of a manged http route object. + + Patches an http route config resource. Only patching of tags is supported. + + :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 http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Properties of http route config that need to be updated. Is + either a HttpRouteConfig type or a IO[bytes] type. Required. + :type http_route_config_envelope: ~azure.mgmt.appcontainers.models.HttpRouteConfig or IO[bytes] + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HttpRouteConfig] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(http_route_config_envelope, (IOBase, bytes)): + _content = http_route_config_envelope + else: + _json = self._serialize.body(http_route_config_envelope, "HttpRouteConfig") + + _request = build_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + http_route_name=http_route_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HttpRouteConfig", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, http_route_name: str, **kwargs: Any + ) -> None: + """Deletes the specified Managed Http Route. + + Deletes the specified Managed Http Route. + + :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 http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + http_route_name=http_route_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.HttpRouteConfig"]: + """Get the Managed Http Routes in a given managed environment. + + Get the Managed Http Routes in a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either HttpRouteConfig or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.HttpRouteConfig] + :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.HttpRouteConfigCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("HttpRouteConfigCollection", 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) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py new file mode 100644 index 000000000000..ade6507b432b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py @@ -0,0 +1,764 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._java_components_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class JavaComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`java_components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.JavaComponent"]: + """Get the Java Components for a managed environment. + + Get the Java Components 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 + :return: An iterator like instance of either JavaComponent or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.JavaComponent] + :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.JavaComponentsCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("JavaComponentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> _models.JavaComponent: + """Get a Java Component. + + Get a Java 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 name: Name of the Java Component. Required. + :type name: str + :return: JavaComponent or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.JavaComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.JavaComponent] = 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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("JavaComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(java_component_envelope, (IOBase, bytes)): + _content = java_component_envelope + else: + _json = self._serialize.body(java_component_envelope, "JavaComponent") + + _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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: _models.JavaComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JavaComponent]: + """Creates or updates a Java Component. + + Creates or updates a Java Component 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 Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JavaComponent]: + """Creates or updates a Java Component. + + Creates or updates a Java Component 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 Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.JavaComponent]: + """Creates or updates a Java Component. + + Creates or updates a Java Component 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 Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Is either a + JavaComponent type or a IO[bytes] type. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent or IO[bytes] + :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :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.JavaComponent] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + java_component_envelope=java_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JavaComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.JavaComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.JavaComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(java_component_envelope, (IOBase, bytes)): + _content = java_component_envelope + else: + _json = self._serialize.body(java_component_envelope, "JavaComponent") + + _request = build_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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: _models.JavaComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JavaComponent]: + """Update properties of a Java Component. + + Patches a Java Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JavaComponent]: + """Update properties of a Java Component. + + Patches a Java Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.JavaComponent]: + """Update properties of a Java Component. + + Patches a Java Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Is either a + JavaComponent type or a IO[bytes] type. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent or IO[bytes] + :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :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.JavaComponent] = 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, + environment_name=environment_name, + name=name, + java_component_envelope=java_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JavaComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.JavaComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.JavaComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Java Component. + + Delete a Java 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 name: Name of the Java Component. Required. + :type name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_executions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_executions_operations.py index 315e67ddf9b2..c261a646f9a7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_executions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_executions_operations.py @@ -27,7 +27,6 @@ from ... import models as _models from ...operations._jobs_executions_operations import build_list_request -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping 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 b6fa273f0f71..1a9c1c601aa5 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 @@ -42,12 +42,13 @@ build_list_detectors_request, build_list_secrets_request, build_proxy_get_request, + build_resume_request, build_start_request, build_stop_execution_request, build_stop_multiple_executions_request, + build_suspend_request, build_update_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -57,7 +58,7 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class JobsOperations: +class JobsOperations: # pylint: disable=too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. @@ -227,7 +228,7 @@ async def get_detector( @distributed_trace_async async def proxy_get(self, resource_group_name: str, job_name: str, api_name: str, **kwargs: Any) -> _models.Job: - """Get the properties of a Container App Job. + """Get the properties for a given Container App Job. Get the properties of a Container App Job. @@ -1508,3 +1509,241 @@ async def list_secrets( return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + + async def _resume_initial(self, resource_group_name: str, job_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_resume_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_resume(self, resource_group_name: str, job_name: str, **kwargs: Any) -> AsyncLROPoller[_models.Job]: + """Resumes a suspended job. + + Resumes a suspended 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: Name of the Job. Required. + :type job_name: str + :return: An instance of AsyncLROPoller that returns either Job or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Job] + :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.Job] = 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._resume_initial( + resource_group_name=resource_group_name, + job_name=job_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Job", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Job].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Job]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _suspend_initial(self, resource_group_name: str, job_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_suspend_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_suspend( + self, resource_group_name: str, job_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.Job]: + """Suspends a job. + + Suspends a 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: Name of the Job. Required. + :type job_name: str + :return: An instance of AsyncLROPoller that returns either Job or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Job] + :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.Job] = 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._suspend_initial( + resource_group_name=resource_group_name, + job_name=job_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Job", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Job].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Job]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_logic_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_logic_apps_operations.py new file mode 100644 index 000000000000..cc823a950fa5 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_logic_apps_operations.py @@ -0,0 +1,767 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._logic_apps_operations import ( + build_create_or_update_request, + build_delete_request, + build_deploy_workflow_artifacts_request, + build_get_request, + build_get_workflow_request, + build_invoke_request, + build_list_workflows_connections_request, + build_list_workflows_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class LogicAppsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`logic_apps` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> _models.LogicApp: + """Gets a logic app extension resource. + + Gets a logic app extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LogicApp] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LogicApp", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: _models.LogicApp, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Required. + :type resource: ~azure.mgmt.appcontainers.models.LogicApp + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: Union[_models.LogicApp, IO[bytes]], + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Is either a LogicApp type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.appcontainers.models.LogicApp or IO[bytes] + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LogicApp] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "LogicApp") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LogicApp", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> None: + """Deletes a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_workflows( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> AsyncIterable["_models.WorkflowEnvelope"]: + """List the workflows for a logic app. + + List the workflows for a logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: An iterator like instance of either WorkflowEnvelope or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.WorkflowEnvelope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelopeCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_workflows_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WorkflowEnvelopeCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_workflow( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, workflow_name: str, **kwargs: Any + ) -> _models.WorkflowEnvelope: + """Get workflow information by its name. + + Get workflow information by its name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_name: Workflow name. Required. + :type workflow_name: str + :return: WorkflowEnvelope or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.WorkflowEnvelope + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelope] = kwargs.pop("cls", None) + + _request = build_get_workflow_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + workflow_name=workflow_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[_models.WorkflowArtifacts] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Default value is + None. + :type workflow_artifacts: ~azure.mgmt.appcontainers.models.WorkflowArtifacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Default value is + None. + :type workflow_artifacts: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[Union[_models.WorkflowArtifacts, IO[bytes]]] = None, + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Is either a + WorkflowArtifacts type or a IO[bytes] type. Default value is None. + :type workflow_artifacts: ~azure.mgmt.appcontainers.models.WorkflowArtifacts or IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workflow_artifacts, (IOBase, bytes)): + _content = workflow_artifacts + else: + if workflow_artifacts is not None: + _json = self._serialize.body(workflow_artifacts, "WorkflowArtifacts") + else: + _json = None + + _request = build_deploy_workflow_artifacts_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def list_workflows_connections( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> _models.WorkflowEnvelope: + """Gets logic app's connections. + + Gets logic app's connections. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: WorkflowEnvelope or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.WorkflowEnvelope + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelope] = kwargs.pop("cls", None) + + _request = build_list_workflows_connections_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def invoke( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + x_ms_logic_apps_proxy_path: str, + x_ms_logic_apps_proxy_method: Union[str, _models.LogicAppsProxyMethod], + **kwargs: Any + ) -> JSON: + """Proxies a the API call to the logic app backed by the container app. + + Proxies a the API call to the logic app backed by the container app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the LogicApp App, the extension resource. Required. + :type logic_app_name: str + :param x_ms_logic_apps_proxy_path: The proxy path for the API call. Required. + :type x_ms_logic_apps_proxy_path: str + :param x_ms_logic_apps_proxy_method: The proxy method for the API call. Known values are: "GET" + and "POST". Required. + :type x_ms_logic_apps_proxy_method: str or + ~azure.mgmt.appcontainers.models.LogicAppsProxyMethod + :return: JSON or the result of cls(response) + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_invoke_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + x_ms_logic_apps_proxy_path=x_ms_logic_apps_proxy_path, + x_ms_logic_apps_proxy_method=x_ms_logic_apps_proxy_method, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("object", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_maintenance_configurations_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_maintenance_configurations_operations.py new file mode 100644 index 000000000000..8f8e164644a9 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_maintenance_configurations_operations.py @@ -0,0 +1,413 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`maintenance_configurations` 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.MaintenanceConfigurationResource"]: + """Gets all maintenance configurations in the specified 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: The name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either MaintenanceConfigurationResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource] + :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.MaintenanceConfigurationCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("MaintenanceConfigurationCollection", 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) + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + config_name: str, + maintenance_configuration_envelope: _models.MaintenanceConfigurationResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfigurationResource: + """Create or update the maintenance configuration for 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: The name of the Managed Environment. Required. + :type environment_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param maintenance_configuration_envelope: Parameters to set the maintenance configuration for + ManagedEnvironment . Required. + :type maintenance_configuration_envelope: + ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MaintenanceConfigurationResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + config_name: str, + maintenance_configuration_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfigurationResource: + """Create or update the maintenance configuration for 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: The name of the Managed Environment. Required. + :type environment_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param maintenance_configuration_envelope: Parameters to set the maintenance configuration for + ManagedEnvironment . Required. + :type maintenance_configuration_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: MaintenanceConfigurationResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + config_name: str, + maintenance_configuration_envelope: Union[_models.MaintenanceConfigurationResource, IO[bytes]], + **kwargs: Any + ) -> _models.MaintenanceConfigurationResource: + """Create or update the maintenance configuration for 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: The name of the Managed Environment. Required. + :type environment_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param maintenance_configuration_envelope: Parameters to set the maintenance configuration for + ManagedEnvironment . Is either a MaintenanceConfigurationResource type or a IO[bytes] type. + Required. + :type maintenance_configuration_envelope: + ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource or IO[bytes] + :return: MaintenanceConfigurationResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MaintenanceConfigurationResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(maintenance_configuration_envelope, (IOBase, bytes)): + _content = maintenance_configuration_envelope + else: + _json = self._serialize.body(maintenance_configuration_envelope, "MaintenanceConfigurationResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MaintenanceConfigurationResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, config_name: str, **kwargs: Any + ) -> None: + """Deletes the maintenance configuration of a ManagedEnvironment . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: The name of the Managed Environment. Required. + :type environment_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, config_name: str, **kwargs: Any + ) -> _models.MaintenanceConfigurationResource: + """Gets the maintenance configuration of a ManagedEnvironment . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: The name of the Managed Environment. Required. + :type environment_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :return: MaintenanceConfigurationResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MaintenanceConfigurationResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MaintenanceConfigurationResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py index 48dd8d1cb147..39cff80465ea 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py @@ -39,7 +39,6 @@ build_list_request, build_update_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_diagnostics_operations.py index f7d05ad4b0fc..a2b62113b50a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_diagnostics_operations.py @@ -28,7 +28,6 @@ build_get_detector_request, build_list_detectors_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_endpoint_connections_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..c90077c27e4f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_endpoint_connections_operations.py @@ -0,0 +1,557 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._managed_environment_private_endpoint_connections_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ManagedEnvironmentPrivateEndpointConnectionsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`managed_environment_private_endpoint_connections` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnection"]: + """List private endpoint connections for a given managed environment. + + List private endpoint connections for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Get a private endpoint connection for a given managed environment. + + Get a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(private_endpoint_connection_envelope, (IOBase, bytes)): + _content = private_endpoint_connection_envelope + else: + _json = self._serialize.body(private_endpoint_connection_envelope, "PrivateEndpointConnection") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Required. + :type private_endpoint_connection_envelope: + ~azure.mgmt.appcontainers.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Required. + :type private_endpoint_connection_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. + :type private_endpoint_connection_envelope: + ~azure.mgmt.appcontainers.models.PrivateEndpointConnection or IO[bytes] + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection_envelope=private_endpoint_connection_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a private endpoint connection for a given managed environment. + + Delete a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_link_resources_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_link_resources_operations.py new file mode 100644 index 000000000000..59636be922d3 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_link_resources_operations.py @@ -0,0 +1,143 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._managed_environment_private_link_resources_operations import build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ManagedEnvironmentPrivateLinkResourcesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`managed_environment_private_link_resources` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateLinkResource"]: + """List private link resources for a given managed environment. + + List private link resources for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py index 32e5aba171df..f41521e7076b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py @@ -27,7 +27,6 @@ from ... import models as _models from ...operations._managed_environment_usages_operations import build_list_request -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_diagnostics_operations.py index 72e6fae60a64..913445a2aa38 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_diagnostics_operations.py @@ -25,7 +25,6 @@ from ... import models as _models from ...operations._managed_environments_diagnostics_operations import build_get_root_request -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py index 7cec22ada4f3..58184362c225 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py @@ -42,7 +42,6 @@ build_list_workload_profile_states_request, build_update_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py index 6cba2a4bde27..4df31389d777 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py @@ -31,7 +31,6 @@ build_get_request, build_list_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py index cc4441b9b104..6c4b11ba1a03 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py @@ -26,7 +26,6 @@ from ... import models as _models from ...operations._namespaces_operations import build_check_name_availability_request -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py index eede32e9e752..05240797532c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py @@ -27,7 +27,6 @@ from ... import models as _models from ...operations._operations import build_list_request -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py index be6430b54a7c..3cb70b68e447 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py @@ -27,7 +27,6 @@ from ... import models as _models from ...operations._usages_operations import build_list_request -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping 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 132ece90cb50..804959be5c91 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 @@ -32,16 +35,28 @@ 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 CertificateKeyVaultProperties 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 from ._models_py3 import ConnectedEnvironmentCollection +from ._models_py3 import ConnectedEnvironmentDaprComponent +from ._models_py3 import ConnectedEnvironmentDaprComponentProperties +from ._models_py3 import ConnectedEnvironmentDaprComponentsCollection from ._models_py3 import ConnectedEnvironmentStorage from ._models_py3 import ConnectedEnvironmentStorageProperties from ._models_py3 import ConnectedEnvironmentStoragesCollection @@ -54,10 +69,19 @@ from ._models_py3 import ContainerAppProbeHttpGet from ._models_py3 import ContainerAppProbeHttpGetHttpHeadersItem from ._models_py3 import ContainerAppProbeTcpSocket +from ._models_py3 import ContainerAppPropertiesPatchingConfiguration from ._models_py3 import ContainerAppSecret +from ._models_py3 import ContainerAppsBuildCollection +from ._models_py3 import ContainerAppsBuildConfiguration +from ._models_py3 import ContainerAppsBuildResource +from ._models_py3 import ContainerAppsPatchResource +from ._models_py3 import ContainerExecutionStatus +from ._models_py3 import ContainerRegistry +from ._models_py3 import ContainerRegistryWithCustomImage from ._models_py3 import ContainerResources from ._models_py3 import CookieExpiration from ._models_py3 import CorsPolicy +from ._models_py3 import CustomContainerTemplate from ._models_py3 import CustomDomain from ._models_py3 import CustomDomainConfiguration from ._models_py3 import CustomHostnameAnalysisResult @@ -67,15 +91,32 @@ from ._models_py3 import CustomScaleRule from ._models_py3 import Dapr from ._models_py3 import DaprComponent +from ._models_py3 import DaprComponentProperties +from ._models_py3 import DaprComponentResiliencyPoliciesCollection +from ._models_py3 import DaprComponentResiliencyPolicy +from ._models_py3 import DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration +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 @@ -88,12 +129,20 @@ from ._models_py3 import DiagnosticsDefinition from ._models_py3 import DiagnosticsProperties from ._models_py3 import DiagnosticsStatus +from ._models_py3 import DotNetComponent +from ._models_py3 import DotNetComponentConfigurationProperty +from ._models_py3 import DotNetComponentServiceBind +from ._models_py3 import DotNetComponentsCollection +from ._models_py3 import DynamicPoolConfiguration from ._models_py3 import EncryptionSettings from ._models_py3 import EnvironmentAuthToken from ._models_py3 import EnvironmentVar +from ._models_py3 import EnvironmentVariable from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorEntity from ._models_py3 import ErrorResponse +from ._models_py3 import ExecutionStatus from ._models_py3 import ExtendedLocation from ._models_py3 import Facebook from ._models_py3 import ForwardProxy @@ -101,15 +150,37 @@ from ._models_py3 import GithubActionConfiguration from ._models_py3 import GlobalValidation from ._models_py3 import Google +from ._models_py3 import Header +from ._models_py3 import HeaderMatch +from ._models_py3 import HttpConnectionPool +from ._models_py3 import HttpGet +from ._models_py3 import HttpRetryPolicy +from ._models_py3 import HttpRoute +from ._models_py3 import HttpRouteAction +from ._models_py3 import HttpRouteConfig +from ._models_py3 import HttpRouteConfigCollection +from ._models_py3 import HttpRouteConfigProperties +from ._models_py3 import HttpRouteMatch +from ._models_py3 import HttpRouteProvisioningErrors +from ._models_py3 import HttpRouteRule +from ._models_py3 import HttpRouteTarget from ._models_py3 import HttpScaleRule from ._models_py3 import HttpSettings from ._models_py3 import HttpSettingsRoutes from ._models_py3 import IdentityProviders +from ._models_py3 import IdentitySettings from ._models_py3 import Ingress from ._models_py3 import IngressPortMapping from ._models_py3 import IngressStickySessions from ._models_py3 import InitContainer from ._models_py3 import IpSecurityRestrictionRule +from ._models_py3 import JavaComponent +from ._models_py3 import JavaComponentConfigurationProperty +from ._models_py3 import JavaComponentIngress +from ._models_py3 import JavaComponentProperties +from ._models_py3 import JavaComponentPropertiesScale +from ._models_py3 import JavaComponentServiceBind +from ._models_py3 import JavaComponentsCollection from ._models_py3 import Job from ._models_py3 import JobConfiguration from ._models_py3 import JobConfigurationEventTriggerConfig @@ -129,11 +200,20 @@ from ._models_py3 import JobsCollection from ._models_py3 import JwtClaimChecks from ._models_py3 import KedaConfiguration +from ._models_py3 import LabelHistory +from ._models_py3 import LabelHistoryCollection +from ._models_py3 import LabelHistoryProperties +from ._models_py3 import LabelHistoryRecordItem from ._models_py3 import ListUsagesResult from ._models_py3 import LogAnalyticsConfiguration +from ._models_py3 import LoggerSetting +from ._models_py3 import LogicApp from ._models_py3 import Login from ._models_py3 import LoginRoutes from ._models_py3 import LoginScopes +from ._models_py3 import LogsConfiguration +from ._models_py3 import MaintenanceConfigurationCollection +from ._models_py3 import MaintenanceConfigurationResource from ._models_py3 import ManagedCertificate from ._models_py3 import ManagedCertificateCollection from ._models_py3 import ManagedCertificatePatch @@ -146,15 +226,34 @@ from ._models_py3 import ManagedEnvironmentStorageProperties from ._models_py3 import ManagedEnvironmentStoragesCollection from ._models_py3 import ManagedEnvironmentsCollection +from ._models_py3 import ManagedIdentitySetting from ._models_py3 import ManagedServiceIdentity +from ._models_py3 import MetricsConfiguration from ._models_py3 import Mtls +from ._models_py3 import NacosComponent +from ._models_py3 import NfsAzureFileProperties from ._models_py3 import Nonce from ._models_py3 import OpenIdConnectClientCredential 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 OtlpConfiguration +from ._models_py3 import PatchCollection +from ._models_py3 import PatchDetails +from ._models_py3 import PatchDetailsNewLayer +from ._models_py3 import PatchDetailsOldLayer +from ._models_py3 import PatchProperties +from ._models_py3 import PatchSkipConfig +from ._models_py3 import PreBuildStep +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState from ._models_py3 import ProxyResource from ._models_py3 import QueueScaleRule from ._models_py3 import RegistryCredentials @@ -162,23 +261,50 @@ from ._models_py3 import Replica from ._models_py3 import ReplicaCollection from ._models_py3 import ReplicaContainer +from ._models_py3 import ReplicaExecutionStatus from ._models_py3 import Resource from ._models_py3 import Revision from ._models_py3 import RevisionCollection +from ._models_py3 import Runtime +from ._models_py3 import RuntimeDotnet +from ._models_py3 import RuntimeJava +from ._models_py3 import RuntimeJavaAgent +from ._models_py3 import RuntimeJavaAgentLogging from ._models_py3 import Scale +from ._models_py3 import ScaleConfiguration from ._models_py3 import ScaleRule from ._models_py3 import ScaleRuleAuth +from ._models_py3 import ScgRoute +from ._models_py3 import ScheduledEntry from ._models_py3 import Secret from ._models_py3 import SecretVolumeItem from ._models_py3 import SecretsCollection from ._models_py3 import Service from ._models_py3 import ServiceBind +from ._models_py3 import SessionContainer +from ._models_py3 import SessionContainerResources +from ._models_py3 import SessionIngress +from ._models_py3 import SessionNetworkConfiguration +from ._models_py3 import SessionPool +from ._models_py3 import SessionPoolCollection +from ._models_py3 import SessionPoolSecret +from ._models_py3 import SessionPoolUpdatableProperties +from ._models_py3 import SessionRegistryCredentials +from ._models_py3 import SmbStorage from ._models_py3 import SourceControl from ._models_py3 import SourceControlCollection +from ._models_py3 import SpringBootAdminComponent +from ._models_py3 import SpringCloudConfigComponent +from ._models_py3 import SpringCloudEurekaComponent +from ._models_py3 import SpringCloudGatewayComponent from ._models_py3 import SystemData +from ._models_py3 import TcpConnectionPool +from ._models_py3 import TcpRetryPolicy 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 @@ -189,6 +315,11 @@ from ._models_py3 import VnetConfiguration from ._models_py3 import Volume from ._models_py3 import VolumeMount +from ._models_py3 import WorkflowArtifacts +from ._models_py3 import WorkflowEnvelope +from ._models_py3 import WorkflowEnvelopeCollection +from ._models_py3 import WorkflowEnvelopeProperties +from ._models_py3 import WorkflowHealth from ._models_py3 import WorkloadProfile from ._models_py3 import WorkloadProfileStates from ._models_py3 import WorkloadProfileStatesCollection @@ -201,34 +332,68 @@ 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 ConnectedEnvironmentDaprComponentProvisioningState from ._container_apps_api_client_enums import ConnectedEnvironmentProvisioningState +from ._container_apps_api_client_enums import ConnectedEnvironmentStorageProvisioningState from ._container_apps_api_client_enums import ContainerAppContainerRunningState from ._container_apps_api_client_enums import ContainerAppProvisioningState from ._container_apps_api_client_enums import ContainerAppReplicaRunningState +from ._container_apps_api_client_enums import ContainerAppRunningStatus +from ._container_apps_api_client_enums import ContainerType from ._container_apps_api_client_enums import CookieExpirationConvention from ._container_apps_api_client_enums import CreatedByType +from ._container_apps_api_client_enums import DetectionStatus from ._container_apps_api_client_enums import DnsVerificationTestResult +from ._container_apps_api_client_enums import DotNetComponentProvisioningState +from ._container_apps_api_client_enums import DotNetComponentType from ._container_apps_api_client_enums import EnvironmentProvisioningState +from ._container_apps_api_client_enums import ExecutionType from ._container_apps_api_client_enums import ExtendedLocationTypes from ._container_apps_api_client_enums import ForwardProxyConvention +from ._container_apps_api_client_enums import HttpRouteProvisioningState +from ._container_apps_api_client_enums import IdentitySettingsLifeCycle +from ._container_apps_api_client_enums import ImageType from ._container_apps_api_client_enums import IngressClientCertificateMode +from ._container_apps_api_client_enums import IngressTargetPortHttpScheme from ._container_apps_api_client_enums import IngressTransportMethod +from ._container_apps_api_client_enums import JavaComponentProvisioningState +from ._container_apps_api_client_enums import JavaComponentType from ._container_apps_api_client_enums import JobExecutionRunningState from ._container_apps_api_client_enums import JobProvisioningState +from ._container_apps_api_client_enums import JobRunningState +from ._container_apps_api_client_enums import Kind +from ._container_apps_api_client_enums import Level from ._container_apps_api_client_enums import LogLevel +from ._container_apps_api_client_enums import LogicAppsProxyMethod from ._container_apps_api_client_enums import ManagedCertificateDomainControlValidation from ._container_apps_api_client_enums import ManagedServiceIdentityType +from ._container_apps_api_client_enums import PatchApplyStatus +from ._container_apps_api_client_enums import PatchType +from ._container_apps_api_client_enums import PatchingMode +from ._container_apps_api_client_enums import PoolManagementType +from ._container_apps_api_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_apps_api_client_enums import PrivateEndpointServiceConnectionStatus +from ._container_apps_api_client_enums import PublicNetworkAccess from ._container_apps_api_client_enums import RevisionHealthState from ._container_apps_api_client_enums import RevisionProvisioningState from ._container_apps_api_client_enums import RevisionRunningState from ._container_apps_api_client_enums import Scheme +from ._container_apps_api_client_enums import SessionNetworkStatus +from ._container_apps_api_client_enums import SessionPoolProvisioningState from ._container_apps_api_client_enums import SourceControlOperationState from ._container_apps_api_client_enums import StorageType from ._container_apps_api_client_enums import TriggerType from ._container_apps_api_client_enums import Type from ._container_apps_api_client_enums import UnauthenticatedClientActionV2 +from ._container_apps_api_client_enums import WeekDay +from ._container_apps_api_client_enums import WorkflowHealthState +from ._container_apps_api_client_enums import WorkflowState from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk @@ -236,8 +401,11 @@ __all__ = [ "AllowedAudiencesValidation", "AllowedPrincipals", + "AppInsightsConfiguration", "AppLogsConfiguration", "AppRegistration", + "AppResiliency", + "AppResiliencyCollection", "Apple", "AppleRegistration", "AuthConfig", @@ -260,16 +428,28 @@ "BillingMeterCollection", "BillingMeterProperties", "BlobStorageTokenStore", + "BuildCollection", + "BuildConfiguration", + "BuildResource", + "BuildToken", + "BuilderCollection", + "BuilderResource", + "BuilderResourceUpdate", "Certificate", "CertificateCollection", + "CertificateKeyVaultProperties", "CertificatePatch", "CertificateProperties", "CheckNameAvailabilityRequest", "CheckNameAvailabilityResponse", + "CircuitBreakerPolicy", "ClientRegistration", "Configuration", "ConnectedEnvironment", "ConnectedEnvironmentCollection", + "ConnectedEnvironmentDaprComponent", + "ConnectedEnvironmentDaprComponentProperties", + "ConnectedEnvironmentDaprComponentsCollection", "ConnectedEnvironmentStorage", "ConnectedEnvironmentStorageProperties", "ConnectedEnvironmentStoragesCollection", @@ -282,10 +462,19 @@ "ContainerAppProbeHttpGet", "ContainerAppProbeHttpGetHttpHeadersItem", "ContainerAppProbeTcpSocket", + "ContainerAppPropertiesPatchingConfiguration", "ContainerAppSecret", + "ContainerAppsBuildCollection", + "ContainerAppsBuildConfiguration", + "ContainerAppsBuildResource", + "ContainerAppsPatchResource", + "ContainerExecutionStatus", + "ContainerRegistry", + "ContainerRegistryWithCustomImage", "ContainerResources", "CookieExpiration", "CorsPolicy", + "CustomContainerTemplate", "CustomDomain", "CustomDomainConfiguration", "CustomHostnameAnalysisResult", @@ -295,15 +484,32 @@ "CustomScaleRule", "Dapr", "DaprComponent", + "DaprComponentProperties", + "DaprComponentResiliencyPoliciesCollection", + "DaprComponentResiliencyPolicy", + "DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration", + "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", @@ -316,12 +522,20 @@ "DiagnosticsDefinition", "DiagnosticsProperties", "DiagnosticsStatus", + "DotNetComponent", + "DotNetComponentConfigurationProperty", + "DotNetComponentServiceBind", + "DotNetComponentsCollection", + "DynamicPoolConfiguration", "EncryptionSettings", "EnvironmentAuthToken", "EnvironmentVar", + "EnvironmentVariable", "ErrorAdditionalInfo", "ErrorDetail", + "ErrorEntity", "ErrorResponse", + "ExecutionStatus", "ExtendedLocation", "Facebook", "ForwardProxy", @@ -329,15 +543,37 @@ "GithubActionConfiguration", "GlobalValidation", "Google", + "Header", + "HeaderMatch", + "HttpConnectionPool", + "HttpGet", + "HttpRetryPolicy", + "HttpRoute", + "HttpRouteAction", + "HttpRouteConfig", + "HttpRouteConfigCollection", + "HttpRouteConfigProperties", + "HttpRouteMatch", + "HttpRouteProvisioningErrors", + "HttpRouteRule", + "HttpRouteTarget", "HttpScaleRule", "HttpSettings", "HttpSettingsRoutes", "IdentityProviders", + "IdentitySettings", "Ingress", "IngressPortMapping", "IngressStickySessions", "InitContainer", "IpSecurityRestrictionRule", + "JavaComponent", + "JavaComponentConfigurationProperty", + "JavaComponentIngress", + "JavaComponentProperties", + "JavaComponentPropertiesScale", + "JavaComponentServiceBind", + "JavaComponentsCollection", "Job", "JobConfiguration", "JobConfigurationEventTriggerConfig", @@ -357,11 +593,20 @@ "JobsCollection", "JwtClaimChecks", "KedaConfiguration", + "LabelHistory", + "LabelHistoryCollection", + "LabelHistoryProperties", + "LabelHistoryRecordItem", "ListUsagesResult", "LogAnalyticsConfiguration", + "LoggerSetting", + "LogicApp", "Login", "LoginRoutes", "LoginScopes", + "LogsConfiguration", + "MaintenanceConfigurationCollection", + "MaintenanceConfigurationResource", "ManagedCertificate", "ManagedCertificateCollection", "ManagedCertificatePatch", @@ -374,15 +619,34 @@ "ManagedEnvironmentStorageProperties", "ManagedEnvironmentStoragesCollection", "ManagedEnvironmentsCollection", + "ManagedIdentitySetting", "ManagedServiceIdentity", + "MetricsConfiguration", "Mtls", + "NacosComponent", + "NfsAzureFileProperties", "Nonce", "OpenIdConnectClientCredential", "OpenIdConnectConfig", "OpenIdConnectLogin", "OpenIdConnectRegistration", + "OpenTelemetryConfiguration", "OperationDetail", "OperationDisplay", + "OtlpConfiguration", + "PatchCollection", + "PatchDetails", + "PatchDetailsNewLayer", + "PatchDetailsOldLayer", + "PatchProperties", + "PatchSkipConfig", + "PreBuildStep", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourceListResult", + "PrivateLinkServiceConnectionState", "ProxyResource", "QueueScaleRule", "RegistryCredentials", @@ -390,23 +654,50 @@ "Replica", "ReplicaCollection", "ReplicaContainer", + "ReplicaExecutionStatus", "Resource", "Revision", "RevisionCollection", + "Runtime", + "RuntimeDotnet", + "RuntimeJava", + "RuntimeJavaAgent", + "RuntimeJavaAgentLogging", "Scale", + "ScaleConfiguration", "ScaleRule", "ScaleRuleAuth", + "ScgRoute", + "ScheduledEntry", "Secret", "SecretVolumeItem", "SecretsCollection", "Service", "ServiceBind", + "SessionContainer", + "SessionContainerResources", + "SessionIngress", + "SessionNetworkConfiguration", + "SessionPool", + "SessionPoolCollection", + "SessionPoolSecret", + "SessionPoolUpdatableProperties", + "SessionRegistryCredentials", + "SmbStorage", "SourceControl", "SourceControlCollection", + "SpringBootAdminComponent", + "SpringCloudConfigComponent", + "SpringCloudEurekaComponent", + "SpringCloudGatewayComponent", "SystemData", + "TcpConnectionPool", + "TcpRetryPolicy", "TcpScaleRule", "Template", + "TimeoutPolicy", "TokenStore", + "TracesConfiguration", "TrackedResource", "TrafficWeight", "Twitter", @@ -417,6 +708,11 @@ "VnetConfiguration", "Volume", "VolumeMount", + "WorkflowArtifacts", + "WorkflowEnvelope", + "WorkflowEnvelopeCollection", + "WorkflowEnvelopeProperties", + "WorkflowHealth", "WorkloadProfile", "WorkloadProfileStates", "WorkloadProfileStatesCollection", @@ -428,34 +724,68 @@ "AppProtocol", "Applicability", "BindingType", + "BuildProvisioningState", + "BuildStatus", + "BuilderProvisioningState", "CertificateProvisioningState", + "CertificateType", "CheckNameAvailabilityReason", + "ConnectedEnvironmentDaprComponentProvisioningState", "ConnectedEnvironmentProvisioningState", + "ConnectedEnvironmentStorageProvisioningState", "ContainerAppContainerRunningState", "ContainerAppProvisioningState", "ContainerAppReplicaRunningState", + "ContainerAppRunningStatus", + "ContainerType", "CookieExpirationConvention", "CreatedByType", + "DetectionStatus", "DnsVerificationTestResult", + "DotNetComponentProvisioningState", + "DotNetComponentType", "EnvironmentProvisioningState", + "ExecutionType", "ExtendedLocationTypes", "ForwardProxyConvention", + "HttpRouteProvisioningState", + "IdentitySettingsLifeCycle", + "ImageType", "IngressClientCertificateMode", + "IngressTargetPortHttpScheme", "IngressTransportMethod", + "JavaComponentProvisioningState", + "JavaComponentType", "JobExecutionRunningState", "JobProvisioningState", + "JobRunningState", + "Kind", + "Level", "LogLevel", + "LogicAppsProxyMethod", "ManagedCertificateDomainControlValidation", "ManagedServiceIdentityType", + "PatchApplyStatus", + "PatchType", + "PatchingMode", + "PoolManagementType", + "PrivateEndpointConnectionProvisioningState", + "PrivateEndpointServiceConnectionStatus", + "PublicNetworkAccess", "RevisionHealthState", "RevisionProvisioningState", "RevisionRunningState", "Scheme", + "SessionNetworkStatus", + "SessionPoolProvisioningState", "SourceControlOperationState", "StorageType", "TriggerType", "Type", "UnauthenticatedClientActionV2", + "WeekDay", + "WorkflowHealthState", + "WorkflowState", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py index 694a6932ba5d..380d55bd8aa7 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 @@ -32,13 +32,15 @@ class ActiveRevisionsMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): .. raw:: html - Multiple: multiple revisions can be active.Single: Only one - revision can be active at a time. Revision weights can not be used in this mode. If no value if - provided, this is the default.. + Single: Only one revision can be active at a time. Traffic weights cannot be + used. This is the default.Multiple: Multiple revisions can be active, including + optional traffic weights and labels.Labels: Only revisions with labels are active. + Traffic weights can be applied to labels.. """ MULTIPLE = "Multiple" SINGLE = "Single" + LABELS = "Labels" class Affinity(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -69,6 +71,39 @@ class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): DISABLED = "Disabled" SNI_ENABLED = "SniEnabled" + AUTO = "Auto" + + +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): @@ -81,6 +116,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.""" @@ -88,6 +132,15 @@ class CheckNameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALREADY_EXISTS = "AlreadyExists" +class ConnectedEnvironmentDaprComponentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the Connected Environment Dapr Component.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + IN_PROGRESS = "InProgress" + + class ConnectedEnvironmentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the Kubernetes Environment.""" @@ -101,6 +154,15 @@ class ConnectedEnvironmentProvisioningState(str, Enum, metaclass=CaseInsensitive SCHEDULED_FOR_DELETE = "ScheduledForDelete" +class ConnectedEnvironmentStorageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the storage.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + IN_PROGRESS = "InProgress" + + class ContainerAppContainerRunningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Current running state of the container.""" @@ -127,6 +189,28 @@ class ContainerAppReplicaRunningState(str, Enum, metaclass=CaseInsensitiveEnumMe UNKNOWN = "Unknown" +class ContainerAppRunningStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Running status of the Container App.""" + + PROGRESSING = "Progressing" + """Container App is transitioning between Stopped and Running states.""" + RUNNING = "Running" + """Container App is in Running state.""" + STOPPED = "Stopped" + """Container App is in Stopped state.""" + SUSPENDED = "Suspended" + """Container App Job is in Suspended state.""" + READY = "Ready" + """Container App Job is in Ready state.""" + + +class ContainerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The container type of the sessions.""" + + CUSTOM_CONTAINER = "CustomContainer" + PYTHON_LTS = "PythonLTS" + + class CookieExpirationConvention(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The convention used when determining the session cookie's expiration.""" @@ -143,6 +227,14 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" +class DetectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the patch detection.""" + + SUCCEEDED = "Succeeded" + REGISTRY_LOGIN_FAILED = "RegistryLoginFailed" + FAILED = "Failed" + + class DnsVerificationTestResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): """DNS verification test result.""" @@ -151,6 +243,22 @@ class DnsVerificationTestResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): SKIPPED = "Skipped" +class DotNetComponentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the .NET Component.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + DELETING = "Deleting" + IN_PROGRESS = "InProgress" + + +class DotNetComponentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the .NET Component.""" + + ASPIRE_DASHBOARD = "AspireDashboard" + + class EnvironmentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the Environment.""" @@ -166,6 +274,12 @@ class EnvironmentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta) UPGRADE_FAILED = "UpgradeFailed" +class ExecutionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The execution type of the session pool.""" + + TIMED = "Timed" + + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of extendedLocation.""" @@ -180,6 +294,38 @@ class ForwardProxyConvention(str, Enum, metaclass=CaseInsensitiveEnumMeta): CUSTOM = "Custom" +class HttpRouteProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + WAITING = "Waiting" + UPDATING = "Updating" + DELETING = "Deleting" + PENDING = "Pending" + + +class IdentitySettingsLifeCycle(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Use to select the lifecycle stages of a Container App during which the Managed Identity should + be available. + """ + + INIT = "Init" + MAIN = "Main" + NONE = "None" + ALL = "All" + + +class ImageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the image. Set to CloudBuild to let the system manages the image, where user will + not be able to update image through image field. Set to ContainerImage for user provided image. + """ + + CLOUD_BUILD = "CloudBuild" + CONTAINER_IMAGE = "ContainerImage" + + class IngressClientCertificateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Client certificate mode for mTLS authentication. Ignore indicates server drops client certificate on forwarding. Accept indicates server forwards client certificate but does not @@ -191,6 +337,13 @@ class IngressClientCertificateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta) REQUIRE = "require" +class IngressTargetPortHttpScheme(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether an http app listens on http or https.""" + + HTTP = "http" + HTTPS = "https" + + class IngressTransportMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Ingress transport protocol.""" @@ -200,6 +353,26 @@ class IngressTransportMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): TCP = "tcp" +class JavaComponentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the Java Component.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + DELETING = "Deleting" + IN_PROGRESS = "InProgress" + + +class JavaComponentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the Java Component.""" + + SPRING_BOOT_ADMIN = "SpringBootAdmin" + SPRING_CLOUD_EUREKA = "SpringCloudEureka" + SPRING_CLOUD_CONFIG = "SpringCloudConfig" + SPRING_CLOUD_GATEWAY = "SpringCloudGateway" + NACOS = "Nacos" + + class JobExecutionRunningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Current running State of the job.""" @@ -222,6 +395,41 @@ class JobProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETING = "Deleting" +class JobRunningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Current running state of the job.""" + + READY = "Ready" + PROGRESSING = "Progressing" + SUSPENDED = "Suspended" + + +class Kind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Metadata used to render different experiences for resources of the same type; e.g. WorkflowApp + is a kind of Microsoft.App/ContainerApps type. If supported, the resource provider must + validate and persist this value. + """ + + WORKFLOWAPP = "workflowapp" + + +class Level(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The specified logger's log level.""" + + OFF = "off" + ERROR = "error" + INFO = "info" + DEBUG = "debug" + TRACE = "trace" + WARN = "warn" + + +class LogicAppsProxyMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """LogicAppsProxyMethod.""" + + GET = "GET" + POST = "POST" + + class LogLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Sets the log level for the Dapr sidecar. Allowed values are debug, info, warn, error. Default is info. @@ -252,6 +460,76 @@ class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" +class PatchApplyStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the patch once it has been provisioned.""" + + NOT_STARTED = "NotStarted" + REBASE_IN_PROGRESS = "RebaseInProgress" + CREATING_REVISION = "CreatingRevision" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + REBASE_FAILED = "RebaseFailed" + REVISION_CREATION_FAILED = "RevisionCreationFailed" + IMAGE_PUSH_PULL_FAILED = "ImagePushPullFailed" + MANUALLY_SKIPPED = "ManuallySkipped" + + +class PatchingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Patching mode for the container app. Null or default in this field will be interpreted as + Automatic by RP. Automatic mode will automatically apply available patches. Manual mode will + require the user to manually apply patches. Disabled mode will stop patch detection and auto + patching. + """ + + AUTOMATIC = "Automatic" + MANUAL = "Manual" + DISABLED = "Disabled" + + +class PatchType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type for the patch.""" + + FRAMEWORK_SECURITY = "FrameworkSecurity" + OS_SECURITY = "OSSecurity" + FRAMEWORK_AND_OS_SECURITY = "FrameworkAndOSSecurity" + OTHER = "Other" + + +class PoolManagementType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The pool management type of the session pool.""" + + MANUAL = "Manual" + DYNAMIC = "Dynamic" + + +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + WAITING = "Waiting" + UPDATING = "Updating" + DELETING = "Deleting" + PENDING = "Pending" + + +class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The private endpoint connection status.""" + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + + +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Property to allow or block all public traffic. Allowed Values: 'Enabled', 'Disabled'.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + class RevisionHealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Current health State of the revision.""" @@ -288,6 +566,23 @@ class Scheme(str, Enum, metaclass=CaseInsensitiveEnumMeta): HTTPS = "HTTPS" +class SessionNetworkStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Network status for the sessions.""" + + EGRESS_ENABLED = "EgressEnabled" + EGRESS_DISABLED = "EgressDisabled" + + +class SessionPoolProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the session pool.""" + + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + DELETING = "Deleting" + + class SourceControlOperationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Current provisioning State of the operation.""" @@ -303,6 +598,8 @@ class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE_FILE = "AzureFile" EMPTY_DIR = "EmptyDir" SECRET = "Secret" + NFS_AZURE_FILE = "NfsAzureFile" + SMB = "Smb" class TriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -328,3 +625,37 @@ class UnauthenticatedClientActionV2(str, Enum, metaclass=CaseInsensitiveEnumMeta ALLOW_ANONYMOUS = "AllowAnonymous" RETURN401 = "Return401" RETURN403 = "Return403" + + +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Day of the week when a managed environment can be patched.""" + + MONDAY = "Monday" + TUESDAY = "Tuesday" + WEDNESDAY = "Wednesday" + THURSDAY = "Thursday" + FRIDAY = "Friday" + SATURDAY = "Saturday" + SUNDAY = "Sunday" + EVERYDAY = "Everyday" + WEEKEND = "Weekend" + + +class WorkflowHealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the workflow health state.""" + + NOT_SPECIFIED = "NotSpecified" + HEALTHY = "Healthy" + UNHEALTHY = "Unhealthy" + UNKNOWN = "Unknown" + + +class WorkflowState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The workflow state.""" + + NOT_SPECIFIED = "NotSpecified" + COMPLETED = "Completed" + ENABLED = "Enabled" + DISABLED = "Disabled" + DELETED = "Deleted" + SUSPENDED = "Suspended" diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py index d062d9bdef6d..40fa23134425 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 @@ -74,6 +74,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. @@ -213,8 +233,8 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -255,8 +275,27 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :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 + """ + + +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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -266,8 +305,106 @@ class ProxyResource(Resource): :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 server. + + :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 @@ -275,8 +412,8 @@ class AuthConfig(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -469,8 +606,8 @@ class AvailableWorkloadProfile(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1023,6 +1160,10 @@ class BaseContainer(_serialization.Model): :ivar image: Container image tag. :vartype image: str + :ivar image_type: The type of the image. Set to CloudBuild to let the system manages the image, + where user will not be able to update image through image field. Set to ContainerImage for user + provided image. Known values are: "CloudBuild" and "ContainerImage". + :vartype image_type: str or ~azure.mgmt.appcontainers.models.ImageType :ivar name: Custom container name. :vartype name: str :ivar command: Container start command. @@ -1039,6 +1180,7 @@ class BaseContainer(_serialization.Model): _attribute_map = { "image": {"key": "image", "type": "str"}, + "image_type": {"key": "imageType", "type": "str"}, "name": {"key": "name", "type": "str"}, "command": {"key": "command", "type": "[str]"}, "args": {"key": "args", "type": "[str]"}, @@ -1051,6 +1193,7 @@ def __init__( self, *, image: Optional[str] = None, + image_type: Optional[Union[str, "_models.ImageType"]] = None, name: Optional[str] = None, command: Optional[List[str]] = None, args: Optional[List[str]] = None, @@ -1062,6 +1205,10 @@ def __init__( """ :keyword image: Container image tag. :paramtype image: str + :keyword image_type: The type of the image. Set to CloudBuild to let the system manages the + image, where user will not be able to update image through image field. Set to ContainerImage + for user provided image. Known values are: "CloudBuild" and "ContainerImage". + :paramtype image_type: str or ~azure.mgmt.appcontainers.models.ImageType :keyword name: Custom container name. :paramtype name: str :keyword command: Container start command. @@ -1077,6 +1224,7 @@ def __init__( """ super().__init__(**kwargs) self.image = image + self.image_type = image_type self.name = name self.command = command self.args = args @@ -1085,7 +1233,7 @@ def __init__( self.volume_mounts = volume_mounts -class BillingMeter(ProxyResource): +class BillingMeter(_serialization.Model): """Billing meter. Variables are only populated by the server, and will be ignored when sending a request. @@ -1137,6 +1285,10 @@ def __init__( :paramtype properties: ~azure.mgmt.appcontainers.models.BillingMeterProperties """ super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None self.location = location self.properties = properties @@ -1209,29 +1361,176 @@ def __init__( 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 server. - :ivar sas_url_setting_name: The name of the app secrets containing the SAS URL of the blob - storage containing the tokens. Required. + storage containing the tokens. Should not be used along with blobContainerUri. :vartype sas_url_setting_name: str + :ivar blob_container_uri: The URI of the blob storage containing the tokens. Should not be used + along with sasUrlSettingName. + :vartype blob_container_uri: str + :ivar client_id: The Client ID of a User-Assigned Managed Identity. Should not be used along + with managedIdentityResourceId. + :vartype client_id: str + :ivar managed_identity_resource_id: The Resource ID of a User-Assigned Managed Identity. Should + not be used along with clientId. + :vartype managed_identity_resource_id: str """ - _validation = { - "sas_url_setting_name": {"required": True}, - } - _attribute_map = { "sas_url_setting_name": {"key": "sasUrlSettingName", "type": "str"}, + "blob_container_uri": {"key": "blobContainerUri", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "managed_identity_resource_id": {"key": "managedIdentityResourceId", "type": "str"}, } - def __init__(self, *, sas_url_setting_name: str, **kwargs: Any) -> None: + def __init__( + self, + *, + sas_url_setting_name: Optional[str] = None, + blob_container_uri: Optional[str] = None, + client_id: Optional[str] = None, + managed_identity_resource_id: Optional[str] = None, + **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. + storage containing the tokens. Should not be used along with blobContainerUri. :paramtype sas_url_setting_name: str + :keyword blob_container_uri: The URI of the blob storage containing the tokens. Should not be + used along with sasUrlSettingName. + :paramtype blob_container_uri: str + :keyword client_id: The Client ID of a User-Assigned Managed Identity. Should not be used along + with managedIdentityResourceId. + :paramtype client_id: str + :keyword managed_identity_resource_id: The Resource ID of a User-Assigned Managed Identity. + Should not be used along with clientId. + :paramtype managed_identity_resource_id: str """ super().__init__(**kwargs) self.sas_url_setting_name = sas_url_setting_name + self.blob_container_uri = blob_container_uri + self.client_id = client_id + self.managed_identity_resource_id = managed_identity_resource_id + + +class BuildCollection(_serialization.Model): + """The response of a BuildResource list operation. + + All required parameters must be populated in order to send to server. + + :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, secrets + should not be used in environment variable. + :vartype environment_variables: list[~azure.mgmt.appcontainers.models.EnvironmentVariable] + :ivar pre_build_steps: List of steps to perform before the build. + :vartype pre_build_steps: list[~azure.mgmt.appcontainers.models.PreBuildStep] + """ + + _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, + secrets should not be used in environment variable. + :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 server. + + :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): @@ -1242,8 +1541,8 @@ class TrackedResource(Resource): All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1288,15 +1587,15 @@ 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. All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1310,8 +1609,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 = { @@ -1320,6 +1628,7 @@ class Certificate(TrackedResource): "type": {"readonly": True}, "system_data": {"readonly": True}, "location": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -1329,7 +1638,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__( @@ -1337,7 +1649,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: """ @@ -1345,77 +1659,343 @@ 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 server. - - :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 id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar provisioning_state: Build provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.BuildProvisioningState + :ivar build_status: Status of the build once it has been provisioned. Known values are: + "NotStarted", "InProgress", "Succeeded", "Canceled", and "Failed". + :vartype build_status: str or ~azure.mgmt.appcontainers.models.BuildStatus + :ivar destination_container_registry: Container registry that the final image will be uploaded + to. + :vartype destination_container_registry: + ~azure.mgmt.appcontainers.models.ContainerRegistryWithCustomImage + :ivar configuration: Configuration of the build. + :vartype configuration: ~azure.mgmt.appcontainers.models.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 server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :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 server. + + :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 CertificateKeyVaultProperties(_serialization.Model): + """Properties for a certificate stored in a Key Vault. + + :ivar identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or + System to use a system-assigned identity. + :vartype identity: str + :ivar key_vault_url: URL pointing to the Azure Key Vault secret that holds the certificate. + :vartype key_vault_url: str + """ + + _attribute_map = { + "identity": {"key": "identity", "type": "str"}, + "key_vault_url": {"key": "keyVaultUrl", "type": "str"}, + } + + def __init__(self, *, identity: Optional[str] = None, key_vault_url: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or + System to use a system-assigned identity. + :paramtype identity: str + :keyword key_vault_url: URL pointing to the Azure Key Vault secret that holds the certificate. + :paramtype key_vault_url: str + """ + super().__init__(**kwargs) + self.identity = identity + self.key_vault_url = key_vault_url + + +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 deployment_errors: Any errors that occurred during deployment or deployment validation. + :vartype deployment_errors: str + :ivar certificate_key_vault_properties: Properties for a certificate stored in a Key Vault. + :vartype certificate_key_vault_properties: + ~azure.mgmt.appcontainers.models.CertificateKeyVaultProperties + :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. @@ -1434,10 +2014,15 @@ class CertificateProperties(_serialization.Model): # pylint: disable=too-many-i :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 = { "provisioning_state": {"readonly": True}, + "deployment_errors": {"readonly": True}, "subject_name": {"readonly": True}, "subject_alternative_names": {"readonly": True}, "issuer": {"readonly": True}, @@ -1450,6 +2035,11 @@ class CertificateProperties(_serialization.Model): # pylint: disable=too-many-i _attribute_map = { "provisioning_state": {"key": "provisioningState", "type": "str"}, + "deployment_errors": {"key": "deploymentErrors", "type": "str"}, + "certificate_key_vault_properties": { + "key": "certificateKeyVaultProperties", + "type": "CertificateKeyVaultProperties", + }, "password": {"key": "password", "type": "str"}, "subject_name": {"key": "subjectName", "type": "str"}, "subject_alternative_names": {"key": "subjectAlternativeNames", "type": "[str]"}, @@ -1460,17 +2050,35 @@ 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, + *, + certificate_key_vault_properties: Optional["_models.CertificateKeyVaultProperties"] = None, + password: Optional[str] = None, + value: Optional[bytes] = None, + certificate_type: Optional[Union[str, "_models.CertificateType"]] = None, + **kwargs: Any + ) -> None: """ + :keyword certificate_key_vault_properties: Properties for a certificate stored in a Key Vault. + :paramtype certificate_key_vault_properties: + ~azure.mgmt.appcontainers.models.CertificateKeyVaultProperties :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 + self.deployment_errors = None + self.certificate_key_vault_properties = certificate_key_vault_properties self.password = password self.subject_name = None self.subject_alternative_names = None @@ -1481,6 +2089,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): @@ -1550,6 +2159,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. @@ -1579,7 +2233,7 @@ def __init__( self.client_secret_setting_name = client_secret_setting_name -class Configuration(_serialization.Model): +class Configuration(_serialization.Model): # pylint: disable=too-many-instance-attributes """Non versioned Container App configuration properties that define the mutable settings of a Container app. @@ -1591,10 +2245,15 @@ class Configuration(_serialization.Model): .. raw:: html - Multiple: multiple revisions can be active.Single: Only one - revision can be active at a time. Revision weights can not be used in this mode. If no value if - provided, this is the default.. Known values are: "Multiple" and "Single". + Single: Only one revision can be active at a time. Traffic weights cannot be + used. This is the default.Multiple: Multiple revisions can be active, including + optional traffic weights and labels.Labels: Only revisions with labels are active. + Traffic weights can be applied to labels.. Known values are: "Multiple", + "Single", and "Labels". :vartype active_revisions_mode: str or ~azure.mgmt.appcontainers.models.ActiveRevisionsMode + :ivar target_label: Required in labels revisions mode. Label to apply to newly created + revision. + :vartype target_label: str :ivar ingress: Ingress configurations. :vartype ingress: ~azure.mgmt.appcontainers.models.Ingress :ivar registries: Collection of private container registry credentials for containers used by @@ -1602,20 +2261,37 @@ class Configuration(_serialization.Model): :vartype registries: list[~azure.mgmt.appcontainers.models.RegistryCredentials] :ivar dapr: Dapr configuration for the Container App. :vartype dapr: ~azure.mgmt.appcontainers.models.Dapr + :ivar runtime: App runtime configuration for the Container App. + :vartype runtime: ~azure.mgmt.appcontainers.models.Runtime :ivar max_inactive_revisions: Optional. Max inactive revisions a Container App can have. :vartype max_inactive_revisions: int + :ivar revision_transition_threshold: Optional. The percent of the total number of replicas that + must be brought up before revision transition occurs. Defaults to 100 when none is given. Value + must be greater than 0 and less than or equal to 100. + :vartype revision_transition_threshold: int :ivar service: Container App to be a dev Container App Service. :vartype service: ~azure.mgmt.appcontainers.models.Service + :ivar identity_settings: Optional settings for Managed Identities that are assigned to the + Container App. If a Managed Identity is not specified here, default settings will be used. + :vartype identity_settings: list[~azure.mgmt.appcontainers.models.IdentitySettings] """ + _validation = { + "revision_transition_threshold": {"maximum": 100, "minimum": 1}, + } + _attribute_map = { "secrets": {"key": "secrets", "type": "[Secret]"}, "active_revisions_mode": {"key": "activeRevisionsMode", "type": "str"}, + "target_label": {"key": "targetLabel", "type": "str"}, "ingress": {"key": "ingress", "type": "Ingress"}, "registries": {"key": "registries", "type": "[RegistryCredentials]"}, "dapr": {"key": "dapr", "type": "Dapr"}, + "runtime": {"key": "runtime", "type": "Runtime"}, "max_inactive_revisions": {"key": "maxInactiveRevisions", "type": "int"}, + "revision_transition_threshold": {"key": "revisionTransitionThreshold", "type": "int"}, "service": {"key": "service", "type": "Service"}, + "identity_settings": {"key": "identitySettings", "type": "[IdentitySettings]"}, } def __init__( @@ -1623,11 +2299,15 @@ def __init__( *, secrets: Optional[List["_models.Secret"]] = None, active_revisions_mode: Union[str, "_models.ActiveRevisionsMode"] = "Single", + target_label: Optional[str] = None, ingress: Optional["_models.Ingress"] = None, registries: Optional[List["_models.RegistryCredentials"]] = None, dapr: Optional["_models.Dapr"] = None, + runtime: Optional["_models.Runtime"] = None, max_inactive_revisions: Optional[int] = None, + revision_transition_threshold: Optional[int] = None, service: Optional["_models.Service"] = None, + identity_settings: Optional[List["_models.IdentitySettings"]] = None, **kwargs: Any ) -> None: """ @@ -1639,10 +2319,15 @@ def __init__( .. raw:: html - Multiple: multiple revisions can be active.Single: Only one - revision can be active at a time. Revision weights can not be used in this mode. If no value if - provided, this is the default.. Known values are: "Multiple" and "Single". + Single: Only one revision can be active at a time. Traffic weights cannot be + used. This is the default.Multiple: Multiple revisions can be active, including + optional traffic weights and labels.Labels: Only revisions with labels are active. + Traffic weights can be applied to labels.. Known values are: "Multiple", + "Single", and "Labels". :paramtype active_revisions_mode: str or ~azure.mgmt.appcontainers.models.ActiveRevisionsMode + :keyword target_label: Required in labels revisions mode. Label to apply to newly created + revision. + :paramtype target_label: str :keyword ingress: Ingress configurations. :paramtype ingress: ~azure.mgmt.appcontainers.models.Ingress :keyword registries: Collection of private container registry credentials for containers used @@ -1650,19 +2335,32 @@ def __init__( :paramtype registries: list[~azure.mgmt.appcontainers.models.RegistryCredentials] :keyword dapr: Dapr configuration for the Container App. :paramtype dapr: ~azure.mgmt.appcontainers.models.Dapr + :keyword runtime: App runtime configuration for the Container App. + :paramtype runtime: ~azure.mgmt.appcontainers.models.Runtime :keyword max_inactive_revisions: Optional. Max inactive revisions a Container App can have. :paramtype max_inactive_revisions: int + :keyword revision_transition_threshold: Optional. The percent of the total number of replicas + that must be brought up before revision transition occurs. Defaults to 100 when none is given. + Value must be greater than 0 and less than or equal to 100. + :paramtype revision_transition_threshold: int :keyword service: Container App to be a dev Container App Service. :paramtype service: ~azure.mgmt.appcontainers.models.Service + :keyword identity_settings: Optional settings for Managed Identities that are assigned to the + Container App. If a Managed Identity is not specified here, default settings will be used. + :paramtype identity_settings: list[~azure.mgmt.appcontainers.models.IdentitySettings] """ super().__init__(**kwargs) self.secrets = secrets self.active_revisions_mode = active_revisions_mode + self.target_label = target_label self.ingress = ingress self.registries = registries self.dapr = dapr + self.runtime = runtime self.max_inactive_revisions = max_inactive_revisions + self.revision_transition_threshold = revision_transition_threshold self.service = service + self.identity_settings = identity_settings class ConnectedEnvironment(TrackedResource): # pylint: disable=too-many-instance-attributes @@ -1672,8 +2370,8 @@ class ConnectedEnvironment(TrackedResource): # pylint: disable=too-many-instanc All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1805,13 +2503,13 @@ def __init__(self, *, value: Optional[List["_models.ConnectedEnvironment"]] = No self.next_link = None -class ConnectedEnvironmentStorage(ProxyResource): - """Storage resource for connectedEnvironment. +class ConnectedEnvironmentDaprComponent(ProxyResource): + """Dapr Component. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1821,8 +2519,9 @@ class ConnectedEnvironmentStorage(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar properties: Storage properties. - :vartype properties: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorageProperties + :ivar properties: Dapr component properties. + :vartype properties: + ~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponentProperties """ _validation = { @@ -1837,7 +2536,278 @@ class ConnectedEnvironmentStorage(ProxyResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "ConnectedEnvironmentStorageProperties"}, + "properties": {"key": "properties", "type": "ConnectedEnvironmentDaprComponentProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.ConnectedEnvironmentDaprComponentProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Dapr component properties. + :paramtype properties: + ~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponentProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class DaprComponentProperties(_serialization.Model): + """Dapr Component resource specific properties. + + :ivar component_type: Component type. + :vartype component_type: str + :ivar version: Component version. + :vartype version: str + :ivar ignore_errors: Boolean describing if the component errors are ignores. + :vartype ignore_errors: bool + :ivar init_timeout: Initialization timeout. + :vartype init_timeout: str + :ivar secrets: Collection of secrets used by a Dapr component. + :vartype secrets: list[~azure.mgmt.appcontainers.models.Secret] + :ivar secret_store_component: Name of a Dapr component to retrieve component secrets from. + :vartype secret_store_component: str + :ivar metadata: Component metadata. + :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] + """ + + _attribute_map = { + "component_type": {"key": "componentType", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "ignore_errors": {"key": "ignoreErrors", "type": "bool"}, + "init_timeout": {"key": "initTimeout", "type": "str"}, + "secrets": {"key": "secrets", "type": "[Secret]"}, + "secret_store_component": {"key": "secretStoreComponent", "type": "str"}, + "metadata": {"key": "metadata", "type": "[DaprMetadata]"}, + "scopes": {"key": "scopes", "type": "[str]"}, + "service_component_bind": {"key": "serviceComponentBind", "type": "[DaprComponentServiceBinding]"}, + } + + def __init__( + self, + *, + component_type: Optional[str] = None, + version: Optional[str] = None, + ignore_errors: bool = False, + init_timeout: Optional[str] = None, + secrets: Optional[List["_models.Secret"]] = None, + 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: + """ + :keyword component_type: Component type. + :paramtype component_type: str + :keyword version: Component version. + :paramtype version: str + :keyword ignore_errors: Boolean describing if the component errors are ignores. + :paramtype ignore_errors: bool + :keyword init_timeout: Initialization timeout. + :paramtype init_timeout: str + :keyword secrets: Collection of secrets used by a Dapr component. + :paramtype secrets: list[~azure.mgmt.appcontainers.models.Secret] + :keyword secret_store_component: Name of a Dapr component to retrieve component secrets from. + :paramtype secret_store_component: str + :keyword metadata: Component metadata. + :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 ConnectedEnvironmentDaprComponentProperties( + DaprComponentProperties +): # pylint: disable=too-many-instance-attributes,name-too-long + """Dapr component properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar component_type: Component type. + :vartype component_type: str + :ivar version: Component version. + :vartype version: str + :ivar ignore_errors: Boolean describing if the component errors are ignores. + :vartype ignore_errors: bool + :ivar init_timeout: Initialization timeout. + :vartype init_timeout: str + :ivar secrets: Collection of secrets used by a Dapr component. + :vartype secrets: list[~azure.mgmt.appcontainers.models.Secret] + :ivar secret_store_component: Name of a Dapr component to retrieve component secrets from. + :vartype secret_store_component: str + :ivar metadata: Component metadata. + :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] + :ivar provisioning_state: Provisioning state of the Connected Environment Dapr Component. Known + values are: "Succeeded", "Failed", "Canceled", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponentProvisioningState + :ivar deployment_errors: Any errors that occurred during deployment or deployment validation. + :vartype deployment_errors: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "deployment_errors": {"readonly": True}, + } + + _attribute_map = { + "component_type": {"key": "componentType", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "ignore_errors": {"key": "ignoreErrors", "type": "bool"}, + "init_timeout": {"key": "initTimeout", "type": "str"}, + "secrets": {"key": "secrets", "type": "[Secret]"}, + "secret_store_component": {"key": "secretStoreComponent", "type": "str"}, + "metadata": {"key": "metadata", "type": "[DaprMetadata]"}, + "scopes": {"key": "scopes", "type": "[str]"}, + "service_component_bind": {"key": "serviceComponentBind", "type": "[DaprComponentServiceBinding]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "deployment_errors": {"key": "deploymentErrors", "type": "str"}, + } + + def __init__( + self, + *, + component_type: Optional[str] = None, + version: Optional[str] = None, + ignore_errors: bool = False, + init_timeout: Optional[str] = None, + secrets: Optional[List["_models.Secret"]] = None, + 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: + """ + :keyword component_type: Component type. + :paramtype component_type: str + :keyword version: Component version. + :paramtype version: str + :keyword ignore_errors: Boolean describing if the component errors are ignores. + :paramtype ignore_errors: bool + :keyword init_timeout: Initialization timeout. + :paramtype init_timeout: str + :keyword secrets: Collection of secrets used by a Dapr component. + :paramtype secrets: list[~azure.mgmt.appcontainers.models.Secret] + :keyword secret_store_component: Name of a Dapr component to retrieve component secrets from. + :paramtype secret_store_component: str + :keyword metadata: Component metadata. + :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__( + component_type=component_type, + version=version, + ignore_errors=ignore_errors, + init_timeout=init_timeout, + secrets=secrets, + secret_store_component=secret_store_component, + metadata=metadata, + scopes=scopes, + service_component_bind=service_component_bind, + **kwargs + ) + self.provisioning_state = None + self.deployment_errors = None + + +class ConnectedEnvironmentDaprComponentsCollection(_serialization.Model): # pylint: disable=name-too-long + """Collection of Dapr Components for Environments. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of Dapr component resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent] + :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": "[ConnectedEnvironmentDaprComponent]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.ConnectedEnvironmentDaprComponent"], **kwargs: Any) -> None: + """ + :keyword value: Collection of Dapr component resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ConnectedEnvironmentStorage(ProxyResource): + """Storage resource for connectedEnvironment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar properties: Storage properties. + :vartype properties: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorageProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "ConnectedEnvironmentStorageProperties"}, } def __init__( @@ -1854,21 +2824,50 @@ def __init__( class ConnectedEnvironmentStorageProperties(_serialization.Model): """Storage properties. + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the storage. Known values are: "Succeeded", + "Failed", "Canceled", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorageProvisioningState + :ivar deployment_errors: Any errors that occurred during deployment or deployment validation. + :vartype deployment_errors: str :ivar azure_file: Azure file properties. :vartype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + :ivar smb: SMB storage properties. + :vartype smb: ~azure.mgmt.appcontainers.models.SmbStorage """ + _validation = { + "provisioning_state": {"readonly": True}, + "deployment_errors": {"readonly": True}, + } + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "deployment_errors": {"key": "deploymentErrors", "type": "str"}, "azure_file": {"key": "azureFile", "type": "AzureFileProperties"}, + "smb": {"key": "smb", "type": "SmbStorage"}, } - def __init__(self, *, azure_file: Optional["_models.AzureFileProperties"] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + azure_file: Optional["_models.AzureFileProperties"] = None, + smb: Optional["_models.SmbStorage"] = None, + **kwargs: Any + ) -> None: """ :keyword azure_file: Azure file properties. :paramtype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + :keyword smb: SMB storage properties. + :paramtype smb: ~azure.mgmt.appcontainers.models.SmbStorage """ super().__init__(**kwargs) + self.provisioning_state = None + self.deployment_errors = None self.azure_file = azure_file + self.smb = smb class ConnectedEnvironmentStoragesCollection(_serialization.Model): @@ -1902,6 +2901,10 @@ class Container(BaseContainer): :ivar image: Container image tag. :vartype image: str + :ivar image_type: The type of the image. Set to CloudBuild to let the system manages the image, + where user will not be able to update image through image field. Set to ContainerImage for user + provided image. Known values are: "CloudBuild" and "ContainerImage". + :vartype image_type: str or ~azure.mgmt.appcontainers.models.ImageType :ivar name: Custom container name. :vartype name: str :ivar command: Container start command. @@ -1920,6 +2923,7 @@ class Container(BaseContainer): _attribute_map = { "image": {"key": "image", "type": "str"}, + "image_type": {"key": "imageType", "type": "str"}, "name": {"key": "name", "type": "str"}, "command": {"key": "command", "type": "[str]"}, "args": {"key": "args", "type": "[str]"}, @@ -1933,6 +2937,7 @@ def __init__( self, *, image: Optional[str] = None, + image_type: Optional[Union[str, "_models.ImageType"]] = None, name: Optional[str] = None, command: Optional[List[str]] = None, args: Optional[List[str]] = None, @@ -1945,6 +2950,10 @@ def __init__( """ :keyword image: Container image tag. :paramtype image: str + :keyword image_type: The type of the image. Set to CloudBuild to let the system manages the + image, where user will not be able to update image through image field. Set to ContainerImage + for user provided image. Known values are: "CloudBuild" and "ContainerImage". + :paramtype image_type: str or ~azure.mgmt.appcontainers.models.ImageType :keyword name: Custom container name. :paramtype name: str :keyword command: Container start command. @@ -1962,6 +2971,7 @@ def __init__( """ super().__init__( image=image, + image_type=image_type, name=name, command=command, args=args, @@ -1980,8 +2990,8 @@ class ContainerApp(TrackedResource): # pylint: disable=too-many-instance-attrib All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2005,16 +3015,28 @@ class ContainerApp(TrackedResource): # pylint: disable=too-many-instance-attrib mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. :vartype managed_by: str + :ivar kind: Metadata used to render different experiences for resources of the same type; e.g. + WorkflowApp is a kind of Microsoft.App/ContainerApps type. If supported, the resource provider + must validate and persist this value. "workflowapp" + :vartype kind: str or ~azure.mgmt.appcontainers.models.Kind :ivar provisioning_state: Provisioning state of the Container App. Known values are: "InProgress", "Succeeded", "Failed", "Canceled", and "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.ContainerAppProvisioningState + :ivar running_status: Running status of the Container App. Known values are: "Progressing", + "Running", "Stopped", "Suspended", and "Ready". + :vartype running_status: str or ~azure.mgmt.appcontainers.models.ContainerAppRunningStatus + :ivar deployment_errors: Any errors that occurred during deployment. + :vartype deployment_errors: str :ivar managed_environment_id: Deprecated. Resource ID of the Container App's environment. :vartype managed_environment_id: str :ivar environment_id: Resource ID of environment. :vartype environment_id: str :ivar workload_profile_name: Workload profile name to pin for container app execution. :vartype workload_profile_name: str + :ivar patching_configuration: Container App auto patch configuration. + :vartype patching_configuration: + ~azure.mgmt.appcontainers.models.ContainerAppPropertiesPatchingConfiguration :ivar latest_revision_name: Name of the latest revision of the Container App. :vartype latest_revision_name: str :ivar latest_ready_revision_name: Name of the latest ready revision of the Container App. @@ -2041,6 +3063,8 @@ class ContainerApp(TrackedResource): # pylint: disable=too-many-instance-attrib "system_data": {"readonly": True}, "location": {"required": True}, "provisioning_state": {"readonly": True}, + "running_status": {"readonly": True}, + "deployment_errors": {"readonly": True}, "latest_revision_name": {"readonly": True}, "latest_ready_revision_name": {"readonly": True}, "latest_revision_fqdn": {"readonly": True}, @@ -2059,10 +3083,17 @@ class ContainerApp(TrackedResource): # pylint: disable=too-many-instance-attrib "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "managed_by": {"key": "managedBy", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "running_status": {"key": "properties.runningStatus", "type": "str"}, + "deployment_errors": {"key": "properties.deploymentErrors", "type": "str"}, "managed_environment_id": {"key": "properties.managedEnvironmentId", "type": "str"}, "environment_id": {"key": "properties.environmentId", "type": "str"}, "workload_profile_name": {"key": "properties.workloadProfileName", "type": "str"}, + "patching_configuration": { + "key": "properties.patchingConfiguration", + "type": "ContainerAppPropertiesPatchingConfiguration", + }, "latest_revision_name": {"key": "properties.latestRevisionName", "type": "str"}, "latest_ready_revision_name": {"key": "properties.latestReadyRevisionName", "type": "str"}, "latest_revision_fqdn": {"key": "properties.latestRevisionFqdn", "type": "str"}, @@ -2073,7 +3104,7 @@ class ContainerApp(TrackedResource): # pylint: disable=too-many-instance-attrib "event_stream_endpoint": {"key": "properties.eventStreamEndpoint", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2081,9 +3112,11 @@ def __init__( extended_location: Optional["_models.ExtendedLocation"] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, managed_by: Optional[str] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, managed_environment_id: Optional[str] = None, environment_id: Optional[str] = None, workload_profile_name: Optional[str] = None, + patching_configuration: Optional["_models.ContainerAppPropertiesPatchingConfiguration"] = None, configuration: Optional["_models.Configuration"] = None, template: Optional["_models.Template"] = None, **kwargs: Any @@ -2103,12 +3136,19 @@ def __init__( complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. :paramtype managed_by: str + :keyword kind: Metadata used to render different experiences for resources of the same type; + e.g. WorkflowApp is a kind of Microsoft.App/ContainerApps type. If supported, the resource + provider must validate and persist this value. "workflowapp" + :paramtype kind: str or ~azure.mgmt.appcontainers.models.Kind :keyword managed_environment_id: Deprecated. Resource ID of the Container App's environment. :paramtype managed_environment_id: str :keyword environment_id: Resource ID of environment. :paramtype environment_id: str :keyword workload_profile_name: Workload profile name to pin for container app execution. :paramtype workload_profile_name: str + :keyword patching_configuration: Container App auto patch configuration. + :paramtype patching_configuration: + ~azure.mgmt.appcontainers.models.ContainerAppPropertiesPatchingConfiguration :keyword configuration: Non versioned Container App configuration properties. :paramtype configuration: ~azure.mgmt.appcontainers.models.Configuration :keyword template: Container App versioned application definition. @@ -2118,10 +3158,14 @@ def __init__( self.extended_location = extended_location self.identity = identity self.managed_by = managed_by + self.kind = kind self.provisioning_state = None + self.running_status = None + self.deployment_errors = None self.managed_environment_id = managed_environment_id self.environment_id = environment_id self.workload_profile_name = workload_profile_name + self.patching_configuration = patching_configuration self.latest_revision_name = None self.latest_ready_revision_name = None self.latest_revision_fqdn = None @@ -2139,8 +3183,8 @@ class ContainerAppAuthToken(TrackedResource): All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2505,27 +3549,200 @@ def __init__(self, *, port: int, host: Optional[str] = None, **kwargs: Any) -> N self.port = port -class ContainerAppSecret(_serialization.Model): - """Container App Secret. - - Variables are only populated by the server, and will be ignored when sending a request. +class ContainerAppPropertiesPatchingConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Container App auto patch configuration. - :ivar name: Secret Name. - :vartype name: str - :ivar value: Secret Value. - :vartype value: str - :ivar identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or - System to use a system-assigned identity. - :vartype identity: str - :ivar key_vault_url: Azure Key Vault URL pointing to the secret referenced by the container - app. - :vartype key_vault_url: str + :ivar patching_mode: Patching mode for the container app. Null or default in this field will be + interpreted as Automatic by RP. Automatic mode will automatically apply available patches. + Manual mode will require the user to manually apply patches. Disabled mode will stop patch + detection and auto patching. Known values are: "Automatic", "Manual", and "Disabled". + :vartype patching_mode: str or ~azure.mgmt.appcontainers.models.PatchingMode """ - _validation = { - "name": {"readonly": True}, - "value": {"readonly": True}, - "identity": {"readonly": True}, + _attribute_map = { + "patching_mode": {"key": "patchingMode", "type": "str"}, + } + + def __init__(self, *, patching_mode: Optional[Union[str, "_models.PatchingMode"]] = None, **kwargs: Any) -> None: + """ + :keyword patching_mode: Patching mode for the container app. Null or default in this field will + be interpreted as Automatic by RP. Automatic mode will automatically apply available patches. + Manual mode will require the user to manually apply patches. Disabled mode will stop patch + detection and auto patching. Known values are: "Automatic", "Manual", and "Disabled". + :paramtype patching_mode: str or ~azure.mgmt.appcontainers.models.PatchingMode + """ + super().__init__(**kwargs) + self.patching_mode = patching_mode + + +class ContainerAppsBuildCollection(_serialization.Model): + """The response of a Container Apps Build Resource list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The Container Apps Build Resource items on this page. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ContainerAppsBuildResource] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ContainerAppsBuildResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.ContainerAppsBuildResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The Container Apps Build Resource items on this page. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ContainerAppsBuildResource] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ContainerAppsBuildConfiguration(_serialization.Model): + """Configuration of the build. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar base_os: Base OS used to build and run the app. + :vartype base_os: str + :ivar platform: Platform to be used to build and run the app. + :vartype platform: str + :ivar platform_version: Platform version to be used to build and run the app. + :vartype platform_version: str + :ivar environment_variables: List of environment variables to be passed to the build, secrets + should not be used in environment variable. + :vartype environment_variables: list[~azure.mgmt.appcontainers.models.EnvironmentVariable] + :ivar pre_build_steps: List of steps to perform before the build. + :vartype pre_build_steps: list[~azure.mgmt.appcontainers.models.PreBuildStep] + """ + + _validation = { + "base_os": {"readonly": True}, + "platform": {"readonly": True}, + "platform_version": {"readonly": True}, + "environment_variables": {"readonly": True}, + "pre_build_steps": {"readonly": True}, + } + + _attribute_map = { + "base_os": {"key": "baseOs", "type": "str"}, + "platform": {"key": "platform", "type": "str"}, + "platform_version": {"key": "platformVersion", "type": "str"}, + "environment_variables": {"key": "environmentVariables", "type": "[EnvironmentVariable]"}, + "pre_build_steps": {"key": "preBuildSteps", "type": "[PreBuildStep]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.base_os = None + self.platform = None + self.platform_version = None + self.environment_variables = None + self.pre_build_steps = None + + +class ContainerAppsBuildResource(ProxyResource): + """Information pertaining to an individual build. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar provisioning_state: Build provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.BuildProvisioningState + :ivar build_status: Status of the build once it has been provisioned. Known values are: + "NotStarted", "InProgress", "Succeeded", "Canceled", and "Failed". + :vartype build_status: str or ~azure.mgmt.appcontainers.models.BuildStatus + :ivar destination_container_registry: Container registry that the final image will be uploaded + to. + :vartype destination_container_registry: + ~azure.mgmt.appcontainers.models.ContainerRegistryWithCustomImage + :ivar configuration: Configuration of the build. + :vartype configuration: ~azure.mgmt.appcontainers.models.ContainerAppsBuildConfiguration + :ivar log_stream_endpoint: Endpoint from which the build logs can be streamed. + :vartype log_stream_endpoint: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "build_status": {"readonly": True}, + "destination_container_registry": {"readonly": True}, + "configuration": {"readonly": True}, + "log_stream_endpoint": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "build_status": {"key": "properties.buildStatus", "type": "str"}, + "destination_container_registry": { + "key": "properties.destinationContainerRegistry", + "type": "ContainerRegistryWithCustomImage", + }, + "configuration": {"key": "properties.configuration", "type": "ContainerAppsBuildConfiguration"}, + "log_stream_endpoint": {"key": "properties.logStreamEndpoint", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provisioning_state = None + self.build_status = None + self.destination_container_registry = None + self.configuration = None + self.log_stream_endpoint = None + + +class ContainerAppSecret(_serialization.Model): + """Container App Secret. + + 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 + :ivar identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or + System to use a system-assigned identity. + :vartype identity: str + :ivar key_vault_url: Azure Key Vault URL pointing to the secret referenced by the container + app. + :vartype key_vault_url: str + """ + + _validation = { + "name": {"readonly": True}, + "value": {"readonly": True}, + "identity": {"readonly": True}, "key_vault_url": {"readonly": True}, } @@ -2545,6 +3762,165 @@ def __init__(self, **kwargs: Any) -> None: self.key_vault_url = None +class ContainerAppsPatchResource(ProxyResource): + """Container App Patch. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar properties: Properties that describes current states of the patch resource. + :vartype properties: ~azure.mgmt.appcontainers.models.PatchProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "PatchProperties"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.properties = None + + +class ContainerExecutionStatus(_serialization.Model): + """Container Apps Job execution container status. Contains status code and reason. + + :ivar name: Container Name. + :vartype name: str + :ivar code: Exit code. + :vartype code: int + :ivar additional_information: Additional information for the container status. + :vartype additional_information: str + :ivar status: Status of the container. + :vartype status: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "code": {"key": "code", "type": "int"}, + "additional_information": {"key": "additionalInformation", "type": "str"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + code: Optional[int] = None, + additional_information: Optional[str] = None, + status: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Container Name. + :paramtype name: str + :keyword code: Exit code. + :paramtype code: int + :keyword additional_information: Additional information for the container status. + :paramtype additional_information: str + :keyword status: Status of the container. + :paramtype status: str + """ + super().__init__(**kwargs) + self.name = name + self.code = code + self.additional_information = additional_information + self.status = status + + +class ContainerRegistry(_serialization.Model): + """Model representing a mapping from a container registry to the identity used to connect to it. + + All required parameters must be populated in order to send to server. + + :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 = { + "container_registry_server": {"required": True}, + "identity_resource_id": {"required": True}, + } + + _attribute_map = { + "container_registry_server": {"key": "containerRegistryServer", "type": "str"}, + "identity_resource_id": {"key": "identityResourceId", "type": "str"}, + } + + def __init__(self, *, container_registry_server: str, identity_resource_id: str, **kwargs: Any) -> None: + """ + :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.container_registry_server = container_registry_server + self.identity_resource_id = identity_resource_id + + +class ContainerRegistryWithCustomImage(_serialization.Model): + """Container registry that the final image will be uploaded to. + + All required parameters must be populated in order to send to server. + + :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. @@ -2556,6 +3932,8 @@ class ContainerResources(_serialization.Model): :vartype memory: str :ivar ephemeral_storage: Ephemeral Storage, e.g. "1Gi". :vartype ephemeral_storage: str + :ivar gpu: Required GPU in cores for GPU based app, e.g. 1.0. + :vartype gpu: float """ _validation = { @@ -2566,19 +3944,25 @@ class ContainerResources(_serialization.Model): "cpu": {"key": "cpu", "type": "float"}, "memory": {"key": "memory", "type": "str"}, "ephemeral_storage": {"key": "ephemeralStorage", "type": "str"}, + "gpu": {"key": "gpu", "type": "float"}, } - def __init__(self, *, cpu: Optional[float] = None, memory: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, *, cpu: Optional[float] = None, memory: Optional[str] = None, gpu: Optional[float] = 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 + :keyword gpu: Required GPU in cores for GPU based app, e.g. 1.0. + :paramtype gpu: float """ super().__init__(**kwargs) self.cpu = cpu self.memory = memory self.ephemeral_storage = None + self.gpu = gpu class CookieExpiration(_serialization.Model): @@ -2685,6 +4069,47 @@ def __init__( self.allow_credentials = allow_credentials +class CustomContainerTemplate(_serialization.Model): + """Custom container configuration. + + :ivar registry_credentials: Private container registry credentials for containers used by the + sessions of the session pool. + :vartype registry_credentials: ~azure.mgmt.appcontainers.models.SessionRegistryCredentials + :ivar containers: List of container definitions for the sessions of the session pool. + :vartype containers: list[~azure.mgmt.appcontainers.models.SessionContainer] + :ivar ingress: Session pool ingress configuration. + :vartype ingress: ~azure.mgmt.appcontainers.models.SessionIngress + """ + + _attribute_map = { + "registry_credentials": {"key": "registryCredentials", "type": "SessionRegistryCredentials"}, + "containers": {"key": "containers", "type": "[SessionContainer]"}, + "ingress": {"key": "ingress", "type": "SessionIngress"}, + } + + def __init__( + self, + *, + registry_credentials: Optional["_models.SessionRegistryCredentials"] = None, + containers: Optional[List["_models.SessionContainer"]] = None, + ingress: Optional["_models.SessionIngress"] = None, + **kwargs: Any + ) -> None: + """ + :keyword registry_credentials: Private container registry credentials for containers used by + the sessions of the session pool. + :paramtype registry_credentials: ~azure.mgmt.appcontainers.models.SessionRegistryCredentials + :keyword containers: List of container definitions for the sessions of the session pool. + :paramtype containers: list[~azure.mgmt.appcontainers.models.SessionContainer] + :keyword ingress: Session pool ingress configuration. + :paramtype ingress: ~azure.mgmt.appcontainers.models.SessionIngress + """ + super().__init__(**kwargs) + self.registry_credentials = registry_credentials + self.containers = containers + self.ingress = ingress + + class CustomDomain(_serialization.Model): """Custom Domain of a Container App. @@ -2692,7 +4117,8 @@ class CustomDomain(_serialization.Model): :ivar name: Hostname. Required. :vartype name: str - :ivar binding_type: Custom Domain binding type. Known values are: "Disabled" and "SniEnabled". + :ivar binding_type: Custom Domain binding type. Known values are: "Disabled", "SniEnabled", and + "Auto". :vartype binding_type: str or ~azure.mgmt.appcontainers.models.BindingType :ivar certificate_id: Resource Id of the Certificate to be bound to this hostname. Must exist in the Managed Environment. @@ -2720,8 +4146,8 @@ def __init__( """ :keyword name: Hostname. Required. :paramtype name: str - :keyword binding_type: Custom Domain binding type. Known values are: "Disabled" and - "SniEnabled". + :keyword binding_type: Custom Domain binding type. Known values are: "Disabled", "SniEnabled", + and "Auto". :paramtype binding_type: str or ~azure.mgmt.appcontainers.models.BindingType :keyword certificate_id: Resource Id of the Certificate to be bound to this hostname. Must exist in the Managed Environment. @@ -2742,6 +4168,9 @@ class CustomDomainConfiguration(_serialization.Model): :vartype custom_domain_verification_id: str :ivar dns_suffix: Dns suffix for the environment domain. :vartype dns_suffix: str + :ivar certificate_key_vault_properties: Certificate stored in Azure Key Vault. + :vartype certificate_key_vault_properties: + ~azure.mgmt.appcontainers.models.CertificateKeyVaultProperties :ivar certificate_value: PFX or PEM blob. :vartype certificate_value: bytes :ivar certificate_password: Certificate password. @@ -2764,6 +4193,10 @@ class CustomDomainConfiguration(_serialization.Model): _attribute_map = { "custom_domain_verification_id": {"key": "customDomainVerificationId", "type": "str"}, "dns_suffix": {"key": "dnsSuffix", "type": "str"}, + "certificate_key_vault_properties": { + "key": "certificateKeyVaultProperties", + "type": "CertificateKeyVaultProperties", + }, "certificate_value": {"key": "certificateValue", "type": "bytearray"}, "certificate_password": {"key": "certificatePassword", "type": "str"}, "expiration_date": {"key": "expirationDate", "type": "iso-8601"}, @@ -2775,6 +4208,7 @@ def __init__( self, *, dns_suffix: Optional[str] = None, + certificate_key_vault_properties: Optional["_models.CertificateKeyVaultProperties"] = None, certificate_value: Optional[bytes] = None, certificate_password: Optional[str] = None, **kwargs: Any @@ -2782,6 +4216,9 @@ def __init__( """ :keyword dns_suffix: Dns suffix for the environment domain. :paramtype dns_suffix: str + :keyword certificate_key_vault_properties: Certificate stored in Azure Key Vault. + :paramtype certificate_key_vault_properties: + ~azure.mgmt.appcontainers.models.CertificateKeyVaultProperties :keyword certificate_value: PFX or PEM blob. :paramtype certificate_value: bytes :keyword certificate_password: Certificate password. @@ -2790,6 +4227,7 @@ def __init__( super().__init__(**kwargs) self.custom_domain_verification_id = None self.dns_suffix = dns_suffix + self.certificate_key_vault_properties = certificate_key_vault_properties self.certificate_value = certificate_value self.certificate_password = certificate_password self.expiration_date = None @@ -3046,12 +4484,16 @@ class CustomScaleRule(_serialization.Model): :vartype metadata: dict[str, str] :ivar auth: Authentication secrets for the custom scale rule. :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :vartype identity: str """ _attribute_map = { "type": {"key": "type", "type": "str"}, "metadata": {"key": "metadata", "type": "{str}"}, "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "identity": {"key": "identity", "type": "str"}, } def __init__( @@ -3060,6 +4502,7 @@ def __init__( type: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, auth: Optional[List["_models.ScaleRuleAuth"]] = None, + identity: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -3070,11 +4513,15 @@ def __init__( :paramtype metadata: dict[str, str] :keyword auth: Authentication secrets for the custom scale rule. :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :paramtype identity: str """ super().__init__(**kwargs) self.type = type self.metadata = metadata self.auth = auth + self.identity = identity class Dapr(_serialization.Model): @@ -3164,8 +4611,8 @@ class DaprComponent(ProxyResource): # pylint: disable=too-many-instance-attribu Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3191,6 +4638,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 = { @@ -3213,6 +4664,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__( @@ -3226,6 +4678,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: """ @@ -3245,6 +4698,10 @@ 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 @@ -3255,17 +4712,18 @@ def __init__( self.secret_store_component = secret_store_component self.metadata = metadata self.scopes = scopes + self.service_component_bind = service_component_bind -class DaprComponentsCollection(_serialization.Model): - """Dapr Components ARM resource. +class DaprComponentResiliencyPoliciesCollection(_serialization.Model): # pylint: disable=name-too-long + """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 server. :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.DaprComponent] + :vartype value: list[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -3276,34 +4734,356 @@ class DaprComponentsCollection(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[DaprComponent]"}, + "value": {"key": "value", "type": "[DaprComponentResiliencyPolicy]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.DaprComponent"], **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.DaprComponentResiliencyPolicy"], **kwargs: Any) -> None: """ :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.DaprComponent] + :paramtype value: list[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] """ super().__init__(**kwargs) self.value = value self.next_link = None -class DaprConfiguration(_serialization.Model): - """Configuration properties Dapr component. +class DaprComponentResiliencyPolicy(ProxyResource): + """Dapr Component Resiliency Policy. Variables are only populated by the server, and will be ignored when sending a request. - :ivar version: The version of Dapr. - :vartype version: str + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar 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 = { - "version": {"readonly": True}, - } - - _attribute_map = { + "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 DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration( + _serialization.Model +): # pylint: disable=name-too-long + """Dapr Component Resiliency Policy Circuit Breaker Policy Configuration. + + :ivar consecutive_errors: The number of consecutive errors before the circuit is opened. + :vartype consecutive_errors: int + :ivar timeout_in_seconds: The interval in seconds until a retry attempt is made after the + circuit is opened. + :vartype timeout_in_seconds: int + :ivar interval_in_seconds: The optional interval in seconds after which the error count resets + to 0. An interval of 0 will never reset. If not specified, the timeoutInSeconds value will be + used. + :vartype interval_in_seconds: int + """ + + _attribute_map = { + "consecutive_errors": {"key": "consecutiveErrors", "type": "int"}, + "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"}, + "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, + } + + def __init__( + self, + *, + consecutive_errors: Optional[int] = None, + timeout_in_seconds: Optional[int] = None, + interval_in_seconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword consecutive_errors: The number of consecutive errors before the circuit is opened. + :paramtype consecutive_errors: int + :keyword timeout_in_seconds: The interval in seconds until a retry attempt is made after the + circuit is opened. + :paramtype timeout_in_seconds: int + :keyword interval_in_seconds: The optional interval in seconds after which the error count + resets to 0. An interval of 0 will never reset. If not specified, the timeoutInSeconds value + will be used. + :paramtype interval_in_seconds: int + """ + super().__init__(**kwargs) + self.consecutive_errors = consecutive_errors + self.timeout_in_seconds = timeout_in_seconds + self.interval_in_seconds = interval_in_seconds + + +class DaprComponentResiliencyPolicyConfiguration(_serialization.Model): # pylint: disable=name-too-long + """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 + :ivar circuit_breaker_policy: The optional circuit breaker policy configuration. + :vartype circuit_breaker_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration + """ + + _attribute_map = { + "http_retry_policy": { + "key": "httpRetryPolicy", + "type": "DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration", + }, + "timeout_policy": {"key": "timeoutPolicy", "type": "DaprComponentResiliencyPolicyTimeoutPolicyConfiguration"}, + "circuit_breaker_policy": { + "key": "circuitBreakerPolicy", + "type": "DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration", + }, + } + + def __init__( + self, + *, + http_retry_policy: Optional["_models.DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration"] = None, + timeout_policy: Optional["_models.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration"] = None, + circuit_breaker_policy: Optional[ + "_models.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration" + ] = 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 + :keyword circuit_breaker_policy: The optional circuit breaker policy configuration. + :paramtype circuit_breaker_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration + """ + super().__init__(**kwargs) + self.http_retry_policy = http_retry_policy + self.timeout_policy = timeout_policy + self.circuit_breaker_policy = circuit_breaker_policy + + +class DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration(_serialization.Model): # pylint: disable=name-too-long + """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): # pylint: disable=name-too-long + """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): # pylint: disable=name-too-long + """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 server. + + :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"}, } @@ -3408,64 +5188,347 @@ def __init__(self, *, value: List["_models.DaprSecret"], **kwargs: Any) -> None: self.value = value -class DefaultAuthorizationPolicy(_serialization.Model): - """The configuration settings of the Azure Active Directory default authorization policy. +class DaprServiceBindMetadata(_serialization.Model): + """Dapr component metadata. - :ivar allowed_principals: The configuration settings of the Azure Active Directory allowed - principals. - :vartype allowed_principals: ~azure.mgmt.appcontainers.models.AllowedPrincipals - :ivar allowed_applications: The configuration settings of the Azure Active Directory allowed - applications. - :vartype allowed_applications: list[str] + :ivar name: Service bind metadata property name. + :vartype name: str + :ivar value: Service bind metadata property value. + :vartype value: str """ _attribute_map = { - "allowed_principals": {"key": "allowedPrincipals", "type": "AllowedPrincipals"}, - "allowed_applications": {"key": "allowedApplications", "type": "[str]"}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, } - def __init__( - self, - *, - allowed_principals: Optional["_models.AllowedPrincipals"] = None, - allowed_applications: Optional[List[str]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword allowed_principals: The configuration settings of the Azure Active Directory allowed - principals. - :paramtype allowed_principals: ~azure.mgmt.appcontainers.models.AllowedPrincipals - :keyword allowed_applications: The configuration settings of the Azure Active Directory allowed - applications. - :paramtype allowed_applications: list[str] + :keyword name: Service bind metadata property name. + :paramtype name: str + :keyword value: Service bind metadata property value. + :paramtype value: str """ super().__init__(**kwargs) - self.allowed_principals = allowed_principals - self.allowed_applications = allowed_applications + self.name = name + self.value = value -class DefaultErrorResponse(_serialization.Model): - """App Service error response. +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 error: Error model. - :vartype error: ~azure.mgmt.appcontainers.models.DefaultErrorResponseError + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar 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 = { - "error": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - "error": {"key": "error", "type": "DefaultErrorResponseError"}, + "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, **kwargs: Any) -> None: - """ """ + 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.error = None - + 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 DaprSubscriptionBulkSubscribeOptions(_serialization.Model): + """Dapr PubSub Bulk Subscription Options. + + :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 + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "max_messages_count": {"key": "maxMessagesCount", "type": "int"}, + "max_await_duration_ms": {"key": "maxAwaitDurationMs", "type": "int"}, + } + + def __init__( + self, + *, + enabled: bool = False, + max_messages_count: Optional[int] = None, + max_await_duration_ms: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :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.enabled = enabled + self.max_messages_count = max_messages_count + self.max_await_duration_ms = max_await_duration_ms + + +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 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 + """ + + _attribute_map = { + "match": {"key": "match", "type": "str"}, + "path": {"key": "path", "type": "str"}, + } + + 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.match = match + self.path = path + + +class DaprSubscriptionRoutes(_serialization.Model): + """Dapr PubSub Event Subscription Routes configuration. + + :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 = { + "rules": {"key": "rules", "type": "[DaprSubscriptionRouteRule]"}, + "default": {"key": "default", "type": "str"}, + } + + def __init__( + self, + *, + rules: Optional[List["_models.DaprSubscriptionRouteRule"]] = None, + default: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :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.rules = rules + self.default = default + + +class DaprSubscriptionsCollection(_serialization.Model): + """Dapr Subscriptions ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.DaprSubscription] + :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": "[DaprSubscription]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + 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.value = value + self.next_link = None + + +class DataDogConfiguration(_serialization.Model): + """Configuration of datadog. + + :ivar site: The data dog site. + :vartype site: str + :ivar key: The data dog api key. + :vartype key: str + """ + + _attribute_map = { + "site": {"key": "site", "type": "str"}, + "key": {"key": "key", "type": "str"}, + } + + def __init__(self, *, site: Optional[str] = None, key: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword site: The data dog site. + :paramtype site: str + :keyword key: The data dog api key. + :paramtype key: str + """ + super().__init__(**kwargs) + self.site = site + self.key = key + + +class DefaultAuthorizationPolicy(_serialization.Model): + """The configuration settings of the Azure Active Directory default authorization policy. + + :ivar allowed_principals: The configuration settings of the Azure Active Directory allowed + principals. + :vartype allowed_principals: ~azure.mgmt.appcontainers.models.AllowedPrincipals + :ivar allowed_applications: The configuration settings of the Azure Active Directory allowed + applications. + :vartype allowed_applications: list[str] + """ + + _attribute_map = { + "allowed_principals": {"key": "allowedPrincipals", "type": "AllowedPrincipals"}, + "allowed_applications": {"key": "allowedApplications", "type": "[str]"}, + } + + def __init__( + self, + *, + allowed_principals: Optional["_models.AllowedPrincipals"] = None, + allowed_applications: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword allowed_principals: The configuration settings of the Azure Active Directory allowed + principals. + :paramtype allowed_principals: ~azure.mgmt.appcontainers.models.AllowedPrincipals + :keyword allowed_applications: The configuration settings of the Azure Active Directory allowed + applications. + :paramtype allowed_applications: list[str] + """ + super().__init__(**kwargs) + self.allowed_principals = allowed_principals + self.allowed_applications = allowed_applications + + +class DefaultErrorResponse(_serialization.Model): + """App Service error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: Error model. + :vartype error: ~azure.mgmt.appcontainers.models.DefaultErrorResponseError + """ + + _validation = { + "error": {"readonly": True}, + } + + _attribute_map = { + "error": {"key": "error", "type": "DefaultErrorResponseError"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.error = None + class DefaultErrorResponseError(_serialization.Model): """Error model. @@ -3547,6 +5610,38 @@ 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 + :ivar otlp_configurations: Open telemetry otlp configurations. + :vartype otlp_configurations: list[~azure.mgmt.appcontainers.models.OtlpConfiguration] + """ + + _attribute_map = { + "data_dog_configuration": {"key": "dataDogConfiguration", "type": "DataDogConfiguration"}, + "otlp_configurations": {"key": "otlpConfigurations", "type": "[OtlpConfiguration]"}, + } + + def __init__( + self, + *, + data_dog_configuration: Optional["_models.DataDogConfiguration"] = None, + otlp_configurations: Optional[List["_models.OtlpConfiguration"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_dog_configuration: Open telemetry datadog destination configuration. + :paramtype data_dog_configuration: ~azure.mgmt.appcontainers.models.DataDogConfiguration + :keyword otlp_configurations: Open telemetry otlp configurations. + :paramtype otlp_configurations: list[~azure.mgmt.appcontainers.models.OtlpConfiguration] + """ + super().__init__(**kwargs) + self.data_dog_configuration = data_dog_configuration + self.otlp_configurations = otlp_configurations + + class DiagnosticDataProviderMetadata(_serialization.Model): """Details of a diagnostics data provider. @@ -3736,8 +5831,8 @@ class Diagnostics(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -4014,52 +6109,13 @@ 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. +class DotNetComponent(ProxyResource): + """.NET Component. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -4069,14 +6125,17 @@ class EnvironmentAuthToken(TrackedResource): :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 token: Auth token value. - :vartype token: str - :ivar expires: Token expiration date. - :vartype expires: ~datetime.datetime + :ivar component_type: Type of the .NET Component. "AspireDashboard" + :vartype component_type: str or ~azure.mgmt.appcontainers.models.DotNetComponentType + :ivar provisioning_state: Provisioning state of the .NET Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.DotNetComponentProvisioningState + :ivar configurations: List of .NET Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.DotNetComponentConfigurationProperty] + :ivar service_binds: List of .NET Components that are bound to the .NET component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.DotNetComponentServiceBind] """ _validation = { @@ -4084,9 +6143,7 @@ class EnvironmentAuthToken(TrackedResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "location": {"required": True}, - "token": {"readonly": True}, - "expires": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -4094,30 +6151,257 @@ class EnvironmentAuthToken(TrackedResource): "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"}, - "token": {"key": "properties.token", "type": "str"}, - "expires": {"key": "properties.expires", "type": "iso-8601"}, + "component_type": {"key": "properties.componentType", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "configurations": {"key": "properties.configurations", "type": "[DotNetComponentConfigurationProperty]"}, + "service_binds": {"key": "properties.serviceBinds", "type": "[DotNetComponentServiceBind]"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + component_type: Optional[Union[str, "_models.DotNetComponentType"]] = None, + configurations: Optional[List["_models.DotNetComponentConfigurationProperty"]] = None, + service_binds: Optional[List["_models.DotNetComponentServiceBind"]] = 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 component_type: Type of the .NET Component. "AspireDashboard" + :paramtype component_type: str or ~azure.mgmt.appcontainers.models.DotNetComponentType + :keyword configurations: List of .NET Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.DotNetComponentConfigurationProperty] + :keyword service_binds: List of .NET Components that are bound to the .NET component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.DotNetComponentServiceBind] """ - super().__init__(tags=tags, location=location, **kwargs) - self.token = None - self.expires = None + super().__init__(**kwargs) + self.component_type = component_type + self.provisioning_state = None + self.configurations = configurations + self.service_binds = service_binds -class EnvironmentVar(_serialization.Model): - """Container App container environment variable. +class DotNetComponentConfigurationProperty(_serialization.Model): + """Configuration properties for a .NET Component. - :ivar name: Environment variable name. - :vartype name: str - :ivar value: Non-secret environment variable value. + :ivar property_name: The name of the property. + :vartype property_name: str + :ivar value: The value of the property. + :vartype value: str + """ + + _attribute_map = { + "property_name": {"key": "propertyName", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, property_name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword property_name: The name of the property. + :paramtype property_name: str + :keyword value: The value of the property. + :paramtype value: str + """ + super().__init__(**kwargs) + self.property_name = property_name + self.value = value + + +class DotNetComponentsCollection(_serialization.Model): + """.NET 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 server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.DotNetComponent] + :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": "[DotNetComponent]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.DotNetComponent"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.DotNetComponent] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class DotNetComponentServiceBind(_serialization.Model): + """Configuration to bind a .NET Component to another .NET Component. + + :ivar name: Name of the service bind. + :vartype name: str + :ivar service_id: Resource id of the target service. + :vartype service_id: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "service_id": {"key": "serviceId", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, service_id: Optional[str] = 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 + """ + super().__init__(**kwargs) + self.name = name + self.service_id = service_id + + +class DynamicPoolConfiguration(_serialization.Model): + """Dynamic pool configuration. + + :ivar execution_type: The execution type of the session pool. "Timed" + :vartype execution_type: str or ~azure.mgmt.appcontainers.models.ExecutionType + :ivar cooldown_period_in_seconds: The cooldown period of a session in seconds. + :vartype cooldown_period_in_seconds: int + """ + + _attribute_map = { + "execution_type": {"key": "executionType", "type": "str"}, + "cooldown_period_in_seconds": {"key": "cooldownPeriodInSeconds", "type": "int"}, + } + + def __init__( + self, + *, + execution_type: Optional[Union[str, "_models.ExecutionType"]] = None, + cooldown_period_in_seconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword execution_type: The execution type of the session pool. "Timed" + :paramtype execution_type: str or ~azure.mgmt.appcontainers.models.ExecutionType + :keyword cooldown_period_in_seconds: The cooldown period of a session in seconds. + :paramtype cooldown_period_in_seconds: int + """ + super().__init__(**kwargs) + self.execution_type = execution_type + self.cooldown_period_in_seconds = cooldown_period_in_seconds + + +class EncryptionSettings(_serialization.Model): + """The configuration settings of the secrets references of encryption key and signing key for + ContainerApp Service Authentication/Authorization. + + :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. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar token: Auth token value. + :vartype token: str + :ivar expires: Token expiration date. + :vartype expires: ~datetime.datetime + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "token": {"readonly": True}, + "expires": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "token": {"key": "properties.token", "type": "str"}, + "expires": {"key": "properties.expires", "type": "iso-8601"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = 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 + """ + super().__init__(tags=tags, location=location, **kwargs) + self.token = None + self.expires = None + + +class EnvironmentVar(_serialization.Model): + """Container App container environment variable. + + :ivar name: Environment variable name. + :vartype name: str + :ivar value: Non-secret environment variable value. :vartype value: str :ivar secret_ref: Name of the Container App secret from which to pull the environment variable value. @@ -4153,6 +6437,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 server. + + :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. @@ -4224,6 +6541,80 @@ def __init__(self, **kwargs: Any) -> None: self.additional_info = None +class ErrorEntity(_serialization.Model): + """Body of the error response returned from the API. + + :ivar extended_code: Type of error. + :vartype extended_code: str + :ivar message_template: Message template. + :vartype message_template: str + :ivar parameters: Parameters for the template. + :vartype parameters: list[str] + :ivar inner_errors: Inner errors. + :vartype inner_errors: list[~azure.mgmt.appcontainers.models.ErrorEntity] + :ivar details: Error Details. + :vartype details: list[~azure.mgmt.appcontainers.models.ErrorEntity] + :ivar target: The error target. + :vartype target: str + :ivar code: Basic error code. + :vartype code: str + :ivar message: Any details of the error. + :vartype message: str + """ + + _attribute_map = { + "extended_code": {"key": "extendedCode", "type": "str"}, + "message_template": {"key": "messageTemplate", "type": "str"}, + "parameters": {"key": "parameters", "type": "[str]"}, + "inner_errors": {"key": "innerErrors", "type": "[ErrorEntity]"}, + "details": {"key": "details", "type": "[ErrorEntity]"}, + "target": {"key": "target", "type": "str"}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__( + self, + *, + extended_code: Optional[str] = None, + message_template: Optional[str] = None, + parameters: Optional[List[str]] = None, + inner_errors: Optional[List["_models.ErrorEntity"]] = None, + details: Optional[List["_models.ErrorEntity"]] = None, + target: Optional[str] = None, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword extended_code: Type of error. + :paramtype extended_code: str + :keyword message_template: Message template. + :paramtype message_template: str + :keyword parameters: Parameters for the template. + :paramtype parameters: list[str] + :keyword inner_errors: Inner errors. + :paramtype inner_errors: list[~azure.mgmt.appcontainers.models.ErrorEntity] + :keyword details: Error Details. + :paramtype details: list[~azure.mgmt.appcontainers.models.ErrorEntity] + :keyword target: The error target. + :paramtype target: str + :keyword code: Basic error code. + :paramtype code: str + :keyword message: Any details of the error. + :paramtype message: str + """ + super().__init__(**kwargs) + self.extended_code = extended_code + self.message_template = message_template + self.parameters = parameters + self.inner_errors = inner_errors + self.details = details + self.target = target + self.code = code + self.message = message + + class ErrorResponse(_serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). @@ -4245,6 +6636,26 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A self.error = error +class ExecutionStatus(_serialization.Model): + """Container Apps Job execution status. + + :ivar replicas: Replicas in the execution. + :vartype replicas: list[~azure.mgmt.appcontainers.models.ReplicaExecutionStatus] + """ + + _attribute_map = { + "replicas": {"key": "replicas", "type": "[ReplicaExecutionStatus]"}, + } + + def __init__(self, *, replicas: Optional[List["_models.ReplicaExecutionStatus"]] = None, **kwargs: Any) -> None: + """ + :keyword replicas: Replicas in the execution. + :paramtype replicas: list[~azure.mgmt.appcontainers.models.ReplicaExecutionStatus] + """ + super().__init__(**kwargs) + self.replicas = replicas + + class ExtendedLocation(_serialization.Model): """The complex type of the extended location. @@ -4410,7 +6821,7 @@ def __init__( self.login = login -class GithubActionConfiguration(_serialization.Model): +class GithubActionConfiguration(_serialization.Model): # pylint: disable=too-many-instance-attributes """Configuration properties that define the mutable settings of a Container App SourceControl. :ivar registry_info: Registry configurations. @@ -4419,6 +6830,8 @@ class GithubActionConfiguration(_serialization.Model): :vartype azure_credentials: ~azure.mgmt.appcontainers.models.AzureCredentials :ivar context_path: Context path. :vartype context_path: str + :ivar dockerfile_path: Dockerfile path. + :vartype dockerfile_path: str :ivar github_personal_access_token: One time Github PAT to configure github environment. :vartype github_personal_access_token: str :ivar image: Image name. @@ -4431,18 +6844,23 @@ class GithubActionConfiguration(_serialization.Model): :vartype runtime_stack: str :ivar runtime_version: Runtime version. :vartype runtime_version: str + :ivar build_environment_variables: List of environment variables to be passed to the build. + :vartype build_environment_variables: + list[~azure.mgmt.appcontainers.models.EnvironmentVariable] """ _attribute_map = { "registry_info": {"key": "registryInfo", "type": "RegistryInfo"}, "azure_credentials": {"key": "azureCredentials", "type": "AzureCredentials"}, "context_path": {"key": "contextPath", "type": "str"}, + "dockerfile_path": {"key": "dockerfilePath", "type": "str"}, "github_personal_access_token": {"key": "githubPersonalAccessToken", "type": "str"}, "image": {"key": "image", "type": "str"}, "publish_type": {"key": "publishType", "type": "str"}, "os": {"key": "os", "type": "str"}, "runtime_stack": {"key": "runtimeStack", "type": "str"}, "runtime_version": {"key": "runtimeVersion", "type": "str"}, + "build_environment_variables": {"key": "buildEnvironmentVariables", "type": "[EnvironmentVariable]"}, } def __init__( @@ -4451,12 +6869,14 @@ def __init__( registry_info: Optional["_models.RegistryInfo"] = None, azure_credentials: Optional["_models.AzureCredentials"] = None, context_path: Optional[str] = None, + dockerfile_path: Optional[str] = None, github_personal_access_token: Optional[str] = None, image: Optional[str] = None, publish_type: Optional[str] = None, os: Optional[str] = None, runtime_stack: Optional[str] = None, runtime_version: Optional[str] = None, + build_environment_variables: Optional[List["_models.EnvironmentVariable"]] = None, **kwargs: Any ) -> None: """ @@ -4466,6 +6886,8 @@ def __init__( :paramtype azure_credentials: ~azure.mgmt.appcontainers.models.AzureCredentials :keyword context_path: Context path. :paramtype context_path: str + :keyword dockerfile_path: Dockerfile path. + :paramtype dockerfile_path: str :keyword github_personal_access_token: One time Github PAT to configure github environment. :paramtype github_personal_access_token: str :keyword image: Image name. @@ -4478,17 +6900,22 @@ def __init__( :paramtype runtime_stack: str :keyword runtime_version: Runtime version. :paramtype runtime_version: str + :keyword build_environment_variables: List of environment variables to be passed to the build. + :paramtype build_environment_variables: + list[~azure.mgmt.appcontainers.models.EnvironmentVariable] """ super().__init__(**kwargs) self.registry_info = registry_info self.azure_credentials = azure_credentials self.context_path = context_path + self.dockerfile_path = dockerfile_path self.github_personal_access_token = github_personal_access_token self.image = image self.publish_type = publish_type self.os = os self.runtime_stack = runtime_stack self.runtime_version = runtime_version + self.build_environment_variables = build_environment_variables class GlobalValidation(_serialization.Model): @@ -4598,1525 +7025,4489 @@ def __init__( self.validation = validation -class HttpScaleRule(_serialization.Model): - """Container App container Http scaling rule. +class Header(_serialization.Model): + """Header of otlp configuration. - :ivar metadata: Metadata properties to describe http scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar key: The key of otlp configuration header. + :vartype key: str + :ivar value: The value of otlp configuration header. + :vartype value: str """ _attribute_map = { - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "key": {"key": "key", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, key: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword key: The key of otlp configuration header. + :paramtype key: str + :keyword value: The value of otlp configuration header. + :paramtype value: str + """ + super().__init__(**kwargs) + self.key = key + self.value = value + + +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, *, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, + 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 metadata: Metadata properties to describe http scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the custom scale rule. - :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :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.metadata = metadata - self.auth = auth + self.header = header + self.exact_match = exact_match + self.prefix_match = prefix_match + self.suffix_match = suffix_match + self.regex_match = regex_match -class HttpSettings(_serialization.Model): - """The configuration settings of the HTTP requests for authentication and authorization requests - made against ContainerApp Service Authentication/Authorization. +class HttpConnectionPool(_serialization.Model): + """Defines parameters for http connection pooling. - :ivar require_https: :code:`false` if the authentication/authorization responses - not having the HTTPS scheme are permissible; otherwise, :code:`true`. - :vartype require_https: bool - :ivar routes: The configuration settings of the paths HTTP requests. - :vartype routes: ~azure.mgmt.appcontainers.models.HttpSettingsRoutes - :ivar forward_proxy: The configuration settings of a forward proxy used to make the requests. - :vartype forward_proxy: ~azure.mgmt.appcontainers.models.ForwardProxy + :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 = { - "require_https": {"key": "requireHttps", "type": "bool"}, - "routes": {"key": "routes", "type": "HttpSettingsRoutes"}, - "forward_proxy": {"key": "forwardProxy", "type": "ForwardProxy"}, + "http1_max_pending_requests": {"key": "http1MaxPendingRequests", "type": "int"}, + "http2_max_requests": {"key": "http2MaxRequests", "type": "int"}, } def __init__( self, *, - require_https: Optional[bool] = None, - routes: Optional["_models.HttpSettingsRoutes"] = None, - forward_proxy: Optional["_models.ForwardProxy"] = None, + http1_max_pending_requests: Optional[int] = None, + http2_max_requests: Optional[int] = None, **kwargs: Any ) -> None: """ - :keyword require_https: :code:`false` if the authentication/authorization - responses not having the HTTPS scheme are permissible; otherwise, :code:`true`. - :paramtype require_https: bool - :keyword routes: The configuration settings of the paths HTTP requests. - :paramtype routes: ~azure.mgmt.appcontainers.models.HttpSettingsRoutes - :keyword forward_proxy: The configuration settings of a forward proxy used to make the - requests. - :paramtype forward_proxy: ~azure.mgmt.appcontainers.models.ForwardProxy + :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.require_https = require_https - self.routes = routes - self.forward_proxy = forward_proxy + self.http1_max_pending_requests = http1_max_pending_requests + self.http2_max_requests = http2_max_requests -class HttpSettingsRoutes(_serialization.Model): - """The configuration settings of the paths HTTP requests. +class HttpGet(_serialization.Model): + """Model representing a http get request. - :ivar api_prefix: The prefix that should precede all the authentication/authorization paths. - :vartype api_prefix: str + All required parameters must be populated in order to send to server. + + :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 = { - "api_prefix": {"key": "apiPrefix", "type": "str"}, + "url": {"key": "url", "type": "str"}, + "file_name": {"key": "fileName", "type": "str"}, + "headers": {"key": "headers", "type": "[str]"}, } - def __init__(self, *, api_prefix: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, *, url: str, file_name: Optional[str] = None, headers: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ - :keyword api_prefix: The prefix that should precede all the authentication/authorization paths. - :paramtype api_prefix: str + :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.api_prefix = api_prefix + self.url = url + self.file_name = file_name + self.headers = headers -class IdentityProviders(_serialization.Model): - """The configuration settings of each of the identity providers used to configure ContainerApp - Service Authentication/Authorization. +class HttpRetryPolicy(_serialization.Model): + """Policy that defines http request retry conditions. - :ivar azure_active_directory: The configuration settings of the Azure Active directory - provider. - :vartype azure_active_directory: ~azure.mgmt.appcontainers.models.AzureActiveDirectory - :ivar facebook: The configuration settings of the Facebook provider. - :vartype facebook: ~azure.mgmt.appcontainers.models.Facebook - :ivar git_hub: The configuration settings of the GitHub provider. - :vartype git_hub: ~azure.mgmt.appcontainers.models.GitHub - :ivar google: The configuration settings of the Google provider. - :vartype google: ~azure.mgmt.appcontainers.models.Google - :ivar twitter: The configuration settings of the Twitter provider. - :vartype twitter: ~azure.mgmt.appcontainers.models.Twitter - :ivar apple: The configuration settings of the Apple provider. - :vartype apple: ~azure.mgmt.appcontainers.models.Apple - :ivar azure_static_web_apps: The configuration settings of the Azure Static Web Apps provider. - :vartype azure_static_web_apps: ~azure.mgmt.appcontainers.models.AzureStaticWebApps - :ivar custom_open_id_connect_providers: The map of the name of the alias of each custom Open ID - Connect provider to the - configuration settings of the custom Open ID Connect provider. - :vartype custom_open_id_connect_providers: dict[str, - ~azure.mgmt.appcontainers.models.CustomOpenIdConnectProvider] + :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 = { - "azure_active_directory": {"key": "azureActiveDirectory", "type": "AzureActiveDirectory"}, - "facebook": {"key": "facebook", "type": "Facebook"}, - "git_hub": {"key": "gitHub", "type": "GitHub"}, - "google": {"key": "google", "type": "Google"}, - "twitter": {"key": "twitter", "type": "Twitter"}, - "apple": {"key": "apple", "type": "Apple"}, - "azure_static_web_apps": {"key": "azureStaticWebApps", "type": "AzureStaticWebApps"}, - "custom_open_id_connect_providers": { - "key": "customOpenIdConnectProviders", - "type": "{CustomOpenIdConnectProvider}", - }, + "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, *, - azure_active_directory: Optional["_models.AzureActiveDirectory"] = None, - facebook: Optional["_models.Facebook"] = None, - git_hub: Optional["_models.GitHub"] = None, - google: Optional["_models.Google"] = None, - twitter: Optional["_models.Twitter"] = None, - apple: Optional["_models.Apple"] = None, - azure_static_web_apps: Optional["_models.AzureStaticWebApps"] = None, - custom_open_id_connect_providers: Optional[Dict[str, "_models.CustomOpenIdConnectProvider"]] = None, + 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 azure_active_directory: The configuration settings of the Azure Active directory - provider. - :paramtype azure_active_directory: ~azure.mgmt.appcontainers.models.AzureActiveDirectory - :keyword facebook: The configuration settings of the Facebook provider. - :paramtype facebook: ~azure.mgmt.appcontainers.models.Facebook - :keyword git_hub: The configuration settings of the GitHub provider. - :paramtype git_hub: ~azure.mgmt.appcontainers.models.GitHub - :keyword google: The configuration settings of the Google provider. - :paramtype google: ~azure.mgmt.appcontainers.models.Google - :keyword twitter: The configuration settings of the Twitter provider. - :paramtype twitter: ~azure.mgmt.appcontainers.models.Twitter - :keyword apple: The configuration settings of the Apple provider. - :paramtype apple: ~azure.mgmt.appcontainers.models.Apple - :keyword azure_static_web_apps: The configuration settings of the Azure Static Web Apps - provider. - :paramtype azure_static_web_apps: ~azure.mgmt.appcontainers.models.AzureStaticWebApps - :keyword custom_open_id_connect_providers: The map of the name of the alias of each custom Open - ID Connect provider to the - configuration settings of the custom Open ID Connect provider. - :paramtype custom_open_id_connect_providers: dict[str, - ~azure.mgmt.appcontainers.models.CustomOpenIdConnectProvider] + :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.azure_active_directory = azure_active_directory - self.facebook = facebook - self.git_hub = git_hub - self.google = google - self.twitter = twitter - self.apple = apple - self.azure_static_web_apps = azure_static_web_apps - self.custom_open_id_connect_providers = custom_open_id_connect_providers + 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 Ingress(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Container App Ingress configuration. - - Variables are only populated by the server, and will be ignored when sending a request. +class HttpRoute(_serialization.Model): + """Http Routes configuration, including paths to match on and whether or not rewrites are to be + done. - :ivar fqdn: Hostname. - :vartype fqdn: str - :ivar external: Bool indicating if app exposes an external http endpoint. - :vartype external: bool - :ivar target_port: Target Port in containers for traffic from ingress. - :vartype target_port: int - :ivar exposed_port: Exposed Port in containers for TCP traffic from ingress. - :vartype exposed_port: int - :ivar transport: Ingress transport protocol. Known values are: "auto", "http", "http2", and - "tcp". - :vartype transport: str or ~azure.mgmt.appcontainers.models.IngressTransportMethod - :ivar traffic: Traffic weights for app's revisions. - :vartype traffic: list[~azure.mgmt.appcontainers.models.TrafficWeight] - :ivar custom_domains: custom domain bindings for Container Apps' hostnames. - :vartype custom_domains: list[~azure.mgmt.appcontainers.models.CustomDomain] - :ivar allow_insecure: Bool indicating if HTTP connections to is allowed. If set to false HTTP - connections are automatically redirected to HTTPS connections. - :vartype allow_insecure: bool - :ivar ip_security_restrictions: Rules to restrict incoming IP address. - :vartype ip_security_restrictions: - list[~azure.mgmt.appcontainers.models.IpSecurityRestrictionRule] - :ivar sticky_sessions: Sticky Sessions for Single Revision Mode. - :vartype sticky_sessions: ~azure.mgmt.appcontainers.models.IngressStickySessions - :ivar client_certificate_mode: Client certificate mode for mTLS authentication. Ignore - indicates server drops client certificate on forwarding. Accept indicates server forwards - client certificate but does not require a client certificate. Require indicates server requires - a client certificate. Known values are: "ignore", "accept", and "require". - :vartype client_certificate_mode: str or - ~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] + :ivar match: Conditions route will match on. + :vartype match: ~azure.mgmt.appcontainers.models.HttpRouteMatch + :ivar action: Once route is matched, what is the desired action. + :vartype action: ~azure.mgmt.appcontainers.models.HttpRouteAction """ - _validation = { - "fqdn": {"readonly": True}, - } - _attribute_map = { - "fqdn": {"key": "fqdn", "type": "str"}, - "external": {"key": "external", "type": "bool"}, - "target_port": {"key": "targetPort", "type": "int"}, - "exposed_port": {"key": "exposedPort", "type": "int"}, - "transport": {"key": "transport", "type": "str"}, - "traffic": {"key": "traffic", "type": "[TrafficWeight]"}, - "custom_domains": {"key": "customDomains", "type": "[CustomDomain]"}, - "allow_insecure": {"key": "allowInsecure", "type": "bool"}, - "ip_security_restrictions": {"key": "ipSecurityRestrictions", "type": "[IpSecurityRestrictionRule]"}, - "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]"}, + "match": {"key": "match", "type": "HttpRouteMatch"}, + "action": {"key": "action", "type": "HttpRouteAction"}, } def __init__( self, *, - external: bool = False, - target_port: Optional[int] = None, - exposed_port: Optional[int] = None, - transport: Union[str, "_models.IngressTransportMethod"] = "auto", - traffic: Optional[List["_models.TrafficWeight"]] = None, - custom_domains: Optional[List["_models.CustomDomain"]] = None, - allow_insecure: bool = False, - ip_security_restrictions: Optional[List["_models.IpSecurityRestrictionRule"]] = None, - 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, + match: Optional["_models.HttpRouteMatch"] = None, + action: Optional["_models.HttpRouteAction"] = None, **kwargs: Any ) -> None: """ - :keyword external: Bool indicating if app exposes an external http endpoint. - :paramtype external: bool - :keyword target_port: Target Port in containers for traffic from ingress. - :paramtype target_port: int - :keyword exposed_port: Exposed Port in containers for TCP traffic from ingress. - :paramtype exposed_port: int - :keyword transport: Ingress transport protocol. Known values are: "auto", "http", "http2", and - "tcp". - :paramtype transport: str or ~azure.mgmt.appcontainers.models.IngressTransportMethod - :keyword traffic: Traffic weights for app's revisions. - :paramtype traffic: list[~azure.mgmt.appcontainers.models.TrafficWeight] - :keyword custom_domains: custom domain bindings for Container Apps' hostnames. - :paramtype custom_domains: list[~azure.mgmt.appcontainers.models.CustomDomain] - :keyword allow_insecure: Bool indicating if HTTP connections to is allowed. If set to false - HTTP connections are automatically redirected to HTTPS connections. - :paramtype allow_insecure: bool - :keyword ip_security_restrictions: Rules to restrict incoming IP address. - :paramtype ip_security_restrictions: - list[~azure.mgmt.appcontainers.models.IpSecurityRestrictionRule] - :keyword sticky_sessions: Sticky Sessions for Single Revision Mode. - :paramtype sticky_sessions: ~azure.mgmt.appcontainers.models.IngressStickySessions - :keyword client_certificate_mode: Client certificate mode for mTLS authentication. Ignore - indicates server drops client certificate on forwarding. Accept indicates server forwards - client certificate but does not require a client certificate. Require indicates server requires - a client certificate. Known values are: "ignore", "accept", and "require". - :paramtype client_certificate_mode: str or - ~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] + :keyword match: Conditions route will match on. + :paramtype match: ~azure.mgmt.appcontainers.models.HttpRouteMatch + :keyword action: Once route is matched, what is the desired action. + :paramtype action: ~azure.mgmt.appcontainers.models.HttpRouteAction """ super().__init__(**kwargs) - self.fqdn = None - self.external = external - self.target_port = target_port - self.exposed_port = exposed_port - self.transport = transport - self.traffic = traffic - self.custom_domains = custom_domains - self.allow_insecure = allow_insecure - self.ip_security_restrictions = ip_security_restrictions - self.sticky_sessions = sticky_sessions - self.client_certificate_mode = client_certificate_mode - self.cors_policy = cors_policy - self.additional_port_mappings = additional_port_mappings + self.match = match + self.action = action -class IngressPortMapping(_serialization.Model): - """Port mappings of container app ingress. +class HttpRouteAction(_serialization.Model): + """Action to perform once matching of routes is done. - All required parameters must be populated in order to send to server. + :ivar prefix_rewrite: Rewrite prefix, default is no rewrites. + :vartype prefix_rewrite: str + """ - :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 + _attribute_map = { + "prefix_rewrite": {"key": "prefixRewrite", "type": "str"}, + } + + def __init__(self, *, prefix_rewrite: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword prefix_rewrite: Rewrite prefix, default is no rewrites. + :paramtype prefix_rewrite: str + """ + super().__init__(**kwargs) + self.prefix_rewrite = prefix_rewrite + + +class HttpRouteConfig(ProxyResource): + """Advanced Ingress routing for path/header based routing for a Container App Environment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar properties: Http Route Config properties. + :vartype properties: ~azure.mgmt.appcontainers.models.HttpRouteConfigProperties """ _validation = { - "external": {"required": True}, - "target_port": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - "external": {"key": "external", "type": "bool"}, - "target_port": {"key": "targetPort", "type": "int"}, - "exposed_port": {"key": "exposedPort", "type": "int"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "HttpRouteConfigProperties"}, } - def __init__(self, *, external: bool, target_port: int, exposed_port: Optional[int] = None, **kwargs: Any) -> None: + def __init__(self, *, properties: Optional["_models.HttpRouteConfigProperties"] = 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 + :keyword properties: Http Route Config properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.HttpRouteConfigProperties """ super().__init__(**kwargs) - self.external = external - self.target_port = target_port - self.exposed_port = exposed_port + self.properties = properties -class IngressStickySessions(_serialization.Model): - """Sticky Sessions for Single Revision Mode. +class HttpRouteConfigCollection(_serialization.Model): + """Collection of Advanced Ingress Routing Config resources. - :ivar affinity: Sticky Session Affinity. Known values are: "sticky" and "none". - :vartype affinity: str or ~azure.mgmt.appcontainers.models.Affinity + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.HttpRouteConfig] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + _attribute_map = { - "affinity": {"key": "affinity", "type": "str"}, + "value": {"key": "value", "type": "[HttpRouteConfig]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, affinity: Optional[Union[str, "_models.Affinity"]] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.HttpRouteConfig"], **kwargs: Any) -> None: """ - :keyword affinity: Sticky Session Affinity. Known values are: "sticky" and "none". - :paramtype affinity: str or ~azure.mgmt.appcontainers.models.Affinity + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.HttpRouteConfig] """ super().__init__(**kwargs) - self.affinity = affinity + self.value = value + self.next_link = None -class InitContainer(BaseContainer): - """Container App init container definition. +class HttpRouteConfigProperties(_serialization.Model): + """Http Route Config properties. - :ivar image: Container image tag. - :vartype image: str - :ivar name: Custom container name. - :vartype name: str - :ivar command: Container start command. - :vartype command: list[str] - :ivar args: Container start command arguments. - :vartype args: list[str] - :ivar env: Container environment variables. - :vartype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] - :ivar resources: Container resource requirements. - :vartype resources: ~azure.mgmt.appcontainers.models.ContainerResources - :ivar volume_mounts: Container volume mounts. - :vartype volume_mounts: list[~azure.mgmt.appcontainers.models.VolumeMount] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The provisioning state of the Http Route Config in cluster. Known + values are: "Succeeded", "Failed", "Canceled", "Waiting", "Updating", "Deleting", and + "Pending". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.HttpRouteProvisioningState + :ivar provisioning_errors: List of errors when trying to reconcile http routes. + :vartype provisioning_errors: + list[~azure.mgmt.appcontainers.models.HttpRouteProvisioningErrors] + :ivar fqdn: FQDN of the route resource. + :vartype fqdn: str + :ivar custom_domains: Custom domain bindings for http Routes' hostnames. + :vartype custom_domains: list[~azure.mgmt.appcontainers.models.CustomDomain] + :ivar rules: Routing Rules for http route resource. + :vartype rules: list[~azure.mgmt.appcontainers.models.HttpRouteRule] """ + _validation = { + "provisioning_state": {"readonly": True}, + "provisioning_errors": {"readonly": True}, + "fqdn": {"readonly": True}, + } -class IpSecurityRestrictionRule(_serialization.Model): - """Rule to restrict incoming IP address. + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_errors": {"key": "provisioningErrors", "type": "[HttpRouteProvisioningErrors]"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "custom_domains": {"key": "customDomains", "type": "[CustomDomain]"}, + "rules": {"key": "rules", "type": "[HttpRouteRule]"}, + } - All required parameters must be populated in order to send to server. + def __init__( + self, + *, + custom_domains: Optional[List["_models.CustomDomain"]] = None, + rules: Optional[List["_models.HttpRouteRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword custom_domains: Custom domain bindings for http Routes' hostnames. + :paramtype custom_domains: list[~azure.mgmt.appcontainers.models.CustomDomain] + :keyword rules: Routing Rules for http route resource. + :paramtype rules: list[~azure.mgmt.appcontainers.models.HttpRouteRule] + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.provisioning_errors = None + self.fqdn = None + self.custom_domains = custom_domains + self.rules = rules - :ivar name: Name for the IP restriction rule. Required. - :vartype name: str - :ivar description: Describe the IP restriction rule that is being sent to the container-app. - This is an optional field. - :vartype description: str - :ivar ip_address_range: CIDR notation to match incoming IP address. Required. - :vartype ip_address_range: str - :ivar action: Allow or Deny rules to determine for incoming IP. Note: Rules can only consist of - ALL Allow or ALL Deny. Required. Known values are: "Allow" and "Deny". - :vartype action: str or ~azure.mgmt.appcontainers.models.Action + +class HttpRouteMatch(_serialization.Model): + """Criteria to match on. + + :ivar prefix: match on all prefix's. Not exact. + :vartype prefix: str + :ivar path: match on exact path. + :vartype path: str + :ivar path_separated_prefix: match on all prefix's. Not exact. + :vartype path_separated_prefix: str + :ivar case_sensitive: path case sensitive, default is true. + :vartype case_sensitive: bool + """ + + _attribute_map = { + "prefix": {"key": "prefix", "type": "str"}, + "path": {"key": "path", "type": "str"}, + "path_separated_prefix": {"key": "pathSeparatedPrefix", "type": "str"}, + "case_sensitive": {"key": "caseSensitive", "type": "bool"}, + } + + def __init__( + self, + *, + prefix: Optional[str] = None, + path: Optional[str] = None, + path_separated_prefix: Optional[str] = None, + case_sensitive: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword prefix: match on all prefix's. Not exact. + :paramtype prefix: str + :keyword path: match on exact path. + :paramtype path: str + :keyword path_separated_prefix: match on all prefix's. Not exact. + :paramtype path_separated_prefix: str + :keyword case_sensitive: path case sensitive, default is true. + :paramtype case_sensitive: bool + """ + super().__init__(**kwargs) + self.prefix = prefix + self.path = path + self.path_separated_prefix = path_separated_prefix + self.case_sensitive = case_sensitive + + +class HttpRouteProvisioningErrors(_serialization.Model): + """List of provisioning errors for a http route config object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar timestamp: Timestamp error occured at. + :vartype timestamp: ~datetime.datetime + :ivar message: Description or error message. + :vartype message: str """ _validation = { - "name": {"required": True}, - "ip_address_range": {"required": True}, - "action": {"required": True}, + "timestamp": {"readonly": True}, + "message": {"readonly": True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, + "timestamp": {"key": "timestamp", "type": "iso-8601"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.timestamp = None + self.message = None + + +class HttpRouteRule(_serialization.Model): + """Http Route rule. + + :ivar targets: Targets- container apps, revisions, labels. + :vartype targets: list[~azure.mgmt.appcontainers.models.HttpRouteTarget] + :ivar routes: Routing configuration that will allow matches on specific paths/headers. + :vartype routes: list[~azure.mgmt.appcontainers.models.HttpRoute] + :ivar description: Description of rule. Optional. + :vartype description: str + """ + + _attribute_map = { + "targets": {"key": "targets", "type": "[HttpRouteTarget]"}, + "routes": {"key": "routes", "type": "[HttpRoute]"}, "description": {"key": "description", "type": "str"}, - "ip_address_range": {"key": "ipAddressRange", "type": "str"}, - "action": {"key": "action", "type": "str"}, } def __init__( self, *, - name: str, - ip_address_range: str, - action: Union[str, "_models.Action"], + targets: Optional[List["_models.HttpRouteTarget"]] = None, + routes: Optional[List["_models.HttpRoute"]] = None, description: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword name: Name for the IP restriction rule. Required. - :paramtype name: str - :keyword description: Describe the IP restriction rule that is being sent to the container-app. - This is an optional field. + :keyword targets: Targets- container apps, revisions, labels. + :paramtype targets: list[~azure.mgmt.appcontainers.models.HttpRouteTarget] + :keyword routes: Routing configuration that will allow matches on specific paths/headers. + :paramtype routes: list[~azure.mgmt.appcontainers.models.HttpRoute] + :keyword description: Description of rule. Optional. :paramtype description: str - :keyword ip_address_range: CIDR notation to match incoming IP address. Required. - :paramtype ip_address_range: str - :keyword action: Allow or Deny rules to determine for incoming IP. Note: Rules can only consist - of ALL Allow or ALL Deny. Required. Known values are: "Allow" and "Deny". - :paramtype action: str or ~azure.mgmt.appcontainers.models.Action """ super().__init__(**kwargs) - self.name = name + self.targets = targets + self.routes = routes self.description = description - self.ip_address_range = ip_address_range - self.action = action - -class Job(TrackedResource): # pylint: disable=too-many-instance-attributes - """Container App Job. - Variables are only populated by the server, and will be ignored when sending a request. +class HttpRouteTarget(_serialization.Model): + """Targets - Container App Names, Revision Names, Labels. All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :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 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 - :ivar provisioning_state: Provisioning state of the Container Apps Job. Known values are: - "InProgress", "Succeeded", "Failed", "Canceled", and "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.JobProvisioningState - :ivar environment_id: Resource ID of environment. - :vartype environment_id: str - :ivar workload_profile_name: Workload profile name to pin for container apps job execution. - :vartype workload_profile_name: str - :ivar configuration: Container Apps Job configuration properties. - :vartype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration - :ivar template: Container Apps job definition. - :vartype template: ~azure.mgmt.appcontainers.models.JobTemplate - :ivar outbound_ip_addresses: Outbound IP Addresses of a container apps job. - :vartype outbound_ip_addresses: list[str] - :ivar event_stream_endpoint: The endpoint of the eventstream of the container apps job. - :vartype event_stream_endpoint: str + :ivar container_app: Container App Name to route requests to. Required. + :vartype container_app: str + :ivar revision: Revision to route requests to. + :vartype revision: str + :ivar label: Label/Revision to route requests to. + :vartype label: str + :ivar weight: Weighted routing. + :vartype weight: int """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "provisioning_state": {"readonly": True}, - "outbound_ip_addresses": {"readonly": True}, - "event_stream_endpoint": {"readonly": True}, + "container_app": {"required": True}, + "weight": {"maximum": 100, "minimum": 0}, } _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"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "environment_id": {"key": "properties.environmentId", "type": "str"}, - "workload_profile_name": {"key": "properties.workloadProfileName", "type": "str"}, - "configuration": {"key": "properties.configuration", "type": "JobConfiguration"}, - "template": {"key": "properties.template", "type": "JobTemplate"}, - "outbound_ip_addresses": {"key": "properties.outboundIpAddresses", "type": "[str]"}, - "event_stream_endpoint": {"key": "properties.eventStreamEndpoint", "type": "str"}, + "container_app": {"key": "containerApp", "type": "str"}, + "revision": {"key": "revision", "type": "str"}, + "label": {"key": "label", "type": "str"}, + "weight": {"key": "weight", "type": "int"}, } def __init__( self, *, - location: str, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - environment_id: Optional[str] = None, - workload_profile_name: Optional[str] = None, - configuration: Optional["_models.JobConfiguration"] = None, - template: Optional["_models.JobTemplate"] = None, + container_app: str, + revision: Optional[str] = None, + label: Optional[str] = None, + weight: Optional[int] = 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 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 - :keyword environment_id: Resource ID of environment. - :paramtype environment_id: str - :keyword workload_profile_name: Workload profile name to pin for container apps job execution. - :paramtype workload_profile_name: str - :keyword configuration: Container Apps Job configuration properties. - :paramtype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration - :keyword template: Container Apps job definition. - :paramtype template: ~azure.mgmt.appcontainers.models.JobTemplate + :keyword container_app: Container App Name to route requests to. Required. + :paramtype container_app: str + :keyword revision: Revision to route requests to. + :paramtype revision: str + :keyword label: Label/Revision to route requests to. + :paramtype label: str + :keyword weight: Weighted routing. + :paramtype weight: int """ - super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.provisioning_state = None - self.environment_id = environment_id - self.workload_profile_name = workload_profile_name - self.configuration = configuration - self.template = template - self.outbound_ip_addresses = None - self.event_stream_endpoint = None - + super().__init__(**kwargs) + self.container_app = container_app + self.revision = revision + self.label = label + self.weight = weight -class JobConfiguration(_serialization.Model): - """Non versioned Container Apps Job configuration properties. - All required parameters must be populated in order to send to server. +class HttpScaleRule(_serialization.Model): + """Container App container Http scaling rule. - :ivar secrets: Collection of secrets used by a Container Apps Job. - :vartype secrets: list[~azure.mgmt.appcontainers.models.Secret] - :ivar trigger_type: Trigger type of the job. Known values are: "Schedule", "Event", and - "Manual". - :vartype trigger_type: str or ~azure.mgmt.appcontainers.models.TriggerType - :ivar replica_timeout: Maximum number of seconds a replica is allowed to run. Required. - :vartype replica_timeout: int - :ivar replica_retry_limit: Maximum number of retries before failing the job. - :vartype replica_retry_limit: int - :ivar manual_trigger_config: Manual trigger configuration for a single execution job. - Properties replicaCompletionCount and parallelism would be set to 1 by default. - :vartype manual_trigger_config: - ~azure.mgmt.appcontainers.models.JobConfigurationManualTriggerConfig - :ivar schedule_trigger_config: Cron formatted repeating trigger schedule ("\\ * * * * *") for - cronjobs. Properties completions and parallelism would be set to 1 by default. - :vartype schedule_trigger_config: - ~azure.mgmt.appcontainers.models.JobConfigurationScheduleTriggerConfig - :ivar event_trigger_config: Trigger configuration of an event driven job. - :vartype event_trigger_config: - ~azure.mgmt.appcontainers.models.JobConfigurationEventTriggerConfig - :ivar registries: Collection of private container registry credentials used by a Container apps - job. - :vartype registries: list[~azure.mgmt.appcontainers.models.RegistryCredentials] + :ivar metadata: Metadata properties to describe http scale rule. + :vartype metadata: dict[str, str] + :ivar auth: Authentication secrets for the custom scale rule. + :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :vartype identity: str """ - _validation = { - "trigger_type": {"required": True}, - "replica_timeout": {"required": True}, - } - _attribute_map = { - "secrets": {"key": "secrets", "type": "[Secret]"}, - "trigger_type": {"key": "triggerType", "type": "str"}, - "replica_timeout": {"key": "replicaTimeout", "type": "int"}, - "replica_retry_limit": {"key": "replicaRetryLimit", "type": "int"}, - "manual_trigger_config": {"key": "manualTriggerConfig", "type": "JobConfigurationManualTriggerConfig"}, - "schedule_trigger_config": {"key": "scheduleTriggerConfig", "type": "JobConfigurationScheduleTriggerConfig"}, - "event_trigger_config": {"key": "eventTriggerConfig", "type": "JobConfigurationEventTriggerConfig"}, - "registries": {"key": "registries", "type": "[RegistryCredentials]"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "identity": {"key": "identity", "type": "str"}, } def __init__( self, *, - trigger_type: Union[str, "_models.TriggerType"] = "Manual", - replica_timeout: int, - secrets: Optional[List["_models.Secret"]] = None, - replica_retry_limit: Optional[int] = None, - manual_trigger_config: Optional["_models.JobConfigurationManualTriggerConfig"] = None, - schedule_trigger_config: Optional["_models.JobConfigurationScheduleTriggerConfig"] = None, - event_trigger_config: Optional["_models.JobConfigurationEventTriggerConfig"] = None, - registries: Optional[List["_models.RegistryCredentials"]] = None, + metadata: Optional[Dict[str, str]] = None, + auth: Optional[List["_models.ScaleRuleAuth"]] = None, + identity: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword secrets: Collection of secrets used by a Container Apps Job. - :paramtype secrets: list[~azure.mgmt.appcontainers.models.Secret] - :keyword trigger_type: Trigger type of the job. Known values are: "Schedule", "Event", and - "Manual". - :paramtype trigger_type: str or ~azure.mgmt.appcontainers.models.TriggerType - :keyword replica_timeout: Maximum number of seconds a replica is allowed to run. Required. - :paramtype replica_timeout: int - :keyword replica_retry_limit: Maximum number of retries before failing the job. - :paramtype replica_retry_limit: int - :keyword manual_trigger_config: Manual trigger configuration for a single execution job. - Properties replicaCompletionCount and parallelism would be set to 1 by default. - :paramtype manual_trigger_config: - ~azure.mgmt.appcontainers.models.JobConfigurationManualTriggerConfig - :keyword schedule_trigger_config: Cron formatted repeating trigger schedule ("\\ * * * * *") - for cronjobs. Properties completions and parallelism would be set to 1 by default. - :paramtype schedule_trigger_config: - ~azure.mgmt.appcontainers.models.JobConfigurationScheduleTriggerConfig - :keyword event_trigger_config: Trigger configuration of an event driven job. - :paramtype event_trigger_config: - ~azure.mgmt.appcontainers.models.JobConfigurationEventTriggerConfig - :keyword registries: Collection of private container registry credentials used by a Container - apps job. - :paramtype registries: list[~azure.mgmt.appcontainers.models.RegistryCredentials] + :keyword metadata: Metadata properties to describe http scale rule. + :paramtype metadata: dict[str, str] + :keyword auth: Authentication secrets for the custom scale rule. + :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :paramtype identity: str """ super().__init__(**kwargs) - self.secrets = secrets - self.trigger_type = trigger_type - self.replica_timeout = replica_timeout - self.replica_retry_limit = replica_retry_limit - self.manual_trigger_config = manual_trigger_config - self.schedule_trigger_config = schedule_trigger_config - self.event_trigger_config = event_trigger_config - self.registries = registries + self.metadata = metadata + self.auth = auth + self.identity = identity -class JobConfigurationEventTriggerConfig(_serialization.Model): - """Trigger configuration of an event driven job. +class HttpSettings(_serialization.Model): + """The configuration settings of the HTTP requests for authentication and authorization requests + made against ContainerApp Service Authentication/Authorization. - :ivar replica_completion_count: Minimum number of successful replica completions before overall - job completion. - :vartype replica_completion_count: int - :ivar parallelism: Number of parallel replicas of a job that can run at a given time. - :vartype parallelism: int - :ivar scale: Scaling configurations for event driven jobs. - :vartype scale: ~azure.mgmt.appcontainers.models.JobScale + :ivar require_https: :code:`false` if the authentication/authorization responses + not having the HTTPS scheme are permissible; otherwise, :code:`true`. + :vartype require_https: bool + :ivar routes: The configuration settings of the paths HTTP requests. + :vartype routes: ~azure.mgmt.appcontainers.models.HttpSettingsRoutes + :ivar forward_proxy: The configuration settings of a forward proxy used to make the requests. + :vartype forward_proxy: ~azure.mgmt.appcontainers.models.ForwardProxy """ _attribute_map = { - "replica_completion_count": {"key": "replicaCompletionCount", "type": "int"}, - "parallelism": {"key": "parallelism", "type": "int"}, - "scale": {"key": "scale", "type": "JobScale"}, + "require_https": {"key": "requireHttps", "type": "bool"}, + "routes": {"key": "routes", "type": "HttpSettingsRoutes"}, + "forward_proxy": {"key": "forwardProxy", "type": "ForwardProxy"}, } def __init__( self, *, - replica_completion_count: Optional[int] = None, - parallelism: Optional[int] = None, - scale: Optional["_models.JobScale"] = None, + require_https: Optional[bool] = None, + routes: Optional["_models.HttpSettingsRoutes"] = None, + forward_proxy: Optional["_models.ForwardProxy"] = None, **kwargs: Any ) -> None: """ - :keyword replica_completion_count: Minimum number of successful replica completions before - overall job completion. - :paramtype replica_completion_count: int - :keyword parallelism: Number of parallel replicas of a job that can run at a given time. - :paramtype parallelism: int - :keyword scale: Scaling configurations for event driven jobs. - :paramtype scale: ~azure.mgmt.appcontainers.models.JobScale + :keyword require_https: :code:`false` if the authentication/authorization + responses not having the HTTPS scheme are permissible; otherwise, :code:`true`. + :paramtype require_https: bool + :keyword routes: The configuration settings of the paths HTTP requests. + :paramtype routes: ~azure.mgmt.appcontainers.models.HttpSettingsRoutes + :keyword forward_proxy: The configuration settings of a forward proxy used to make the + requests. + :paramtype forward_proxy: ~azure.mgmt.appcontainers.models.ForwardProxy """ super().__init__(**kwargs) - self.replica_completion_count = replica_completion_count - self.parallelism = parallelism - self.scale = scale + self.require_https = require_https + self.routes = routes + self.forward_proxy = forward_proxy -class JobConfigurationManualTriggerConfig(_serialization.Model): - """Manual trigger configuration for a single execution job. Properties replicaCompletionCount and - parallelism would be set to 1 by default. +class HttpSettingsRoutes(_serialization.Model): + """The configuration settings of the paths HTTP requests. - :ivar replica_completion_count: Minimum number of successful replica completions before overall - job completion. - :vartype replica_completion_count: int - :ivar parallelism: Number of parallel replicas of a job that can run at a given time. - :vartype parallelism: int + :ivar api_prefix: The prefix that should precede all the authentication/authorization paths. + :vartype api_prefix: str """ _attribute_map = { - "replica_completion_count": {"key": "replicaCompletionCount", "type": "int"}, - "parallelism": {"key": "parallelism", "type": "int"}, + "api_prefix": {"key": "apiPrefix", "type": "str"}, } - def __init__( - self, *, replica_completion_count: Optional[int] = None, parallelism: Optional[int] = None, **kwargs: Any - ) -> None: + def __init__(self, *, api_prefix: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword replica_completion_count: Minimum number of successful replica completions before - overall job completion. - :paramtype replica_completion_count: int - :keyword parallelism: Number of parallel replicas of a job that can run at a given time. - :paramtype parallelism: int + :keyword api_prefix: The prefix that should precede all the authentication/authorization paths. + :paramtype api_prefix: str """ super().__init__(**kwargs) - self.replica_completion_count = replica_completion_count - self.parallelism = parallelism - + self.api_prefix = api_prefix -class JobConfigurationScheduleTriggerConfig(_serialization.Model): - """Cron formatted repeating trigger schedule ("\\ * * * * *") for cronjobs. Properties completions - and parallelism would be set to 1 by default. - All required parameters must be populated in order to send to server. +class IdentityProviders(_serialization.Model): + """The configuration settings of each of the identity providers used to configure ContainerApp + Service Authentication/Authorization. - :ivar replica_completion_count: Minimum number of successful replica completions before overall - job completion. - :vartype replica_completion_count: int - :ivar cron_expression: Cron formatted repeating schedule ("\\ * * * * *") of a Cron Job. - Required. - :vartype cron_expression: str - :ivar parallelism: Number of parallel replicas of a job that can run at a given time. - :vartype parallelism: int + :ivar azure_active_directory: The configuration settings of the Azure Active directory + provider. + :vartype azure_active_directory: ~azure.mgmt.appcontainers.models.AzureActiveDirectory + :ivar facebook: The configuration settings of the Facebook provider. + :vartype facebook: ~azure.mgmt.appcontainers.models.Facebook + :ivar git_hub: The configuration settings of the GitHub provider. + :vartype git_hub: ~azure.mgmt.appcontainers.models.GitHub + :ivar google: The configuration settings of the Google provider. + :vartype google: ~azure.mgmt.appcontainers.models.Google + :ivar twitter: The configuration settings of the Twitter provider. + :vartype twitter: ~azure.mgmt.appcontainers.models.Twitter + :ivar apple: The configuration settings of the Apple provider. + :vartype apple: ~azure.mgmt.appcontainers.models.Apple + :ivar azure_static_web_apps: The configuration settings of the Azure Static Web Apps provider. + :vartype azure_static_web_apps: ~azure.mgmt.appcontainers.models.AzureStaticWebApps + :ivar custom_open_id_connect_providers: The map of the name of the alias of each custom Open ID + Connect provider to the + configuration settings of the custom Open ID Connect provider. + :vartype custom_open_id_connect_providers: dict[str, + ~azure.mgmt.appcontainers.models.CustomOpenIdConnectProvider] """ - _validation = { + _attribute_map = { + "azure_active_directory": {"key": "azureActiveDirectory", "type": "AzureActiveDirectory"}, + "facebook": {"key": "facebook", "type": "Facebook"}, + "git_hub": {"key": "gitHub", "type": "GitHub"}, + "google": {"key": "google", "type": "Google"}, + "twitter": {"key": "twitter", "type": "Twitter"}, + "apple": {"key": "apple", "type": "Apple"}, + "azure_static_web_apps": {"key": "azureStaticWebApps", "type": "AzureStaticWebApps"}, + "custom_open_id_connect_providers": { + "key": "customOpenIdConnectProviders", + "type": "{CustomOpenIdConnectProvider}", + }, + } + + def __init__( + self, + *, + azure_active_directory: Optional["_models.AzureActiveDirectory"] = None, + facebook: Optional["_models.Facebook"] = None, + git_hub: Optional["_models.GitHub"] = None, + google: Optional["_models.Google"] = None, + twitter: Optional["_models.Twitter"] = None, + apple: Optional["_models.Apple"] = None, + azure_static_web_apps: Optional["_models.AzureStaticWebApps"] = None, + custom_open_id_connect_providers: Optional[Dict[str, "_models.CustomOpenIdConnectProvider"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword azure_active_directory: The configuration settings of the Azure Active directory + provider. + :paramtype azure_active_directory: ~azure.mgmt.appcontainers.models.AzureActiveDirectory + :keyword facebook: The configuration settings of the Facebook provider. + :paramtype facebook: ~azure.mgmt.appcontainers.models.Facebook + :keyword git_hub: The configuration settings of the GitHub provider. + :paramtype git_hub: ~azure.mgmt.appcontainers.models.GitHub + :keyword google: The configuration settings of the Google provider. + :paramtype google: ~azure.mgmt.appcontainers.models.Google + :keyword twitter: The configuration settings of the Twitter provider. + :paramtype twitter: ~azure.mgmt.appcontainers.models.Twitter + :keyword apple: The configuration settings of the Apple provider. + :paramtype apple: ~azure.mgmt.appcontainers.models.Apple + :keyword azure_static_web_apps: The configuration settings of the Azure Static Web Apps + provider. + :paramtype azure_static_web_apps: ~azure.mgmt.appcontainers.models.AzureStaticWebApps + :keyword custom_open_id_connect_providers: The map of the name of the alias of each custom Open + ID Connect provider to the + configuration settings of the custom Open ID Connect provider. + :paramtype custom_open_id_connect_providers: dict[str, + ~azure.mgmt.appcontainers.models.CustomOpenIdConnectProvider] + """ + super().__init__(**kwargs) + self.azure_active_directory = azure_active_directory + self.facebook = facebook + self.git_hub = git_hub + self.google = google + self.twitter = twitter + self.apple = apple + self.azure_static_web_apps = azure_static_web_apps + self.custom_open_id_connect_providers = custom_open_id_connect_providers + + +class IdentitySettings(_serialization.Model): + """Optional settings for a Managed Identity that is assigned to the Container App. + + All required parameters must be populated in order to send to server. + + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. Required. + :vartype identity: str + :ivar lifecycle: Use to select the lifecycle stages of a Container App during which the Managed + Identity should be available. Known values are: "Init", "Main", "None", and "All". + :vartype lifecycle: str or ~azure.mgmt.appcontainers.models.IdentitySettingsLifeCycle + """ + + _validation = { + "identity": {"required": True}, + } + + _attribute_map = { + "identity": {"key": "identity", "type": "str"}, + "lifecycle": {"key": "lifecycle", "type": "str"}, + } + + def __init__( + self, + *, + identity: str, + lifecycle: Optional[Union[str, "_models.IdentitySettingsLifeCycle"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. Required. + :paramtype identity: str + :keyword lifecycle: Use to select the lifecycle stages of a Container App during which the + Managed Identity should be available. Known values are: "Init", "Main", "None", and "All". + :paramtype lifecycle: str or ~azure.mgmt.appcontainers.models.IdentitySettingsLifeCycle + """ + super().__init__(**kwargs) + self.identity = identity + self.lifecycle = lifecycle + + +class Ingress(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Container App Ingress configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar fqdn: Hostname. + :vartype fqdn: str + :ivar external: Bool indicating if app exposes an external http endpoint. + :vartype external: bool + :ivar target_port: Target Port in containers for traffic from ingress. + :vartype target_port: int + :ivar exposed_port: Exposed Port in containers for TCP traffic from ingress. + :vartype exposed_port: int + :ivar transport: Ingress transport protocol. Known values are: "auto", "http", "http2", and + "tcp". + :vartype transport: str or ~azure.mgmt.appcontainers.models.IngressTransportMethod + :ivar traffic: Traffic weights for app's revisions. + :vartype traffic: list[~azure.mgmt.appcontainers.models.TrafficWeight] + :ivar custom_domains: custom domain bindings for Container Apps' hostnames. + :vartype custom_domains: list[~azure.mgmt.appcontainers.models.CustomDomain] + :ivar allow_insecure: Bool indicating if HTTP connections to is allowed. If set to false HTTP + connections are automatically redirected to HTTPS connections. + :vartype allow_insecure: bool + :ivar ip_security_restrictions: Rules to restrict incoming IP address. + :vartype ip_security_restrictions: + list[~azure.mgmt.appcontainers.models.IpSecurityRestrictionRule] + :ivar sticky_sessions: Sticky Sessions for Single Revision Mode. + :vartype sticky_sessions: ~azure.mgmt.appcontainers.models.IngressStickySessions + :ivar client_certificate_mode: Client certificate mode for mTLS authentication. Ignore + indicates server drops client certificate on forwarding. Accept indicates server forwards + client certificate but does not require a client certificate. Require indicates server requires + a client certificate. Known values are: "ignore", "accept", and "require". + :vartype client_certificate_mode: str or + ~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] + :ivar target_port_http_scheme: Whether an http app listens on http or https. Known values are: + "http" and "https". + :vartype target_port_http_scheme: str or + ~azure.mgmt.appcontainers.models.IngressTargetPortHttpScheme + """ + + _validation = { + "fqdn": {"readonly": True}, + } + + _attribute_map = { + "fqdn": {"key": "fqdn", "type": "str"}, + "external": {"key": "external", "type": "bool"}, + "target_port": {"key": "targetPort", "type": "int"}, + "exposed_port": {"key": "exposedPort", "type": "int"}, + "transport": {"key": "transport", "type": "str"}, + "traffic": {"key": "traffic", "type": "[TrafficWeight]"}, + "custom_domains": {"key": "customDomains", "type": "[CustomDomain]"}, + "allow_insecure": {"key": "allowInsecure", "type": "bool"}, + "ip_security_restrictions": {"key": "ipSecurityRestrictions", "type": "[IpSecurityRestrictionRule]"}, + "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]"}, + "target_port_http_scheme": {"key": "targetPortHttpScheme", "type": "str"}, + } + + def __init__( + self, + *, + external: bool = False, + target_port: Optional[int] = None, + exposed_port: Optional[int] = None, + transport: Union[str, "_models.IngressTransportMethod"] = "auto", + traffic: Optional[List["_models.TrafficWeight"]] = None, + custom_domains: Optional[List["_models.CustomDomain"]] = None, + allow_insecure: bool = False, + ip_security_restrictions: Optional[List["_models.IpSecurityRestrictionRule"]] = None, + 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, + target_port_http_scheme: Optional[Union[str, "_models.IngressTargetPortHttpScheme"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword external: Bool indicating if app exposes an external http endpoint. + :paramtype external: bool + :keyword target_port: Target Port in containers for traffic from ingress. + :paramtype target_port: int + :keyword exposed_port: Exposed Port in containers for TCP traffic from ingress. + :paramtype exposed_port: int + :keyword transport: Ingress transport protocol. Known values are: "auto", "http", "http2", and + "tcp". + :paramtype transport: str or ~azure.mgmt.appcontainers.models.IngressTransportMethod + :keyword traffic: Traffic weights for app's revisions. + :paramtype traffic: list[~azure.mgmt.appcontainers.models.TrafficWeight] + :keyword custom_domains: custom domain bindings for Container Apps' hostnames. + :paramtype custom_domains: list[~azure.mgmt.appcontainers.models.CustomDomain] + :keyword allow_insecure: Bool indicating if HTTP connections to is allowed. If set to false + HTTP connections are automatically redirected to HTTPS connections. + :paramtype allow_insecure: bool + :keyword ip_security_restrictions: Rules to restrict incoming IP address. + :paramtype ip_security_restrictions: + list[~azure.mgmt.appcontainers.models.IpSecurityRestrictionRule] + :keyword sticky_sessions: Sticky Sessions for Single Revision Mode. + :paramtype sticky_sessions: ~azure.mgmt.appcontainers.models.IngressStickySessions + :keyword client_certificate_mode: Client certificate mode for mTLS authentication. Ignore + indicates server drops client certificate on forwarding. Accept indicates server forwards + client certificate but does not require a client certificate. Require indicates server requires + a client certificate. Known values are: "ignore", "accept", and "require". + :paramtype client_certificate_mode: str or + ~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] + :keyword target_port_http_scheme: Whether an http app listens on http or https. Known values + are: "http" and "https". + :paramtype target_port_http_scheme: str or + ~azure.mgmt.appcontainers.models.IngressTargetPortHttpScheme + """ + super().__init__(**kwargs) + self.fqdn = None + self.external = external + self.target_port = target_port + self.exposed_port = exposed_port + self.transport = transport + self.traffic = traffic + self.custom_domains = custom_domains + self.allow_insecure = allow_insecure + self.ip_security_restrictions = ip_security_restrictions + self.sticky_sessions = sticky_sessions + self.client_certificate_mode = client_certificate_mode + self.cors_policy = cors_policy + self.additional_port_mappings = additional_port_mappings + self.target_port_http_scheme = target_port_http_scheme + + +class IngressPortMapping(_serialization.Model): + """Port mappings of container app ingress. + + All required parameters must be populated in order to send to server. + + :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): + """Sticky Sessions for Single Revision Mode. + + :ivar affinity: Sticky Session Affinity. Known values are: "sticky" and "none". + :vartype affinity: str or ~azure.mgmt.appcontainers.models.Affinity + """ + + _attribute_map = { + "affinity": {"key": "affinity", "type": "str"}, + } + + def __init__(self, *, affinity: Optional[Union[str, "_models.Affinity"]] = None, **kwargs: Any) -> None: + """ + :keyword affinity: Sticky Session Affinity. Known values are: "sticky" and "none". + :paramtype affinity: str or ~azure.mgmt.appcontainers.models.Affinity + """ + super().__init__(**kwargs) + self.affinity = affinity + + +class InitContainer(BaseContainer): + """Container App init container definition. + + :ivar image: Container image tag. + :vartype image: str + :ivar image_type: The type of the image. Set to CloudBuild to let the system manages the image, + where user will not be able to update image through image field. Set to ContainerImage for user + provided image. Known values are: "CloudBuild" and "ContainerImage". + :vartype image_type: str or ~azure.mgmt.appcontainers.models.ImageType + :ivar name: Custom container name. + :vartype name: str + :ivar command: Container start command. + :vartype command: list[str] + :ivar args: Container start command arguments. + :vartype args: list[str] + :ivar env: Container environment variables. + :vartype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] + :ivar resources: Container resource requirements. + :vartype resources: ~azure.mgmt.appcontainers.models.ContainerResources + :ivar volume_mounts: Container volume mounts. + :vartype volume_mounts: list[~azure.mgmt.appcontainers.models.VolumeMount] + """ + + +class IpSecurityRestrictionRule(_serialization.Model): + """Rule to restrict incoming IP address. + + All required parameters must be populated in order to send to server. + + :ivar name: Name for the IP restriction rule. Required. + :vartype name: str + :ivar description: Describe the IP restriction rule that is being sent to the container-app. + This is an optional field. + :vartype description: str + :ivar ip_address_range: CIDR notation to match incoming IP address. Required. + :vartype ip_address_range: str + :ivar action: Allow or Deny rules to determine for incoming IP. Note: Rules can only consist of + ALL Allow or ALL Deny. Required. Known values are: "Allow" and "Deny". + :vartype action: str or ~azure.mgmt.appcontainers.models.Action + """ + + _validation = { + "name": {"required": True}, + "ip_address_range": {"required": True}, + "action": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "ip_address_range": {"key": "ipAddressRange", "type": "str"}, + "action": {"key": "action", "type": "str"}, + } + + def __init__( + self, + *, + name: str, + ip_address_range: str, + action: Union[str, "_models.Action"], + description: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name for the IP restriction rule. Required. + :paramtype name: str + :keyword description: Describe the IP restriction rule that is being sent to the container-app. + This is an optional field. + :paramtype description: str + :keyword ip_address_range: CIDR notation to match incoming IP address. Required. + :paramtype ip_address_range: str + :keyword action: Allow or Deny rules to determine for incoming IP. Note: Rules can only consist + of ALL Allow or ALL Deny. Required. Known values are: "Allow" and "Deny". + :paramtype action: str or ~azure.mgmt.appcontainers.models.Action + """ + super().__init__(**kwargs) + self.name = name + self.description = description + self.ip_address_range = ip_address_range + self.action = action + + +class JavaComponent(ProxyResource): + """Java Component. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar properties: Java Component resource specific properties. + :vartype properties: ~azure.mgmt.appcontainers.models.JavaComponentProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "JavaComponentProperties"}, + } + + def __init__(self, *, properties: Optional["_models.JavaComponentProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Java Component resource specific properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.JavaComponentProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class JavaComponentConfigurationProperty(_serialization.Model): + """Configuration properties for a Java Component. + + :ivar property_name: The name of the property. + :vartype property_name: str + :ivar value: The value of the property. + :vartype value: str + """ + + _attribute_map = { + "property_name": {"key": "propertyName", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, property_name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword property_name: The name of the property. + :paramtype property_name: str + :keyword value: The value of the property. + :paramtype value: str + """ + super().__init__(**kwargs) + self.property_name = property_name + self.value = value + + +class JavaComponentIngress(_serialization.Model): + """Container App Ingress configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar fqdn: Hostname of the Java Component endpoint. + :vartype fqdn: str + """ + + _validation = { + "fqdn": {"readonly": True}, + } + + _attribute_map = { + "fqdn": {"key": "fqdn", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.fqdn = None + + +class JavaComponentProperties(_serialization.Model): + """Java Component common properties. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + NacosComponent, SpringBootAdminComponent, SpringCloudConfigComponent, + SpringCloudEurekaComponent, SpringCloudGatewayComponent + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar component_type: Type of the Java Component. Required. Known values are: + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :ivar provisioning_state: Provisioning state of the Java Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState + :ivar configurations: List of Java Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar scale: Java component scaling configurations. + :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :ivar service_binds: List of Java Components that are bound to the Java component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + """ + + _validation = { + "component_type": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "component_type": {"key": "componentType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "configurations": {"key": "configurations", "type": "[JavaComponentConfigurationProperty]"}, + "scale": {"key": "scale", "type": "JavaComponentPropertiesScale"}, + "service_binds": {"key": "serviceBinds", "type": "[JavaComponentServiceBind]"}, + } + + _subtype_map = { + "component_type": { + "Nacos": "NacosComponent", + "SpringBootAdmin": "SpringBootAdminComponent", + "SpringCloudConfig": "SpringCloudConfigComponent", + "SpringCloudEureka": "SpringCloudEurekaComponent", + "SpringCloudGateway": "SpringCloudGatewayComponent", + } + } + + def __init__( + self, + *, + configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + scale: Optional["_models.JavaComponentPropertiesScale"] = None, + service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword configurations: List of Java Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :keyword scale: Java component scaling configurations. + :paramtype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :keyword service_binds: List of Java Components that are bound to the Java component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + """ + super().__init__(**kwargs) + self.component_type: Optional[str] = None + self.provisioning_state = None + self.configurations = configurations + self.scale = scale + self.service_binds = service_binds + + +class JavaComponentPropertiesScale(_serialization.Model): + """Java component scaling configurations. + + :ivar min_replicas: Optional. Minimum number of Java component replicas. Defaults to 1 if not + set. + :vartype min_replicas: int + :ivar max_replicas: Optional. Maximum number of Java component replicas. + :vartype max_replicas: int + """ + + _attribute_map = { + "min_replicas": {"key": "minReplicas", "type": "int"}, + "max_replicas": {"key": "maxReplicas", "type": "int"}, + } + + def __init__( + self, *, min_replicas: Optional[int] = None, max_replicas: Optional[int] = None, **kwargs: Any + ) -> None: + """ + :keyword min_replicas: Optional. Minimum number of Java component replicas. Defaults to 1 if + not set. + :paramtype min_replicas: int + :keyword max_replicas: Optional. Maximum number of Java component replicas. + :paramtype max_replicas: int + """ + super().__init__(**kwargs) + self.min_replicas = min_replicas + self.max_replicas = max_replicas + + +class JavaComponentsCollection(_serialization.Model): + """Java 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 server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.JavaComponent] + :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": "[JavaComponent]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.JavaComponent"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.JavaComponent] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class JavaComponentServiceBind(_serialization.Model): + """Configuration to bind a Java Component to another Java Component. + + :ivar name: Name of the service bind. + :vartype name: str + :ivar service_id: Resource id of the target service. + :vartype service_id: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "service_id": {"key": "serviceId", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, service_id: Optional[str] = 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 + """ + super().__init__(**kwargs) + self.name = name + self.service_id = service_id + + +class Job(TrackedResource): # pylint: disable=too-many-instance-attributes + """Container App Job. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar tags: Resource tags. + :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 + :ivar provisioning_state: Provisioning state of the Container Apps Job. Known values are: + "InProgress", "Succeeded", "Failed", "Canceled", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.JobProvisioningState + :ivar running_state: Current running state of the job. Known values are: "Ready", + "Progressing", and "Suspended". + :vartype running_state: str or ~azure.mgmt.appcontainers.models.JobRunningState + :ivar environment_id: Resource ID of environment. + :vartype environment_id: str + :ivar workload_profile_name: Workload profile name to pin for container apps job execution. + :vartype workload_profile_name: str + :ivar configuration: Container Apps Job configuration properties. + :vartype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration + :ivar template: Container Apps job definition. + :vartype template: ~azure.mgmt.appcontainers.models.JobTemplate + :ivar outbound_ip_addresses: Outbound IP Addresses of a container apps job. + :vartype outbound_ip_addresses: list[str] + :ivar event_stream_endpoint: The endpoint of the eventstream of the container apps job. + :vartype event_stream_endpoint: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "running_state": {"readonly": True}, + "outbound_ip_addresses": {"readonly": True}, + "event_stream_endpoint": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "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"}, + "running_state": {"key": "properties.runningState", "type": "str"}, + "environment_id": {"key": "properties.environmentId", "type": "str"}, + "workload_profile_name": {"key": "properties.workloadProfileName", "type": "str"}, + "configuration": {"key": "properties.configuration", "type": "JobConfiguration"}, + "template": {"key": "properties.template", "type": "JobTemplate"}, + "outbound_ip_addresses": {"key": "properties.outboundIpAddresses", "type": "[str]"}, + "event_stream_endpoint": {"key": "properties.eventStreamEndpoint", "type": "str"}, + } + + def __init__( + self, + *, + 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, + configuration: Optional["_models.JobConfiguration"] = None, + template: Optional["_models.JobTemplate"] = 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 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 + :keyword environment_id: Resource ID of environment. + :paramtype environment_id: str + :keyword workload_profile_name: Workload profile name to pin for container apps job execution. + :paramtype workload_profile_name: str + :keyword configuration: Container Apps Job configuration properties. + :paramtype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration + :keyword template: Container Apps job definition. + :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.running_state = None + self.environment_id = environment_id + self.workload_profile_name = workload_profile_name + self.configuration = configuration + self.template = template + self.outbound_ip_addresses = None + self.event_stream_endpoint = None + + +class JobConfiguration(_serialization.Model): + """Non versioned Container Apps Job configuration properties. + + All required parameters must be populated in order to send to server. + + :ivar secrets: Collection of secrets used by a Container Apps Job. + :vartype secrets: list[~azure.mgmt.appcontainers.models.Secret] + :ivar trigger_type: Trigger type of the job. Known values are: "Schedule", "Event", and + "Manual". + :vartype trigger_type: str or ~azure.mgmt.appcontainers.models.TriggerType + :ivar replica_timeout: Maximum number of seconds a replica is allowed to run. Required. + :vartype replica_timeout: int + :ivar replica_retry_limit: Maximum number of retries before failing the job. + :vartype replica_retry_limit: int + :ivar manual_trigger_config: Manual trigger configuration for a single execution job. + Properties replicaCompletionCount and parallelism would be set to 1 by default. + :vartype manual_trigger_config: + ~azure.mgmt.appcontainers.models.JobConfigurationManualTriggerConfig + :ivar schedule_trigger_config: Cron formatted repeating trigger schedule ("\\ * * * * *") for + cronjobs. Properties completions and parallelism would be set to 1 by default. + :vartype schedule_trigger_config: + ~azure.mgmt.appcontainers.models.JobConfigurationScheduleTriggerConfig + :ivar event_trigger_config: Trigger configuration of an event driven job. + :vartype event_trigger_config: + ~azure.mgmt.appcontainers.models.JobConfigurationEventTriggerConfig + :ivar registries: Collection of private container registry credentials used by a Container apps + job. + :vartype registries: list[~azure.mgmt.appcontainers.models.RegistryCredentials] + :ivar identity_settings: Optional settings for Managed Identities that are assigned to the + Container App Job. If a Managed Identity is not specified here, default settings will be used. + :vartype identity_settings: list[~azure.mgmt.appcontainers.models.IdentitySettings] + """ + + _validation = { + "trigger_type": {"required": True}, + "replica_timeout": {"required": True}, + } + + _attribute_map = { + "secrets": {"key": "secrets", "type": "[Secret]"}, + "trigger_type": {"key": "triggerType", "type": "str"}, + "replica_timeout": {"key": "replicaTimeout", "type": "int"}, + "replica_retry_limit": {"key": "replicaRetryLimit", "type": "int"}, + "manual_trigger_config": {"key": "manualTriggerConfig", "type": "JobConfigurationManualTriggerConfig"}, + "schedule_trigger_config": {"key": "scheduleTriggerConfig", "type": "JobConfigurationScheduleTriggerConfig"}, + "event_trigger_config": {"key": "eventTriggerConfig", "type": "JobConfigurationEventTriggerConfig"}, + "registries": {"key": "registries", "type": "[RegistryCredentials]"}, + "identity_settings": {"key": "identitySettings", "type": "[IdentitySettings]"}, + } + + def __init__( + self, + *, + trigger_type: Union[str, "_models.TriggerType"] = "Manual", + replica_timeout: int, + secrets: Optional[List["_models.Secret"]] = None, + replica_retry_limit: Optional[int] = None, + manual_trigger_config: Optional["_models.JobConfigurationManualTriggerConfig"] = None, + schedule_trigger_config: Optional["_models.JobConfigurationScheduleTriggerConfig"] = None, + event_trigger_config: Optional["_models.JobConfigurationEventTriggerConfig"] = None, + registries: Optional[List["_models.RegistryCredentials"]] = None, + identity_settings: Optional[List["_models.IdentitySettings"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword secrets: Collection of secrets used by a Container Apps Job. + :paramtype secrets: list[~azure.mgmt.appcontainers.models.Secret] + :keyword trigger_type: Trigger type of the job. Known values are: "Schedule", "Event", and + "Manual". + :paramtype trigger_type: str or ~azure.mgmt.appcontainers.models.TriggerType + :keyword replica_timeout: Maximum number of seconds a replica is allowed to run. Required. + :paramtype replica_timeout: int + :keyword replica_retry_limit: Maximum number of retries before failing the job. + :paramtype replica_retry_limit: int + :keyword manual_trigger_config: Manual trigger configuration for a single execution job. + Properties replicaCompletionCount and parallelism would be set to 1 by default. + :paramtype manual_trigger_config: + ~azure.mgmt.appcontainers.models.JobConfigurationManualTriggerConfig + :keyword schedule_trigger_config: Cron formatted repeating trigger schedule ("\\ * * * * *") + for cronjobs. Properties completions and parallelism would be set to 1 by default. + :paramtype schedule_trigger_config: + ~azure.mgmt.appcontainers.models.JobConfigurationScheduleTriggerConfig + :keyword event_trigger_config: Trigger configuration of an event driven job. + :paramtype event_trigger_config: + ~azure.mgmt.appcontainers.models.JobConfigurationEventTriggerConfig + :keyword registries: Collection of private container registry credentials used by a Container + apps job. + :paramtype registries: list[~azure.mgmt.appcontainers.models.RegistryCredentials] + :keyword identity_settings: Optional settings for Managed Identities that are assigned to the + Container App Job. If a Managed Identity is not specified here, default settings will be used. + :paramtype identity_settings: list[~azure.mgmt.appcontainers.models.IdentitySettings] + """ + super().__init__(**kwargs) + self.secrets = secrets + self.trigger_type = trigger_type + self.replica_timeout = replica_timeout + self.replica_retry_limit = replica_retry_limit + self.manual_trigger_config = manual_trigger_config + self.schedule_trigger_config = schedule_trigger_config + self.event_trigger_config = event_trigger_config + self.registries = registries + self.identity_settings = identity_settings + + +class JobConfigurationEventTriggerConfig(_serialization.Model): + """Trigger configuration of an event driven job. + + :ivar replica_completion_count: Minimum number of successful replica completions before overall + job completion. + :vartype replica_completion_count: int + :ivar parallelism: Number of parallel replicas of a job that can run at a given time. + :vartype parallelism: int + :ivar scale: Scaling configurations for event driven jobs. + :vartype scale: ~azure.mgmt.appcontainers.models.JobScale + """ + + _attribute_map = { + "replica_completion_count": {"key": "replicaCompletionCount", "type": "int"}, + "parallelism": {"key": "parallelism", "type": "int"}, + "scale": {"key": "scale", "type": "JobScale"}, + } + + def __init__( + self, + *, + replica_completion_count: Optional[int] = None, + parallelism: Optional[int] = None, + scale: Optional["_models.JobScale"] = None, + **kwargs: Any + ) -> None: + """ + :keyword replica_completion_count: Minimum number of successful replica completions before + overall job completion. + :paramtype replica_completion_count: int + :keyword parallelism: Number of parallel replicas of a job that can run at a given time. + :paramtype parallelism: int + :keyword scale: Scaling configurations for event driven jobs. + :paramtype scale: ~azure.mgmt.appcontainers.models.JobScale + """ + super().__init__(**kwargs) + self.replica_completion_count = replica_completion_count + self.parallelism = parallelism + self.scale = scale + + +class JobConfigurationManualTriggerConfig(_serialization.Model): + """Manual trigger configuration for a single execution job. Properties replicaCompletionCount and + parallelism would be set to 1 by default. + + :ivar replica_completion_count: Minimum number of successful replica completions before overall + job completion. + :vartype replica_completion_count: int + :ivar parallelism: Number of parallel replicas of a job that can run at a given time. + :vartype parallelism: int + """ + + _attribute_map = { + "replica_completion_count": {"key": "replicaCompletionCount", "type": "int"}, + "parallelism": {"key": "parallelism", "type": "int"}, + } + + def __init__( + self, *, replica_completion_count: Optional[int] = None, parallelism: Optional[int] = None, **kwargs: Any + ) -> None: + """ + :keyword replica_completion_count: Minimum number of successful replica completions before + overall job completion. + :paramtype replica_completion_count: int + :keyword parallelism: Number of parallel replicas of a job that can run at a given time. + :paramtype parallelism: int + """ + super().__init__(**kwargs) + self.replica_completion_count = replica_completion_count + self.parallelism = parallelism + + +class JobConfigurationScheduleTriggerConfig(_serialization.Model): + """Cron formatted repeating trigger schedule ("\\ * * * * *") for cronjobs. Properties completions + and parallelism would be set to 1 by default. + + All required parameters must be populated in order to send to server. + + :ivar replica_completion_count: Minimum number of successful replica completions before overall + job completion. + :vartype replica_completion_count: int + :ivar cron_expression: Cron formatted repeating schedule ("\\ * * * * *") of a Cron Job. + Required. + :vartype cron_expression: str + :ivar parallelism: Number of parallel replicas of a job that can run at a given time. + :vartype parallelism: int + """ + + _validation = { "cron_expression": {"required": True}, } _attribute_map = { - "replica_completion_count": {"key": "replicaCompletionCount", "type": "int"}, - "cron_expression": {"key": "cronExpression", "type": "str"}, - "parallelism": {"key": "parallelism", "type": "int"}, + "replica_completion_count": {"key": "replicaCompletionCount", "type": "int"}, + "cron_expression": {"key": "cronExpression", "type": "str"}, + "parallelism": {"key": "parallelism", "type": "int"}, + } + + def __init__( + self, + *, + cron_expression: str, + replica_completion_count: Optional[int] = None, + parallelism: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword replica_completion_count: Minimum number of successful replica completions before + overall job completion. + :paramtype replica_completion_count: int + :keyword cron_expression: Cron formatted repeating schedule ("\\ * * * * *") of a Cron Job. + Required. + :paramtype cron_expression: str + :keyword parallelism: Number of parallel replicas of a job that can run at a given time. + :paramtype parallelism: int + """ + super().__init__(**kwargs) + self.replica_completion_count = replica_completion_count + self.cron_expression = cron_expression + self.parallelism = parallelism + + +class JobExecution(_serialization.Model): + """Container Apps Job execution. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Job execution Name. + :vartype name: str + :ivar id: Job execution Id. + :vartype id: str + :ivar type: Job execution type. + :vartype type: str + :ivar status: Current running State of the job. Known values are: "Running", "Processing", + "Stopped", "Degraded", "Failed", "Unknown", and "Succeeded". + :vartype status: str or ~azure.mgmt.appcontainers.models.JobExecutionRunningState + :ivar start_time: Job execution start time. + :vartype start_time: ~datetime.datetime + :ivar end_time: Job execution end time. + :vartype end_time: ~datetime.datetime + :ivar template: Job's execution container. + :vartype template: ~azure.mgmt.appcontainers.models.JobExecutionTemplate + :ivar detailed_status: Detailed status of the job execution. + :vartype detailed_status: ~azure.mgmt.appcontainers.models.ExecutionStatus + """ + + _validation = { + "status": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "start_time": {"key": "properties.startTime", "type": "iso-8601"}, + "end_time": {"key": "properties.endTime", "type": "iso-8601"}, + "template": {"key": "properties.template", "type": "JobExecutionTemplate"}, + "detailed_status": {"key": "properties.detailedStatus", "type": "ExecutionStatus"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + type: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + template: Optional["_models.JobExecutionTemplate"] = None, + detailed_status: Optional["_models.ExecutionStatus"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Job execution Name. + :paramtype name: str + :keyword id: Job execution Id. + :paramtype id: str + :keyword type: Job execution type. + :paramtype type: str + :keyword start_time: Job execution start time. + :paramtype start_time: ~datetime.datetime + :keyword end_time: Job execution end time. + :paramtype end_time: ~datetime.datetime + :keyword template: Job's execution container. + :paramtype template: ~azure.mgmt.appcontainers.models.JobExecutionTemplate + :keyword detailed_status: Detailed status of the job execution. + :paramtype detailed_status: ~azure.mgmt.appcontainers.models.ExecutionStatus + """ + super().__init__(**kwargs) + self.name = name + self.id = id + self.type = type + self.status = None + self.start_time = start_time + self.end_time = end_time + self.template = template + self.detailed_status = detailed_status + + +class JobExecutionBase(_serialization.Model): + """Container App's Job execution name. + + :ivar name: Job execution name. + :vartype name: str + :ivar id: Job execution Id. + :vartype id: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + **kwargs: Any + ) -> None: + """ + :keyword name: Job execution name. + :paramtype name: str + :keyword id: Job execution Id. + :paramtype id: str + """ + super().__init__(**kwargs) + self.name = name + self.id = id + + +class JobExecutionContainer(_serialization.Model): + """Container Apps Jobs execution container definition. + + :ivar image: Container image tag. + :vartype image: str + :ivar name: Custom container name. + :vartype name: str + :ivar command: Container start command. + :vartype command: list[str] + :ivar args: Container start command arguments. + :vartype args: list[str] + :ivar env: Container environment variables. + :vartype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] + :ivar resources: Container resource requirements. + :vartype resources: ~azure.mgmt.appcontainers.models.ContainerResources + """ + + _attribute_map = { + "image": {"key": "image", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "command": {"key": "command", "type": "[str]"}, + "args": {"key": "args", "type": "[str]"}, + "env": {"key": "env", "type": "[EnvironmentVar]"}, + "resources": {"key": "resources", "type": "ContainerResources"}, + } + + def __init__( + self, + *, + image: Optional[str] = None, + name: Optional[str] = None, + command: Optional[List[str]] = None, + args: Optional[List[str]] = None, + env: Optional[List["_models.EnvironmentVar"]] = None, + resources: Optional["_models.ContainerResources"] = None, + **kwargs: Any + ) -> None: + """ + :keyword image: Container image tag. + :paramtype image: str + :keyword name: Custom container name. + :paramtype name: str + :keyword command: Container start command. + :paramtype command: list[str] + :keyword args: Container start command arguments. + :paramtype args: list[str] + :keyword env: Container environment variables. + :paramtype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] + :keyword resources: Container resource requirements. + :paramtype resources: ~azure.mgmt.appcontainers.models.ContainerResources + """ + super().__init__(**kwargs) + self.image = image + self.name = name + self.command = command + self.args = args + self.env = env + self.resources = resources + + +class JobExecutionNamesCollection(_serialization.Model): + """Container App executions names list. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.JobExecutionBase] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[JobExecutionBase]"}, + } + + def __init__(self, *, value: List["_models.JobExecutionBase"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.JobExecutionBase] + """ + super().__init__(**kwargs) + self.value = value + + +class JobExecutionTemplate(_serialization.Model): + """Job's execution template, containing container configuration for a job's execution. + + :ivar containers: List of container definitions for the Container Apps Job. + :vartype containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] + :ivar init_containers: List of specialized containers that run before job containers. + :vartype init_containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] + """ + + _attribute_map = { + "containers": {"key": "containers", "type": "[JobExecutionContainer]"}, + "init_containers": {"key": "initContainers", "type": "[JobExecutionContainer]"}, + } + + def __init__( + self, + *, + containers: Optional[List["_models.JobExecutionContainer"]] = None, + init_containers: Optional[List["_models.JobExecutionContainer"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword containers: List of container definitions for the Container Apps Job. + :paramtype containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] + :keyword init_containers: List of specialized containers that run before job containers. + :paramtype init_containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] + """ + super().__init__(**kwargs) + self.containers = containers + self.init_containers = init_containers + + +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 + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: + :vartype properties: ~azure.mgmt.appcontainers.models.JobPatchPropertiesProperties + """ + + _attribute_map = { + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "JobPatchPropertiesProperties"}, + } + + 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 + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: + :paramtype properties: ~azure.mgmt.appcontainers.models.JobPatchPropertiesProperties + """ + super().__init__(**kwargs) + self.extended_location = extended_location + self.identity = identity + self.tags = tags + self.properties = properties + + +class JobPatchPropertiesProperties(_serialization.Model): + """JobPatchPropertiesProperties. + + :ivar environment_id: Resource ID of environment. + :vartype environment_id: str + :ivar configuration: Container Apps Job configuration properties. + :vartype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration + :ivar template: Container Apps job definition. + :vartype template: ~azure.mgmt.appcontainers.models.JobTemplate + :ivar outbound_ip_addresses: Outbound IP Addresses of a container apps job. + :vartype outbound_ip_addresses: list[str] + :ivar event_stream_endpoint: The endpoint of the eventstream of the container apps job. + :vartype event_stream_endpoint: str + """ + + _attribute_map = { + "environment_id": {"key": "environmentId", "type": "str"}, + "configuration": {"key": "configuration", "type": "JobConfiguration"}, + "template": {"key": "template", "type": "JobTemplate"}, + "outbound_ip_addresses": {"key": "outboundIpAddresses", "type": "[str]"}, + "event_stream_endpoint": {"key": "eventStreamEndpoint", "type": "str"}, + } + + def __init__( + self, + *, + environment_id: Optional[str] = None, + configuration: Optional["_models.JobConfiguration"] = None, + template: Optional["_models.JobTemplate"] = None, + outbound_ip_addresses: Optional[List[str]] = None, + event_stream_endpoint: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword environment_id: Resource ID of environment. + :paramtype environment_id: str + :keyword configuration: Container Apps Job configuration properties. + :paramtype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration + :keyword template: Container Apps job definition. + :paramtype template: ~azure.mgmt.appcontainers.models.JobTemplate + :keyword outbound_ip_addresses: Outbound IP Addresses of a container apps job. + :paramtype outbound_ip_addresses: list[str] + :keyword event_stream_endpoint: The endpoint of the eventstream of the container apps job. + :paramtype event_stream_endpoint: str + """ + super().__init__(**kwargs) + self.environment_id = environment_id + self.configuration = configuration + self.template = template + self.outbound_ip_addresses = outbound_ip_addresses + self.event_stream_endpoint = event_stream_endpoint + + +class JobScale(_serialization.Model): + """Scaling configurations for event driven jobs. + + :ivar polling_interval: Interval to check each event source in seconds. Defaults to 30s. + :vartype polling_interval: int + :ivar min_executions: Minimum number of job executions that are created for a trigger, default + 0. + :vartype min_executions: int + :ivar max_executions: Maximum number of job executions that are created for a trigger, default + 100. + :vartype max_executions: int + :ivar rules: Scaling rules. + :vartype rules: list[~azure.mgmt.appcontainers.models.JobScaleRule] + """ + + _attribute_map = { + "polling_interval": {"key": "pollingInterval", "type": "int"}, + "min_executions": {"key": "minExecutions", "type": "int"}, + "max_executions": {"key": "maxExecutions", "type": "int"}, + "rules": {"key": "rules", "type": "[JobScaleRule]"}, + } + + def __init__( + self, + *, + polling_interval: Optional[int] = None, + min_executions: int = 0, + max_executions: int = 100, + rules: Optional[List["_models.JobScaleRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword polling_interval: Interval to check each event source in seconds. Defaults to 30s. + :paramtype polling_interval: int + :keyword min_executions: Minimum number of job executions that are created for a trigger, + default 0. + :paramtype min_executions: int + :keyword max_executions: Maximum number of job executions that are created for a trigger, + default 100. + :paramtype max_executions: int + :keyword rules: Scaling rules. + :paramtype rules: list[~azure.mgmt.appcontainers.models.JobScaleRule] + """ + super().__init__(**kwargs) + self.polling_interval = polling_interval + self.min_executions = min_executions + self.max_executions = max_executions + self.rules = rules + + +class JobScaleRule(_serialization.Model): + """Scaling rule. + + :ivar name: Scale Rule Name. + :vartype name: str + :ivar type: Type of the scale rule + eg: azure-servicebus, redis etc. + :vartype type: str + :ivar metadata: Metadata properties to describe the scale rule. + :vartype metadata: JSON + :ivar auth: Authentication secrets for the scale rule. + :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + job, or 'system' for system-assigned identity. + :vartype identity: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "metadata": {"key": "metadata", "type": "object"}, + "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "identity": {"key": "identity", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + metadata: Optional[JSON] = None, + auth: Optional[List["_models.ScaleRuleAuth"]] = None, + identity: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Scale Rule Name. + :paramtype name: str + :keyword type: Type of the scale rule + eg: azure-servicebus, redis etc. + :paramtype type: str + :keyword metadata: Metadata properties to describe the scale rule. + :paramtype metadata: JSON + :keyword auth: Authentication secrets for the scale rule. + :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + job, or 'system' for system-assigned identity. + :paramtype identity: str + """ + super().__init__(**kwargs) + self.name = name + self.type = type + self.metadata = metadata + self.auth = auth + self.identity = identity + + +class JobsCollection(_serialization.Model): + """Container Apps Jobs collection ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.Job] + :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": "[Job]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Job"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.Job] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class JobSecretsCollection(_serialization.Model): + """Container Apps Job Secrets Collection ARM resource. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.Secret] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Secret]"}, + } + + def __init__(self, *, value: List["_models.Secret"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.Secret] + """ + super().__init__(**kwargs) + self.value = value + + +class JobTemplate(_serialization.Model): + """Container Apps Job versioned application definition. Defines the desired state of an immutable + revision. Any changes to this section Will result in a new revision being created. + + :ivar init_containers: List of specialized containers that run before app containers. + :vartype init_containers: list[~azure.mgmt.appcontainers.models.InitContainer] + :ivar containers: List of container definitions for the Container App. + :vartype containers: list[~azure.mgmt.appcontainers.models.Container] + :ivar volumes: List of volume definitions for the Container App. + :vartype volumes: list[~azure.mgmt.appcontainers.models.Volume] + """ + + _attribute_map = { + "init_containers": {"key": "initContainers", "type": "[InitContainer]"}, + "containers": {"key": "containers", "type": "[Container]"}, + "volumes": {"key": "volumes", "type": "[Volume]"}, + } + + def __init__( + self, + *, + init_containers: Optional[List["_models.InitContainer"]] = None, + containers: Optional[List["_models.Container"]] = None, + volumes: Optional[List["_models.Volume"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword init_containers: List of specialized containers that run before app containers. + :paramtype init_containers: list[~azure.mgmt.appcontainers.models.InitContainer] + :keyword containers: List of container definitions for the Container App. + :paramtype containers: list[~azure.mgmt.appcontainers.models.Container] + :keyword volumes: List of volume definitions for the Container App. + :paramtype volumes: list[~azure.mgmt.appcontainers.models.Volume] + """ + super().__init__(**kwargs) + self.init_containers = init_containers + self.containers = containers + self.volumes = volumes + + +class JwtClaimChecks(_serialization.Model): + """The configuration settings of the checks that should be made while validating the JWT Claims. + + :ivar allowed_groups: The list of the allowed groups. + :vartype allowed_groups: list[str] + :ivar allowed_client_applications: The list of the allowed client applications. + :vartype allowed_client_applications: list[str] + """ + + _attribute_map = { + "allowed_groups": {"key": "allowedGroups", "type": "[str]"}, + "allowed_client_applications": {"key": "allowedClientApplications", "type": "[str]"}, + } + + def __init__( + self, + *, + allowed_groups: Optional[List[str]] = None, + allowed_client_applications: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword allowed_groups: The list of the allowed groups. + :paramtype allowed_groups: list[str] + :keyword allowed_client_applications: The list of the allowed client applications. + :paramtype allowed_client_applications: list[str] + """ + super().__init__(**kwargs) + self.allowed_groups = allowed_groups + self.allowed_client_applications = allowed_client_applications + + +class KedaConfiguration(_serialization.Model): + """Configuration properties Keda component. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar version: The version of Keda. + :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 LabelHistory(ProxyResource): + """Container App Label History. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar properties: Container App Label History resource specific properties. + :vartype properties: ~azure.mgmt.appcontainers.models.LabelHistoryProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "LabelHistoryProperties"}, + } + + def __init__(self, *, properties: Optional["_models.LabelHistoryProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Container App Label History resource specific properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.LabelHistoryProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class LabelHistoryCollection(_serialization.Model): + """Container App Label History collection ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.LabelHistory] + :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": "[LabelHistory]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.LabelHistory"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.LabelHistory] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class LabelHistoryProperties(_serialization.Model): + """Container App Label History resource specific properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar records: List of label history records. + :vartype records: list[~azure.mgmt.appcontainers.models.LabelHistoryRecordItem] + """ + + _validation = { + "records": {"readonly": True}, + } + + _attribute_map = { + "records": {"key": "records", "type": "[LabelHistoryRecordItem]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.records = None + + +class LabelHistoryRecordItem(_serialization.Model): + """Container App Label History Item resource specific properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar revision: Container App revision name that label was applied to. + :vartype revision: str + :ivar start: Timestamp describing when the label was applied to the revision. + :vartype start: ~datetime.datetime + :ivar stop: Timestamp describing when the label was removed from the revision. Only meaningful + when the label is currently applied to the revision. + :vartype stop: ~datetime.datetime + """ + + _validation = { + "revision": {"readonly": True}, + "start": {"readonly": True}, + "stop": {"readonly": True}, + } + + _attribute_map = { + "revision": {"key": "revision", "type": "str"}, + "start": {"key": "start", "type": "iso-8601"}, + "stop": {"key": "stop", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.revision = None + self.start = None + self.stop = 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'. + + :ivar customer_id: Log analytics customer id. + :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, + 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 LoggerSetting(_serialization.Model): + """Logger settings for java workloads. + + All required parameters must be populated in order to send to server. + + :ivar logger: Logger name. Required. + :vartype logger: str + :ivar level: The specified logger's log level. Required. Known values are: "off", "error", + "info", "debug", "trace", and "warn". + :vartype level: str or ~azure.mgmt.appcontainers.models.Level + """ + + _validation = { + "logger": {"required": True}, + "level": {"required": True}, + } + + _attribute_map = { + "logger": {"key": "logger", "type": "str"}, + "level": {"key": "level", "type": "str"}, + } + + def __init__(self, *, logger: str, level: Union[str, "_models.Level"], **kwargs: Any) -> None: + """ + :keyword logger: Logger name. Required. + :paramtype logger: str + :keyword level: The specified logger's log level. Required. Known values are: "off", "error", + "info", "debug", "trace", and "warn". + :paramtype level: str or ~azure.mgmt.appcontainers.models.Level + """ + super().__init__(**kwargs) + self.logger = logger + self.level = level + + +class LogicApp(ProxyResource): + """A logic app extension resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: JSON + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "object"}, + } + + def __init__(self, *, properties: Optional[JSON] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: JSON + """ + super().__init__(**kwargs) + self.properties = properties + + +class Login(_serialization.Model): + """The configuration settings of the login flow of users using ContainerApp Service + Authentication/Authorization. + + :ivar routes: The routes that specify the endpoints used for login and logout requests. + :vartype routes: ~azure.mgmt.appcontainers.models.LoginRoutes + :ivar token_store: The configuration settings of the token store. + :vartype token_store: ~azure.mgmt.appcontainers.models.TokenStore + :ivar preserve_url_fragments_for_logins: :code:`true` if the fragments from the + request are preserved after the login request is made; otherwise, :code:`false`. + :vartype preserve_url_fragments_for_logins: bool + :ivar allowed_external_redirect_urls: External URLs that can be redirected to as part of + logging in or logging out of the app. Note that the query string part of the URL is ignored. + This is an advanced setting typically only needed by Windows Store application backends. + Note that URLs within the current domain are always implicitly allowed. + :vartype allowed_external_redirect_urls: list[str] + :ivar cookie_expiration: The configuration settings of the session cookie's expiration. + :vartype cookie_expiration: ~azure.mgmt.appcontainers.models.CookieExpiration + :ivar nonce: The configuration settings of the nonce used in the login flow. + :vartype nonce: ~azure.mgmt.appcontainers.models.Nonce + """ + + _attribute_map = { + "routes": {"key": "routes", "type": "LoginRoutes"}, + "token_store": {"key": "tokenStore", "type": "TokenStore"}, + "preserve_url_fragments_for_logins": {"key": "preserveUrlFragmentsForLogins", "type": "bool"}, + "allowed_external_redirect_urls": {"key": "allowedExternalRedirectUrls", "type": "[str]"}, + "cookie_expiration": {"key": "cookieExpiration", "type": "CookieExpiration"}, + "nonce": {"key": "nonce", "type": "Nonce"}, + } + + def __init__( + self, + *, + routes: Optional["_models.LoginRoutes"] = None, + token_store: Optional["_models.TokenStore"] = None, + preserve_url_fragments_for_logins: Optional[bool] = None, + allowed_external_redirect_urls: Optional[List[str]] = None, + cookie_expiration: Optional["_models.CookieExpiration"] = None, + nonce: Optional["_models.Nonce"] = None, + **kwargs: Any + ) -> None: + """ + :keyword routes: The routes that specify the endpoints used for login and logout requests. + :paramtype routes: ~azure.mgmt.appcontainers.models.LoginRoutes + :keyword token_store: The configuration settings of the token store. + :paramtype token_store: ~azure.mgmt.appcontainers.models.TokenStore + :keyword preserve_url_fragments_for_logins: :code:`true` if the fragments from the + request are preserved after the login request is made; otherwise, :code:`false`. + :paramtype preserve_url_fragments_for_logins: bool + :keyword allowed_external_redirect_urls: External URLs that can be redirected to as part of + logging in or logging out of the app. Note that the query string part of the URL is ignored. + This is an advanced setting typically only needed by Windows Store application backends. + Note that URLs within the current domain are always implicitly allowed. + :paramtype allowed_external_redirect_urls: list[str] + :keyword cookie_expiration: The configuration settings of the session cookie's expiration. + :paramtype cookie_expiration: ~azure.mgmt.appcontainers.models.CookieExpiration + :keyword nonce: The configuration settings of the nonce used in the login flow. + :paramtype nonce: ~azure.mgmt.appcontainers.models.Nonce + """ + 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 + self.nonce = nonce + + +class LoginRoutes(_serialization.Model): + """The routes that specify the endpoints used for login and logout requests. + + :ivar logout_endpoint: The endpoint at which a logout request should be made. + :vartype logout_endpoint: str + """ + + _attribute_map = { + "logout_endpoint": {"key": "logoutEndpoint", "type": "str"}, + } + + def __init__(self, *, logout_endpoint: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword logout_endpoint: The endpoint at which a logout request should be made. + :paramtype logout_endpoint: str + """ + super().__init__(**kwargs) + self.logout_endpoint = logout_endpoint + + +class LoginScopes(_serialization.Model): + """The configuration settings of the login flow, including the scopes that should be requested. + + :ivar scopes: A list of the scopes that should be requested while authenticating. + :vartype scopes: list[str] + """ + + _attribute_map = { + "scopes": {"key": "scopes", "type": "[str]"}, + } + + def __init__(self, *, scopes: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword scopes: A list of the scopes that should be requested while authenticating. + :paramtype scopes: list[str] + """ + super().__init__(**kwargs) + 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 MaintenanceConfigurationCollection(_serialization.Model): + """The response of list maintenance configuration resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Results of the list maintenance configuration resources. + :vartype value: list[~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource] + :ivar next_link: Link for next page of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[MaintenanceConfigurationResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.MaintenanceConfigurationResource"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Results of the list maintenance configuration resources. + :paramtype value: list[~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class MaintenanceConfigurationResource(ProxyResource): + """Information about the Maintenance Configuration resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar scheduled_entries: List of maintenance schedules for a managed environment. + :vartype scheduled_entries: list[~azure.mgmt.appcontainers.models.ScheduledEntry] + """ + + _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"}, + "scheduled_entries": {"key": "properties.scheduledEntries", "type": "[ScheduledEntry]"}, + } + + def __init__(self, *, scheduled_entries: Optional[List["_models.ScheduledEntry"]] = None, **kwargs: Any) -> None: + """ + :keyword scheduled_entries: List of maintenance schedules for a managed environment. + :paramtype scheduled_entries: list[~azure.mgmt.appcontainers.models.ScheduledEntry] + """ + super().__init__(**kwargs) + self.scheduled_entries = scheduled_entries + + +class ManagedCertificate(TrackedResource): + """Managed certificates 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 server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :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.ManagedCertificateProperties + """ + + _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": "ManagedCertificateProperties"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.ManagedCertificateProperties"] = 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.ManagedCertificateProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class ManagedCertificateCollection(_serialization.Model): + """Collection of Managed 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 server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ManagedCertificate] + :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": "[ManagedCertificate]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.ManagedCertificate"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ManagedCertificate] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ManagedCertificatePatch(_serialization.Model): + """A managed 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 ManagedCertificateProperties(_serialization.Model): + """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 subject_name: Subject name of the certificate. + :vartype subject_name: str + :ivar error: Any error occurred during the certificate provision. + :vartype error: str + :ivar domain_control_validation: Selected type of domain control validation for managed + certificates. Known values are: "CNAME", "HTTP", and "TXT". + :vartype domain_control_validation: str or + ~azure.mgmt.appcontainers.models.ManagedCertificateDomainControlValidation + :ivar validation_token: A TXT token used for DNS TXT domain control validation when issuing + this type of managed certificates. + :vartype validation_token: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "error": {"readonly": True}, + "validation_token": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "subject_name": {"key": "subjectName", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "domain_control_validation": {"key": "domainControlValidation", "type": "str"}, + "validation_token": {"key": "validationToken", "type": "str"}, + } + + def __init__( + self, + *, + subject_name: Optional[str] = None, + domain_control_validation: Optional[Union[str, "_models.ManagedCertificateDomainControlValidation"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword subject_name: Subject name of the certificate. + :paramtype subject_name: str + :keyword domain_control_validation: Selected type of domain control validation for managed + certificates. Known values are: "CNAME", "HTTP", and "TXT". + :paramtype domain_control_validation: str or + ~azure.mgmt.appcontainers.models.ManagedCertificateDomainControlValidation + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.subject_name = subject_name + self.error = None + self.domain_control_validation = domain_control_validation + self.validation_token = None + + +class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance-attributes + """An environment for hosting container apps. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar kind: Kind of the Environment. + :vartype kind: str + :ivar identity: Managed identities for the Managed Environment to interact with other Azure + services without maintaining any secrets or credentials in code. + :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :ivar provisioning_state: Provisioning state of the Environment. Known values are: "Succeeded", + "Failed", "Canceled", "Waiting", "InitializationInProgress", "InfrastructureSetupInProgress", + "InfrastructureSetupComplete", "ScheduledForDelete", "UpgradeRequested", and "UpgradeFailed". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.EnvironmentProvisioningState + :ivar dapr_ai_instrumentation_key: Azure Monitor instrumentation key used by Dapr to export + Service to Service communication telemetry. + :vartype dapr_ai_instrumentation_key: str + :ivar dapr_ai_connection_string: Application Insights connection string used by Dapr to export + Service to Service communication telemetry. + :vartype dapr_ai_connection_string: str + :ivar vnet_configuration: Vnet configuration for the environment. + :vartype vnet_configuration: ~azure.mgmt.appcontainers.models.VnetConfiguration + :ivar deployment_errors: Any errors that occurred during deployment or deployment validation. + :vartype deployment_errors: str + :ivar default_domain: Default Domain Name for the cluster. + :vartype default_domain: str + :ivar static_ip: Static IP of the Environment. + :vartype static_ip: str + :ivar app_logs_configuration: Cluster configuration which enables the log daemon to export app + logs to configured destination. + :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 availability_zones: The list of availability zones to use for managed environment. + :vartype availability_zones: list[str] + :ivar custom_domain_configuration: Custom domain configuration for the environment. + :vartype custom_domain_configuration: + ~azure.mgmt.appcontainers.models.CustomDomainConfiguration + :ivar event_stream_endpoint: The endpoint of the eventstream of the Environment. + :vartype event_stream_endpoint: str + :ivar workload_profiles: Workload profiles configured for the Managed Environment. + :vartype workload_profiles: list[~azure.mgmt.appcontainers.models.WorkloadProfile] + :ivar keda_configuration: The configuration of Keda component. + :vartype keda_configuration: ~azure.mgmt.appcontainers.models.KedaConfiguration + :ivar dapr_configuration: The configuration of Dapr component. + :vartype dapr_configuration: ~azure.mgmt.appcontainers.models.DaprConfiguration + :ivar infrastructure_resource_group: Name of the platform-managed resource group created for + the Managed Environment to host infrastructure resources. If a subnet ID is provided, this + resource group will be created in the same subscription as the subnet. + :vartype infrastructure_resource_group: str + :ivar peer_authentication: Peer authentication settings for the Managed Environment. + :vartype peer_authentication: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerAuthentication + :ivar peer_traffic_configuration: Peer traffic settings for the Managed Environment. + :vartype peer_traffic_configuration: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfiguration + :ivar private_endpoint_connections: Private endpoint connections to the resource. + :vartype private_endpoint_connections: + list[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :ivar public_network_access: Property to allow or block all public traffic. Allowed Values: + 'Enabled', 'Disabled'. Known values are: "Enabled" and "Disabled". + :vartype public_network_access: str or ~azure.mgmt.appcontainers.models.PublicNetworkAccess + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "deployment_errors": {"readonly": True}, + "default_domain": {"readonly": True}, + "static_ip": {"readonly": True}, + "event_stream_endpoint": {"readonly": True}, + "private_endpoint_connections": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "dapr_ai_instrumentation_key": {"key": "properties.daprAIInstrumentationKey", "type": "str"}, + "dapr_ai_connection_string": {"key": "properties.daprAIConnectionString", "type": "str"}, + "vnet_configuration": {"key": "properties.vnetConfiguration", "type": "VnetConfiguration"}, + "deployment_errors": {"key": "properties.deploymentErrors", "type": "str"}, + "default_domain": {"key": "properties.defaultDomain", "type": "str"}, + "static_ip": {"key": "properties.staticIp", "type": "str"}, + "app_logs_configuration": {"key": "properties.appLogsConfiguration", "type": "AppLogsConfiguration"}, + "app_insights_configuration": { + "key": "properties.appInsightsConfiguration", + "type": "AppInsightsConfiguration", + }, + "open_telemetry_configuration": { + "key": "properties.openTelemetryConfiguration", + "type": "OpenTelemetryConfiguration", + }, + "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "custom_domain_configuration": { + "key": "properties.customDomainConfiguration", + "type": "CustomDomainConfiguration", + }, + "event_stream_endpoint": {"key": "properties.eventStreamEndpoint", "type": "str"}, + "workload_profiles": {"key": "properties.workloadProfiles", "type": "[WorkloadProfile]"}, + "keda_configuration": {"key": "properties.kedaConfiguration", "type": "KedaConfiguration"}, + "dapr_configuration": {"key": "properties.daprConfiguration", "type": "DaprConfiguration"}, + "infrastructure_resource_group": {"key": "properties.infrastructureResourceGroup", "type": "str"}, + "peer_authentication": { + "key": "properties.peerAuthentication", + "type": "ManagedEnvironmentPropertiesPeerAuthentication", + }, + "peer_traffic_configuration": { + "key": "properties.peerTrafficConfiguration", + "type": "ManagedEnvironmentPropertiesPeerTrafficConfiguration", + }, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[PrivateEndpointConnection]", + }, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + kind: Optional[str] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + dapr_ai_instrumentation_key: Optional[str] = None, + 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, + availability_zones: Optional[List[str]] = None, + custom_domain_configuration: Optional["_models.CustomDomainConfiguration"] = None, + workload_profiles: Optional[List["_models.WorkloadProfile"]] = None, + keda_configuration: Optional["_models.KedaConfiguration"] = None, + dapr_configuration: Optional["_models.DaprConfiguration"] = None, + infrastructure_resource_group: Optional[str] = None, + peer_authentication: Optional["_models.ManagedEnvironmentPropertiesPeerAuthentication"] = None, + peer_traffic_configuration: Optional["_models.ManagedEnvironmentPropertiesPeerTrafficConfiguration"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword kind: Kind of the Environment. + :paramtype kind: str + :keyword identity: Managed identities for the Managed Environment to interact with other Azure + services without maintaining any secrets or credentials in code. + :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :keyword dapr_ai_instrumentation_key: Azure Monitor instrumentation key used by Dapr to export + Service to Service communication telemetry. + :paramtype dapr_ai_instrumentation_key: str + :keyword dapr_ai_connection_string: Application Insights connection string used by Dapr to + export Service to Service communication telemetry. + :paramtype dapr_ai_connection_string: str + :keyword vnet_configuration: Vnet configuration for the environment. + :paramtype vnet_configuration: ~azure.mgmt.appcontainers.models.VnetConfiguration + :keyword app_logs_configuration: Cluster configuration which enables the log daemon to export + app logs to configured destination. + :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 availability_zones: The list of availability zones to use for managed environment. + :paramtype availability_zones: list[str] + :keyword custom_domain_configuration: Custom domain configuration for the environment. + :paramtype custom_domain_configuration: + ~azure.mgmt.appcontainers.models.CustomDomainConfiguration + :keyword workload_profiles: Workload profiles configured for the Managed Environment. + :paramtype workload_profiles: list[~azure.mgmt.appcontainers.models.WorkloadProfile] + :keyword keda_configuration: The configuration of Keda component. + :paramtype keda_configuration: ~azure.mgmt.appcontainers.models.KedaConfiguration + :keyword dapr_configuration: The configuration of Dapr component. + :paramtype dapr_configuration: ~azure.mgmt.appcontainers.models.DaprConfiguration + :keyword infrastructure_resource_group: Name of the platform-managed resource group created for + the Managed Environment to host infrastructure resources. If a subnet ID is provided, this + resource group will be created in the same subscription as the subnet. + :paramtype infrastructure_resource_group: str + :keyword peer_authentication: Peer authentication settings for the Managed Environment. + :paramtype peer_authentication: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerAuthentication + :keyword peer_traffic_configuration: Peer traffic settings for the Managed Environment. + :paramtype peer_traffic_configuration: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfiguration + :keyword public_network_access: Property to allow or block all public traffic. Allowed Values: + 'Enabled', 'Disabled'. Known values are: "Enabled" and "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.appcontainers.models.PublicNetworkAccess + """ + super().__init__(tags=tags, location=location, **kwargs) + self.kind = kind + self.identity = identity + self.provisioning_state = None + self.dapr_ai_instrumentation_key = dapr_ai_instrumentation_key + self.dapr_ai_connection_string = dapr_ai_connection_string + self.vnet_configuration = vnet_configuration + self.deployment_errors = None + self.default_domain = None + self.static_ip = None + self.app_logs_configuration = app_logs_configuration + self.app_insights_configuration = app_insights_configuration + self.open_telemetry_configuration = open_telemetry_configuration + self.zone_redundant = zone_redundant + self.availability_zones = availability_zones + self.custom_domain_configuration = custom_domain_configuration + self.event_stream_endpoint = None + self.workload_profiles = workload_profiles + self.keda_configuration = keda_configuration + self.dapr_configuration = dapr_configuration + self.infrastructure_resource_group = infrastructure_resource_group + self.peer_authentication = peer_authentication + self.peer_traffic_configuration = peer_traffic_configuration + self.private_endpoint_connections = None + self.public_network_access = public_network_access + + +class ManagedEnvironmentPropertiesPeerAuthentication(_serialization.Model): # pylint: disable=name-too-long + """Peer authentication settings for the Managed Environment. + + :ivar mtls: Mutual TLS authentication settings for the Managed Environment. + :vartype mtls: ~azure.mgmt.appcontainers.models.Mtls + """ + + _attribute_map = { + "mtls": {"key": "mtls", "type": "Mtls"}, + } + + def __init__(self, *, mtls: Optional["_models.Mtls"] = None, **kwargs: Any) -> None: + """ + :keyword mtls: Mutual TLS authentication settings for the Managed Environment. + :paramtype mtls: ~azure.mgmt.appcontainers.models.Mtls + """ + super().__init__(**kwargs) + self.mtls = mtls + + +class ManagedEnvironmentPropertiesPeerTrafficConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Peer traffic settings for the Managed Environment. + + :ivar encryption: Peer traffic encryption settings for the Managed Environment. + :vartype encryption: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption + """ + + _attribute_map = { + "encryption": {"key": "encryption", "type": "ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption"}, + } + + def __init__( + self, + *, + encryption: Optional["_models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption"] = None, + **kwargs: Any + ) -> None: + """ + :keyword encryption: Peer traffic encryption settings for the Managed Environment. + :paramtype encryption: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption + """ + super().__init__(**kwargs) + self.encryption = encryption + + +class ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption( + _serialization.Model +): # pylint: disable=name-too-long + """Peer traffic encryption settings for the Managed Environment. + + :ivar enabled: Boolean indicating whether the peer traffic encryption is enabled. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Boolean indicating whether the peer traffic encryption is enabled. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedEnvironmentsCollection(_serialization.Model): + """Collection of Environments. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironment] + :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": "[ManagedEnvironment]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.ManagedEnvironment"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironment] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ManagedEnvironmentStorage(ProxyResource): + """Storage resource for managedEnvironment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar properties: Storage properties. + :vartype properties: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorageProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "ManagedEnvironmentStorageProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.ManagedEnvironmentStorageProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Storage properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorageProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ManagedEnvironmentStorageProperties(_serialization.Model): + """Storage properties. + + :ivar azure_file: Azure file properties. + :vartype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + :ivar nfs_azure_file: NFS Azure file properties. + :vartype nfs_azure_file: ~azure.mgmt.appcontainers.models.NfsAzureFileProperties + """ + + _attribute_map = { + "azure_file": {"key": "azureFile", "type": "AzureFileProperties"}, + "nfs_azure_file": {"key": "nfsAzureFile", "type": "NfsAzureFileProperties"}, + } + + def __init__( + self, + *, + azure_file: Optional["_models.AzureFileProperties"] = None, + nfs_azure_file: Optional["_models.NfsAzureFileProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword azure_file: Azure file properties. + :paramtype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + :keyword nfs_azure_file: NFS Azure file properties. + :paramtype nfs_azure_file: ~azure.mgmt.appcontainers.models.NfsAzureFileProperties + """ + super().__init__(**kwargs) + self.azure_file = azure_file + self.nfs_azure_file = nfs_azure_file + + +class ManagedEnvironmentStoragesCollection(_serialization.Model): + """Collection of Storage for Environments. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of storage resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ManagedEnvironmentStorage]"}, + } + + def __init__(self, *, value: List["_models.ManagedEnvironmentStorage"], **kwargs: Any) -> None: + """ + :keyword value: Collection of storage resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage] + """ + super().__init__(**kwargs) + self.value = value + + +class ManagedIdentitySetting(_serialization.Model): + """Optional settings for a Managed Identity that is assigned to the Session pool. + + All required parameters must be populated in order to send to server. + + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + Session Pool, or 'system' for system-assigned identity. Required. + :vartype identity: str + :ivar lifecycle: Use to select the lifecycle stages of a Session Pool during which the Managed + Identity should be available. Known values are: "Init", "Main", "None", and "All". + :vartype lifecycle: str or ~azure.mgmt.appcontainers.models.IdentitySettingsLifeCycle + """ + + _validation = { + "identity": {"required": True}, + } + + _attribute_map = { + "identity": {"key": "identity", "type": "str"}, + "lifecycle": {"key": "lifecycle", "type": "str"}, + } + + def __init__( + self, + *, + identity: str, + lifecycle: Optional[Union[str, "_models.IdentitySettingsLifeCycle"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + Session Pool, or 'system' for system-assigned identity. Required. + :paramtype identity: str + :keyword lifecycle: Use to select the lifecycle stages of a Session Pool during which the + Managed Identity should be available. Known values are: "Init", "Main", "None", and "All". + :paramtype lifecycle: str or ~azure.mgmt.appcontainers.models.IdentitySettingsLifeCycle + """ + super().__init__(**kwargs) + self.identity = identity + self.lifecycle = lifecycle + + +class ManagedServiceIdentity(_serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types + are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.appcontainers.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.appcontainers.models.UserAssignedIdentity] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + "type": {"required": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, } def __init__( self, *, - cron_expression: str, - replica_completion_count: Optional[int] = None, - parallelism: Optional[int] = None, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, **kwargs: Any ) -> None: """ - :keyword replica_completion_count: Minimum number of successful replica completions before - overall job completion. - :paramtype replica_completion_count: int - :keyword cron_expression: Cron formatted repeating schedule ("\\ * * * * *") of a Cron Job. - Required. - :paramtype cron_expression: str - :keyword parallelism: Number of parallel replicas of a job that can run at a given time. - :paramtype parallelism: int + :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned + types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appcontainers.models.ManagedServiceIdentityType + :keyword user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.appcontainers.models.UserAssignedIdentity] """ super().__init__(**kwargs) - self.replica_completion_count = replica_completion_count - self.cron_expression = cron_expression - self.parallelism = parallelism + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities -class JobExecution(_serialization.Model): - """Container Apps Job execution. +class MetricsConfiguration(_serialization.Model): + """Configuration of Open Telemetry metrics. + + :ivar include_keda: Boolean indicating if including keda metrics. + :vartype include_keda: bool + :ivar destinations: Open telemetry metrics destinations. + :vartype destinations: list[str] + """ + + _attribute_map = { + "include_keda": {"key": "includeKeda", "type": "bool"}, + "destinations": {"key": "destinations", "type": "[str]"}, + } + + def __init__( + self, *, include_keda: Optional[bool] = None, destinations: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :keyword include_keda: Boolean indicating if including keda metrics. + :paramtype include_keda: bool + :keyword destinations: Open telemetry metrics destinations. + :paramtype destinations: list[str] + """ + super().__init__(**kwargs) + self.include_keda = include_keda + self.destinations = destinations + + +class Mtls(_serialization.Model): + """Configuration properties for mutual TLS authentication. + + :ivar enabled: Boolean indicating whether the mutual TLS authentication is enabled. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Boolean indicating whether the mutual TLS authentication is enabled. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class NacosComponent(JavaComponentProperties): + """Nacos properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Job execution Name. - :vartype name: str - :ivar id: Job execution Id. - :vartype id: str - :ivar type: Job execution type. - :vartype type: str - :ivar status: Current running State of the job. Known values are: "Running", "Processing", - "Stopped", "Degraded", "Failed", "Unknown", and "Succeeded". - :vartype status: str or ~azure.mgmt.appcontainers.models.JobExecutionRunningState - :ivar start_time: Job execution start time. - :vartype start_time: ~datetime.datetime - :ivar end_time: Job execution end time. - :vartype end_time: ~datetime.datetime - :ivar template: Job's execution container. - :vartype template: ~azure.mgmt.appcontainers.models.JobExecutionTemplate + All required parameters must be populated in order to send to server. + + :ivar component_type: Type of the Java Component. Required. Known values are: + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :ivar provisioning_state: Provisioning state of the Java Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState + :ivar configurations: List of Java Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar scale: Java component scaling configurations. + :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :ivar service_binds: List of Java Components that are bound to the Java component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :ivar ingress: Java Component Ingress configurations. + :vartype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress """ _validation = { - "status": {"readonly": True}, + "component_type": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "start_time": {"key": "properties.startTime", "type": "iso-8601"}, - "end_time": {"key": "properties.endTime", "type": "iso-8601"}, - "template": {"key": "properties.template", "type": "JobExecutionTemplate"}, + "component_type": {"key": "componentType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "configurations": {"key": "configurations", "type": "[JavaComponentConfigurationProperty]"}, + "scale": {"key": "scale", "type": "JavaComponentPropertiesScale"}, + "service_binds": {"key": "serviceBinds", "type": "[JavaComponentServiceBind]"}, + "ingress": {"key": "ingress", "type": "JavaComponentIngress"}, } def __init__( self, *, - name: Optional[str] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - type: Optional[str] = None, - start_time: Optional[datetime.datetime] = None, - end_time: Optional[datetime.datetime] = None, - template: Optional["_models.JobExecutionTemplate"] = None, + configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + scale: Optional["_models.JavaComponentPropertiesScale"] = None, + service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, + ingress: Optional["_models.JavaComponentIngress"] = None, **kwargs: Any ) -> None: """ - :keyword name: Job execution Name. - :paramtype name: str - :keyword id: Job execution Id. - :paramtype id: str - :keyword type: Job execution type. - :paramtype type: str - :keyword start_time: Job execution start time. - :paramtype start_time: ~datetime.datetime - :keyword end_time: Job execution end time. - :paramtype end_time: ~datetime.datetime - :keyword template: Job's execution container. - :paramtype template: ~azure.mgmt.appcontainers.models.JobExecutionTemplate - """ - super().__init__(**kwargs) - self.name = name - self.id = id - self.type = type - self.status = None - self.start_time = start_time - self.end_time = end_time - self.template = template + :keyword configurations: List of Java Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :keyword scale: Java component scaling configurations. + :paramtype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :keyword service_binds: List of Java Components that are bound to the Java component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :keyword ingress: Java Component Ingress configurations. + :paramtype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress + """ + super().__init__(configurations=configurations, scale=scale, service_binds=service_binds, **kwargs) + self.component_type: str = "Nacos" + self.ingress = ingress -class JobExecutionBase(_serialization.Model): - """Container App's Job execution name. +class NfsAzureFileProperties(_serialization.Model): + """NFS Azure File Properties. - :ivar name: Job execution name. - :vartype name: str - :ivar id: Job execution Id. - :vartype id: str + :ivar server: Server for NFS azure file. + :vartype server: str + :ivar access_mode: Access mode for storage. Known values are: "ReadOnly" and "ReadWrite". + :vartype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode + :ivar share_name: NFS Azure file share name. + :vartype share_name: str """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "id": {"key": "id", "type": "str"}, + "server": {"key": "server", "type": "str"}, + "access_mode": {"key": "accessMode", "type": "str"}, + "share_name": {"key": "shareName", "type": "str"}, } def __init__( self, *, - name: Optional[str] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin + server: Optional[str] = None, + access_mode: Optional[Union[str, "_models.AccessMode"]] = None, + share_name: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword name: Job execution name. - :paramtype name: str - :keyword id: Job execution Id. - :paramtype id: str + :keyword server: Server for NFS azure file. + :paramtype server: str + :keyword access_mode: Access mode for storage. Known values are: "ReadOnly" and "ReadWrite". + :paramtype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode + :keyword share_name: NFS Azure file share name. + :paramtype share_name: str """ super().__init__(**kwargs) - self.name = name - self.id = id + self.server = server + self.access_mode = access_mode + self.share_name = share_name -class JobExecutionContainer(_serialization.Model): - """Container Apps Jobs execution container definition. +class Nonce(_serialization.Model): + """The configuration settings of the nonce used in the login flow. - :ivar image: Container image tag. - :vartype image: str - :ivar name: Custom container name. - :vartype name: str - :ivar command: Container start command. - :vartype command: list[str] - :ivar args: Container start command arguments. - :vartype args: list[str] - :ivar env: Container environment variables. - :vartype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] - :ivar resources: Container resource requirements. - :vartype resources: ~azure.mgmt.appcontainers.models.ContainerResources + :ivar validate_nonce: :code:`false` if the nonce should not be validated while + completing the login flow; otherwise, :code:`true`. + :vartype validate_nonce: bool + :ivar nonce_expiration_interval: The time after the request is made when the nonce should + expire. + :vartype nonce_expiration_interval: str """ _attribute_map = { - "image": {"key": "image", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "command": {"key": "command", "type": "[str]"}, - "args": {"key": "args", "type": "[str]"}, - "env": {"key": "env", "type": "[EnvironmentVar]"}, - "resources": {"key": "resources", "type": "ContainerResources"}, + "validate_nonce": {"key": "validateNonce", "type": "bool"}, + "nonce_expiration_interval": {"key": "nonceExpirationInterval", "type": "str"}, + } + + def __init__( + self, *, validate_nonce: Optional[bool] = None, nonce_expiration_interval: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword validate_nonce: :code:`false` if the nonce should not be validated while + completing the login flow; otherwise, :code:`true`. + :paramtype validate_nonce: bool + :keyword nonce_expiration_interval: The time after the request is made when the nonce should + expire. + :paramtype nonce_expiration_interval: str + """ + super().__init__(**kwargs) + self.validate_nonce = validate_nonce + self.nonce_expiration_interval = nonce_expiration_interval + + +class OpenIdConnectClientCredential(_serialization.Model): + """The authentication client credentials of the custom Open ID Connect provider. + + :ivar method: The method that should be used to authenticate the user. Default value is + "ClientSecretPost". + :vartype method: str + :ivar client_secret_setting_name: The app setting that contains the client secret for the + custom Open ID Connect provider. + :vartype client_secret_setting_name: str + """ + + _attribute_map = { + "method": {"key": "method", "type": "str"}, + "client_secret_setting_name": {"key": "clientSecretSettingName", "type": "str"}, + } + + def __init__( + self, + *, + method: Optional[Literal["ClientSecretPost"]] = None, + client_secret_setting_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword method: The method that should be used to authenticate the user. Default value is + "ClientSecretPost". + :paramtype method: str + :keyword client_secret_setting_name: The app setting that contains the client secret for the + custom Open ID Connect provider. + :paramtype client_secret_setting_name: str + """ + super().__init__(**kwargs) + self.method = method + self.client_secret_setting_name = client_secret_setting_name + + +class OpenIdConnectConfig(_serialization.Model): + """The configuration settings of the endpoints used for the custom Open ID Connect provider. + + :ivar authorization_endpoint: The endpoint to be used to make an authorization request. + :vartype authorization_endpoint: str + :ivar token_endpoint: The endpoint to be used to request a token. + :vartype token_endpoint: str + :ivar issuer: The endpoint that issues the token. + :vartype issuer: str + :ivar certification_uri: The endpoint that provides the keys necessary to validate the token. + :vartype certification_uri: str + :ivar well_known_open_id_configuration: The endpoint that contains all the configuration + endpoints for the provider. + :vartype well_known_open_id_configuration: str + """ + + _attribute_map = { + "authorization_endpoint": {"key": "authorizationEndpoint", "type": "str"}, + "token_endpoint": {"key": "tokenEndpoint", "type": "str"}, + "issuer": {"key": "issuer", "type": "str"}, + "certification_uri": {"key": "certificationUri", "type": "str"}, + "well_known_open_id_configuration": {"key": "wellKnownOpenIdConfiguration", "type": "str"}, } def __init__( self, *, - image: Optional[str] = None, - name: Optional[str] = None, - command: Optional[List[str]] = None, - args: Optional[List[str]] = None, - env: Optional[List["_models.EnvironmentVar"]] = None, - resources: Optional["_models.ContainerResources"] = None, + authorization_endpoint: Optional[str] = None, + token_endpoint: Optional[str] = None, + issuer: Optional[str] = None, + certification_uri: Optional[str] = None, + well_known_open_id_configuration: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword image: Container image tag. - :paramtype image: str - :keyword name: Custom container name. - :paramtype name: str - :keyword command: Container start command. - :paramtype command: list[str] - :keyword args: Container start command arguments. - :paramtype args: list[str] - :keyword env: Container environment variables. - :paramtype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] - :keyword resources: Container resource requirements. - :paramtype resources: ~azure.mgmt.appcontainers.models.ContainerResources + :keyword authorization_endpoint: The endpoint to be used to make an authorization request. + :paramtype authorization_endpoint: str + :keyword token_endpoint: The endpoint to be used to request a token. + :paramtype token_endpoint: str + :keyword issuer: The endpoint that issues the token. + :paramtype issuer: str + :keyword certification_uri: The endpoint that provides the keys necessary to validate the + token. + :paramtype certification_uri: str + :keyword well_known_open_id_configuration: The endpoint that contains all the configuration + endpoints for the provider. + :paramtype well_known_open_id_configuration: str """ super().__init__(**kwargs) - self.image = image - self.name = name - self.command = command - self.args = args - self.env = env - self.resources = resources - + self.authorization_endpoint = authorization_endpoint + self.token_endpoint = token_endpoint + self.issuer = issuer + self.certification_uri = certification_uri + self.well_known_open_id_configuration = well_known_open_id_configuration -class JobExecutionNamesCollection(_serialization.Model): - """Container App executions names list. - All required parameters must be populated in order to send to server. +class OpenIdConnectLogin(_serialization.Model): + """The configuration settings of the login flow of the custom Open ID Connect provider. - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.JobExecutionBase] + :ivar name_claim_type: The name of the claim that contains the users name. + :vartype name_claim_type: str + :ivar scopes: A list of the scopes that should be requested while authenticating. + :vartype scopes: list[str] """ - _validation = { - "value": {"required": True}, - } - _attribute_map = { - "value": {"key": "value", "type": "[JobExecutionBase]"}, + "name_claim_type": {"key": "nameClaimType", "type": "str"}, + "scopes": {"key": "scopes", "type": "[str]"}, } - def __init__(self, *, value: List["_models.JobExecutionBase"], **kwargs: Any) -> None: + def __init__( + self, *, name_claim_type: Optional[str] = None, scopes: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.JobExecutionBase] + :keyword name_claim_type: The name of the claim that contains the users name. + :paramtype name_claim_type: str + :keyword scopes: A list of the scopes that should be requested while authenticating. + :paramtype scopes: list[str] """ super().__init__(**kwargs) - self.value = value + self.name_claim_type = name_claim_type + self.scopes = scopes -class JobExecutionTemplate(_serialization.Model): - """Job's execution template, containing container configuration for a job's execution. +class OpenIdConnectRegistration(_serialization.Model): + """The configuration settings of the app registration for the custom Open ID Connect provider. - :ivar containers: List of container definitions for the Container Apps Job. - :vartype containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] - :ivar init_containers: List of specialized containers that run before job containers. - :vartype init_containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] + :ivar client_id: The client id of the custom Open ID Connect provider. + :vartype client_id: str + :ivar client_credential: The authentication credentials of the custom Open ID Connect provider. + :vartype client_credential: ~azure.mgmt.appcontainers.models.OpenIdConnectClientCredential + :ivar open_id_connect_configuration: The configuration settings of the endpoints used for the + custom Open ID Connect provider. + :vartype open_id_connect_configuration: ~azure.mgmt.appcontainers.models.OpenIdConnectConfig """ _attribute_map = { - "containers": {"key": "containers", "type": "[JobExecutionContainer]"}, - "init_containers": {"key": "initContainers", "type": "[JobExecutionContainer]"}, + "client_id": {"key": "clientId", "type": "str"}, + "client_credential": {"key": "clientCredential", "type": "OpenIdConnectClientCredential"}, + "open_id_connect_configuration": {"key": "openIdConnectConfiguration", "type": "OpenIdConnectConfig"}, } def __init__( self, *, - containers: Optional[List["_models.JobExecutionContainer"]] = None, - init_containers: Optional[List["_models.JobExecutionContainer"]] = None, + client_id: Optional[str] = None, + client_credential: Optional["_models.OpenIdConnectClientCredential"] = None, + open_id_connect_configuration: Optional["_models.OpenIdConnectConfig"] = None, **kwargs: Any ) -> None: """ - :keyword containers: List of container definitions for the Container Apps Job. - :paramtype containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] - :keyword init_containers: List of specialized containers that run before job containers. - :paramtype init_containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] + :keyword client_id: The client id of the custom Open ID Connect provider. + :paramtype client_id: str + :keyword client_credential: The authentication credentials of the custom Open ID Connect + provider. + :paramtype client_credential: ~azure.mgmt.appcontainers.models.OpenIdConnectClientCredential + :keyword open_id_connect_configuration: The configuration settings of the endpoints used for + the custom Open ID Connect provider. + :paramtype open_id_connect_configuration: ~azure.mgmt.appcontainers.models.OpenIdConnectConfig """ super().__init__(**kwargs) - self.containers = containers - self.init_containers = init_containers + self.client_id = client_id + self.client_credential = client_credential + self.open_id_connect_configuration = open_id_connect_configuration -class JobPatchProperties(_serialization.Model): - """Container Apps Job resource specific properties. +class OpenTelemetryConfiguration(_serialization.Model): + """Configuration of Open Telemetry. - :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 - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar properties: - :vartype properties: ~azure.mgmt.appcontainers.models.JobPatchPropertiesProperties + :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 = { - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "tags": {"key": "tags", "type": "{str}"}, - "properties": {"key": "properties", "type": "JobPatchPropertiesProperties"}, + "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, *, - identity: Optional["_models.ManagedServiceIdentity"] = None, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.JobPatchPropertiesProperties"] = None, + 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 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 - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword properties: - :paramtype properties: ~azure.mgmt.appcontainers.models.JobPatchPropertiesProperties + :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.identity = identity - self.tags = tags - self.properties = properties + self.destinations_configuration = destinations_configuration + self.traces_configuration = traces_configuration + self.logs_configuration = logs_configuration + self.metrics_configuration = metrics_configuration -class JobPatchPropertiesProperties(_serialization.Model): - """JobPatchPropertiesProperties. +class OperationDetail(_serialization.Model): + """Operation detail payload. - :ivar environment_id: Resource ID of environment. - :vartype environment_id: str - :ivar configuration: Container Apps Job configuration properties. - :vartype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration - :ivar template: Container Apps job definition. - :vartype template: ~azure.mgmt.appcontainers.models.JobTemplate - :ivar outbound_ip_addresses: Outbound IP Addresses of a container apps job. - :vartype outbound_ip_addresses: list[str] - :ivar event_stream_endpoint: The endpoint of the eventstream of the container apps job. - :vartype event_stream_endpoint: str + :ivar name: Name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: Display of the operation. + :vartype display: ~azure.mgmt.appcontainers.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str """ _attribute_map = { - "environment_id": {"key": "environmentId", "type": "str"}, - "configuration": {"key": "configuration", "type": "JobConfiguration"}, - "template": {"key": "template", "type": "JobTemplate"}, - "outbound_ip_addresses": {"key": "outboundIpAddresses", "type": "[str]"}, - "event_stream_endpoint": {"key": "eventStreamEndpoint", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "origin": {"key": "origin", "type": "str"}, } def __init__( self, *, - environment_id: Optional[str] = None, - configuration: Optional["_models.JobConfiguration"] = None, - template: Optional["_models.JobTemplate"] = None, - outbound_ip_addresses: Optional[List[str]] = None, - event_stream_endpoint: Optional[str] = None, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["_models.OperationDisplay"] = None, + origin: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword environment_id: Resource ID of environment. - :paramtype environment_id: str - :keyword configuration: Container Apps Job configuration properties. - :paramtype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration - :keyword template: Container Apps job definition. - :paramtype template: ~azure.mgmt.appcontainers.models.JobTemplate - :keyword outbound_ip_addresses: Outbound IP Addresses of a container apps job. - :paramtype outbound_ip_addresses: list[str] - :keyword event_stream_endpoint: The endpoint of the eventstream of the container apps job. - :paramtype event_stream_endpoint: str + :keyword name: Name of the operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: Display of the operation. + :paramtype display: ~azure.mgmt.appcontainers.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str """ super().__init__(**kwargs) - self.environment_id = environment_id - self.configuration = configuration - self.template = template - self.outbound_ip_addresses = outbound_ip_addresses - self.event_stream_endpoint = event_stream_endpoint + self.name = name + self.is_data_action = is_data_action + self.display = display + self.origin = origin -class JobScale(_serialization.Model): - """Scaling configurations for event driven jobs. +class OperationDisplay(_serialization.Model): + """Operation display payload. - :ivar polling_interval: Interval to check each event source in seconds. Defaults to 30s. - :vartype polling_interval: int - :ivar min_executions: Minimum number of job executions that are created for a trigger, default - 0. - :vartype min_executions: int - :ivar max_executions: Maximum number of job executions that are created for a trigger, default - 100. - :vartype max_executions: int - :ivar rules: Scaling rules. - :vartype rules: list[~azure.mgmt.appcontainers.models.JobScaleRule] + :ivar provider: Resource provider of the operation. + :vartype provider: str + :ivar resource: Resource of the operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str """ _attribute_map = { - "polling_interval": {"key": "pollingInterval", "type": "int"}, - "min_executions": {"key": "minExecutions", "type": "int"}, - "max_executions": {"key": "maxExecutions", "type": "int"}, - "rules": {"key": "rules", "type": "[JobScaleRule]"}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( - self, - *, - polling_interval: Optional[int] = None, - min_executions: int = 0, - max_executions: int = 100, - rules: Optional[List["_models.JobScaleRule"]] = None, + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword polling_interval: Interval to check each event source in seconds. Defaults to 30s. - :paramtype polling_interval: int - :keyword min_executions: Minimum number of job executions that are created for a trigger, - default 0. - :paramtype min_executions: int - :keyword max_executions: Maximum number of job executions that are created for a trigger, - default 100. - :paramtype max_executions: int - :keyword rules: Scaling rules. - :paramtype rules: list[~azure.mgmt.appcontainers.models.JobScaleRule] + :keyword provider: Resource provider of the operation. + :paramtype provider: str + :keyword resource: Resource of the operation. + :paramtype resource: str + :keyword operation: Localized friendly name for the operation. + :paramtype operation: str + :keyword description: Localized friendly description for the operation. + :paramtype description: str """ super().__init__(**kwargs) - self.polling_interval = polling_interval - self.min_executions = min_executions - self.max_executions = max_executions - self.rules = rules + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description -class JobScaleRule(_serialization.Model): - """Scaling rule. +class OtlpConfiguration(_serialization.Model): + """Configuration of otlp. - :ivar name: Scale Rule Name. + :ivar name: The name of otlp configuration. :vartype name: str - :ivar type: Type of the scale rule - eg: azure-servicebus, redis etc. - :vartype type: str - :ivar metadata: Metadata properties to describe the scale rule. - :vartype metadata: JSON - :ivar auth: Authentication secrets for the scale rule. - :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar endpoint: The endpoint of otlp configuration. + :vartype endpoint: str + :ivar insecure: Boolean indicating if otlp configuration is insecure. + :vartype insecure: bool + :ivar headers: Headers of otlp configurations. + :vartype headers: list[~azure.mgmt.appcontainers.models.Header] """ _attribute_map = { "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "metadata": {"key": "metadata", "type": "object"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "endpoint": {"key": "endpoint", "type": "str"}, + "insecure": {"key": "insecure", "type": "bool"}, + "headers": {"key": "headers", "type": "[Header]"}, } def __init__( self, *, name: Optional[str] = None, - type: Optional[str] = None, - metadata: Optional[JSON] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, + endpoint: Optional[str] = None, + insecure: Optional[bool] = None, + headers: Optional[List["_models.Header"]] = None, **kwargs: Any ) -> None: """ - :keyword name: Scale Rule Name. + :keyword name: The name of otlp configuration. :paramtype name: str - :keyword type: Type of the scale rule - eg: azure-servicebus, redis etc. - :paramtype type: str - :keyword metadata: Metadata properties to describe the scale rule. - :paramtype metadata: JSON - :keyword auth: Authentication secrets for the scale rule. - :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword endpoint: The endpoint of otlp configuration. + :paramtype endpoint: str + :keyword insecure: Boolean indicating if otlp configuration is insecure. + :paramtype insecure: bool + :keyword headers: Headers of otlp configurations. + :paramtype headers: list[~azure.mgmt.appcontainers.models.Header] """ super().__init__(**kwargs) self.name = name - self.type = type - self.metadata = metadata - self.auth = auth - + self.endpoint = endpoint + self.insecure = insecure + self.headers = headers -class JobsCollection(_serialization.Model): - """Container Apps Jobs collection ARM resource. - Variables are only populated by the server, and will be ignored when sending a request. +class PatchCollection(_serialization.Model): + """Container App patch collection. All required parameters must be populated in order to send to server. - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.Job] - :ivar next_link: Link to next page of resources. + :ivar value: Collection of patch resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :ivar next_link: the link to the next page of items. :vartype next_link: str """ _validation = { "value": {"required": True}, - "next_link": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[Job]"}, + "value": {"key": "value", "type": "[ContainerAppsPatchResource]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.Job"], **kwargs: Any) -> None: + def __init__( + self, *, value: List["_models.ContainerAppsPatchResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.Job] + :keyword value: Collection of patch resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :keyword next_link: the link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link = next_link -class JobSecretsCollection(_serialization.Model): - """Container Apps Job Secrets Collection ARM resource. +class PatchDetails(_serialization.Model): + """The detailed info of patch operation performing when applying a patch. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.Secret] + :ivar target_container_name: The name of the target container for the patch. Required. + :vartype target_container_name: str + :ivar target_image: The name of the target image for the patch. Required. + :vartype target_image: str + :ivar last_detection_time: The UTC timestamp that describes the latest detection was done. + Required. + :vartype last_detection_time: ~datetime.datetime + :ivar detection_status: The status of the patch detection. Required. Known values are: + "Succeeded", "RegistryLoginFailed", and "Failed". + :vartype detection_status: str or ~azure.mgmt.appcontainers.models.DetectionStatus + :ivar new_image_name: The name of the new image created by the patch. + :vartype new_image_name: str + :ivar new_layer: New layer update details in the target image. + :vartype new_layer: ~azure.mgmt.appcontainers.models.PatchDetailsNewLayer + :ivar old_layer: The old layer details in the target image. + :vartype old_layer: ~azure.mgmt.appcontainers.models.PatchDetailsOldLayer + :ivar patch_type: The type for the patch. Known values are: "FrameworkSecurity", "OSSecurity", + "FrameworkAndOSSecurity", and "Other". + :vartype patch_type: str or ~azure.mgmt.appcontainers.models.PatchType """ _validation = { - "value": {"required": True}, + "target_container_name": {"required": True, "readonly": True}, + "target_image": {"required": True, "readonly": True}, + "last_detection_time": {"required": True, "readonly": True}, + "detection_status": {"required": True, "readonly": True}, + "new_image_name": {"readonly": True}, + "new_layer": {"readonly": True}, + "old_layer": {"readonly": True}, + "patch_type": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[Secret]"}, + "target_container_name": {"key": "targetContainerName", "type": "str"}, + "target_image": {"key": "targetImage", "type": "str"}, + "last_detection_time": {"key": "lastDetectionTime", "type": "iso-8601"}, + "detection_status": {"key": "detectionStatus", "type": "str"}, + "new_image_name": {"key": "newImageName", "type": "str"}, + "new_layer": {"key": "newLayer", "type": "PatchDetailsNewLayer"}, + "old_layer": {"key": "oldLayer", "type": "PatchDetailsOldLayer"}, + "patch_type": {"key": "patchType", "type": "str"}, } - def __init__(self, *, value: List["_models.Secret"], **kwargs: Any) -> None: - """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.Secret] - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.value = value + self.target_container_name = None + self.target_image = None + self.last_detection_time = None + self.detection_status = None + self.new_image_name = None + self.new_layer = None + self.old_layer = None + self.patch_type = None -class JobTemplate(_serialization.Model): - """Container Apps Job versioned application definition. Defines the desired state of an immutable - revision. Any changes to this section Will result in a new revision being created. +class PatchDetailsNewLayer(_serialization.Model): + """New layer update details in the target image. - :ivar init_containers: List of specialized containers that run before app containers. - :vartype init_containers: list[~azure.mgmt.appcontainers.models.InitContainer] - :ivar containers: List of container definitions for the Container App. - :vartype containers: list[~azure.mgmt.appcontainers.models.Container] - :ivar volumes: List of volume definitions for the Container App. - :vartype volumes: list[~azure.mgmt.appcontainers.models.Volume] + :ivar name: The details of the new layer for the target image. + :vartype name: str + :ivar framework_and_version: The framework and its version in the new run image for the target + image. + :vartype framework_and_version: str + :ivar os_and_version: The OS name and its version in the new run image for the target image. + :vartype os_and_version: str """ _attribute_map = { - "init_containers": {"key": "initContainers", "type": "[InitContainer]"}, - "containers": {"key": "containers", "type": "[Container]"}, - "volumes": {"key": "volumes", "type": "[Volume]"}, + "name": {"key": "name", "type": "str"}, + "framework_and_version": {"key": "frameworkAndVersion", "type": "str"}, + "os_and_version": {"key": "osAndVersion", "type": "str"}, } def __init__( self, *, - init_containers: Optional[List["_models.InitContainer"]] = None, - containers: Optional[List["_models.Container"]] = None, - volumes: Optional[List["_models.Volume"]] = None, + name: Optional[str] = None, + framework_and_version: Optional[str] = None, + os_and_version: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword init_containers: List of specialized containers that run before app containers. - :paramtype init_containers: list[~azure.mgmt.appcontainers.models.InitContainer] - :keyword containers: List of container definitions for the Container App. - :paramtype containers: list[~azure.mgmt.appcontainers.models.Container] - :keyword volumes: List of volume definitions for the Container App. - :paramtype volumes: list[~azure.mgmt.appcontainers.models.Volume] + :keyword name: The details of the new layer for the target image. + :paramtype name: str + :keyword framework_and_version: The framework and its version in the new run image for the + target image. + :paramtype framework_and_version: str + :keyword os_and_version: The OS name and its version in the new run image for the target image. + :paramtype os_and_version: str """ super().__init__(**kwargs) - self.init_containers = init_containers - self.containers = containers - self.volumes = volumes + self.name = name + self.framework_and_version = framework_and_version + self.os_and_version = os_and_version -class JwtClaimChecks(_serialization.Model): - """The configuration settings of the checks that should be made while validating the JWT Claims. +class PatchDetailsOldLayer(_serialization.Model): + """The old layer details in the target image. - :ivar allowed_groups: The list of the allowed groups. - :vartype allowed_groups: list[str] - :ivar allowed_client_applications: The list of the allowed client applications. - :vartype allowed_client_applications: list[str] + :ivar name: The details of the old layer for the target image. + :vartype name: str + :ivar framework_and_version: The framework and its version in the old run image for the target + image. + :vartype framework_and_version: str + :ivar os_and_version: The OS name and its version in the old run image for the target image. + :vartype os_and_version: str """ _attribute_map = { - "allowed_groups": {"key": "allowedGroups", "type": "[str]"}, - "allowed_client_applications": {"key": "allowedClientApplications", "type": "[str]"}, + "name": {"key": "name", "type": "str"}, + "framework_and_version": {"key": "frameworkAndVersion", "type": "str"}, + "os_and_version": {"key": "osAndVersion", "type": "str"}, } def __init__( self, *, - allowed_groups: Optional[List[str]] = None, - allowed_client_applications: Optional[List[str]] = None, + name: Optional[str] = None, + framework_and_version: Optional[str] = None, + os_and_version: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword allowed_groups: The list of the allowed groups. - :paramtype allowed_groups: list[str] - :keyword allowed_client_applications: The list of the allowed client applications. - :paramtype allowed_client_applications: list[str] + :keyword name: The details of the old layer for the target image. + :paramtype name: str + :keyword framework_and_version: The framework and its version in the old run image for the + target image. + :paramtype framework_and_version: str + :keyword os_and_version: The OS name and its version in the old run image for the target image. + :paramtype os_and_version: str """ super().__init__(**kwargs) - self.allowed_groups = allowed_groups - self.allowed_client_applications = allowed_client_applications + self.name = name + self.framework_and_version = framework_and_version + self.os_and_version = os_and_version -class KedaConfiguration(_serialization.Model): - """Configuration properties Keda component. +class PatchProperties(_serialization.Model): + """Top level properties that describes current states of the patch resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar version: The version of Keda. - :vartype version: str + :ivar target_environment_id: The Azure resource id of the target environment for the patch. + :vartype target_environment_id: str + :ivar target_container_app_id: The Azure resource id of the target container app for the patch. + :vartype target_container_app_id: str + :ivar target_revision_id: The Azure resource id of the target revision for the patch. + :vartype target_revision_id: str + :ivar patch_apply_status: The status of the patch operation. Known values are: "NotStarted", + "RebaseInProgress", "CreatingRevision", "Succeeded", "Canceled", "RebaseFailed", + "RevisionCreationFailed", "ImagePushPullFailed", and "ManuallySkipped". + :vartype patch_apply_status: str or ~azure.mgmt.appcontainers.models.PatchApplyStatus + :ivar created_at: The UTC timestamp that describes when the patch object was created. + :vartype created_at: ~datetime.datetime + :ivar last_modified_at: The UTC timestamp that describes when the patch object was last + updated. + :vartype last_modified_at: ~datetime.datetime + :ivar patch_details: Detailed info describes the patch operation for the target container app. + :vartype patch_details: list[~azure.mgmt.appcontainers.models.PatchDetails] """ _validation = { - "version": {"readonly": True}, + "patch_apply_status": {"readonly": True}, + "created_at": {"readonly": True}, + "last_modified_at": {"readonly": True}, + "patch_details": {"readonly": True}, } _attribute_map = { - "version": {"key": "version", "type": "str"}, + "target_environment_id": {"key": "targetEnvironmentId", "type": "str"}, + "target_container_app_id": {"key": "targetContainerAppId", "type": "str"}, + "target_revision_id": {"key": "targetRevisionId", "type": "str"}, + "patch_apply_status": {"key": "patchApplyStatus", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + "patch_details": {"key": "patchDetails", "type": "[PatchDetails]"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, + *, + target_environment_id: Optional[str] = None, + target_container_app_id: Optional[str] = None, + target_revision_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword target_environment_id: The Azure resource id of the target environment for the patch. + :paramtype target_environment_id: str + :keyword target_container_app_id: The Azure resource id of the target container app for the + patch. + :paramtype target_container_app_id: str + :keyword target_revision_id: The Azure resource id of the target revision for the patch. + :paramtype target_revision_id: str + """ super().__init__(**kwargs) - self.version = None + self.target_environment_id = target_environment_id + self.target_container_app_id = target_container_app_id + self.target_revision_id = target_revision_id + self.patch_apply_status = None + self.created_at = None + self.last_modified_at = None + self.patch_details = None -class ListUsagesResult(_serialization.Model): - """ListUsagesResult. +class PatchSkipConfig(_serialization.Model): + """The configuration for patcher to skip a patch or not. - :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 + :ivar skip: The flag to indicate whether to skip the patch or not. + :vartype skip: bool """ _attribute_map = { - "value": {"key": "value", "type": "[Usage]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "skip": {"key": "skip", "type": "bool"}, } - def __init__( - self, *, value: Optional[List["_models.Usage"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: + def __init__(self, *, skip: Optional[bool] = 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 + :keyword skip: The flag to indicate whether to skip the patch or not. + :paramtype skip: bool """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.skip = skip -class LogAnalyticsConfiguration(_serialization.Model): - """Log Analytics configuration, must only be provided when destination is configured as - 'log-analytics'. +class PreBuildStep(_serialization.Model): + """Model representing a pre-build step. - :ivar customer_id: Log analytics customer id. - :vartype customer_id: str - :ivar shared_key: Log analytics customer key. - :vartype shared_key: str + :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 = { - "customer_id": {"key": "customerId", "type": "str"}, - "shared_key": {"key": "sharedKey", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "scripts": {"key": "scripts", "type": "[str]"}, + "http_get": {"key": "httpGet", "type": "HttpGet"}, } - def __init__(self, *, customer_id: Optional[str] = None, shared_key: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + description: Optional[str] = None, + scripts: Optional[List[str]] = None, + http_get: Optional["_models.HttpGet"] = 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 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.customer_id = customer_id - self.shared_key = shared_key + self.description = description + self.scripts = scripts + self.http_get = http_get -class Login(_serialization.Model): - """The configuration settings of the login flow of users using ContainerApp Service - Authentication/Authorization. +class PrivateEndpoint(_serialization.Model): + """The Private Endpoint resource. - :ivar routes: The routes that specify the endpoints used for login and logout requests. - :vartype routes: ~azure.mgmt.appcontainers.models.LoginRoutes - :ivar token_store: The configuration settings of the token store. - :vartype token_store: ~azure.mgmt.appcontainers.models.TokenStore - :ivar preserve_url_fragments_for_logins: :code:`true` if the fragments from the - request are preserved after the login request is made; otherwise, :code:`false`. - :vartype preserve_url_fragments_for_logins: bool - :ivar allowed_external_redirect_urls: External URLs that can be redirected to as part of - logging in or logging out of the app. Note that the query string part of the URL is ignored. - This is an advanced setting typically only needed by Windows Store application backends. - Note that URLs within the current domain are always implicitly allowed. - :vartype allowed_external_redirect_urls: list[str] - :ivar cookie_expiration: The configuration settings of the session cookie's expiration. - :vartype cookie_expiration: ~azure.mgmt.appcontainers.models.CookieExpiration - :ivar nonce: The configuration settings of the nonce used in the login flow. - :vartype nonce: ~azure.mgmt.appcontainers.models.Nonce + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str + """ + + _validation = { + "id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(Resource): + """The Private Endpoint Connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar group_ids: The group ids for the private endpoint resource. + :vartype group_ids: list[str] + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.appcontainers.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: + ~azure.mgmt.appcontainers.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Known values are: "Succeeded", "Failed", "Canceled", "Waiting", "Updating", "Deleting", and + "Pending". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.PrivateEndpointConnectionProvisioningState """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "group_ids": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + _attribute_map = { - "routes": {"key": "routes", "type": "LoginRoutes"}, - "token_store": {"key": "tokenStore", "type": "TokenStore"}, - "preserve_url_fragments_for_logins": {"key": "preserveUrlFragmentsForLogins", "type": "bool"}, - "allowed_external_redirect_urls": {"key": "allowedExternalRedirectUrls", "type": "[str]"}, - "cookie_expiration": {"key": "cookieExpiration", "type": "CookieExpiration"}, - "nonce": {"key": "nonce", "type": "Nonce"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "group_ids": {"key": "properties.groupIds", "type": "[str]"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } def __init__( self, *, - routes: Optional["_models.LoginRoutes"] = None, - token_store: Optional["_models.TokenStore"] = None, - preserve_url_fragments_for_logins: Optional[bool] = None, - allowed_external_redirect_urls: Optional[List[str]] = None, - cookie_expiration: Optional["_models.CookieExpiration"] = None, - nonce: Optional["_models.Nonce"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs: Any ) -> None: """ - :keyword routes: The routes that specify the endpoints used for login and logout requests. - :paramtype routes: ~azure.mgmt.appcontainers.models.LoginRoutes - :keyword token_store: The configuration settings of the token store. - :paramtype token_store: ~azure.mgmt.appcontainers.models.TokenStore - :keyword preserve_url_fragments_for_logins: :code:`true` if the fragments from the - request are preserved after the login request is made; otherwise, :code:`false`. - :paramtype preserve_url_fragments_for_logins: bool - :keyword allowed_external_redirect_urls: External URLs that can be redirected to as part of - logging in or logging out of the app. Note that the query string part of the URL is ignored. - This is an advanced setting typically only needed by Windows Store application backends. - Note that URLs within the current domain are always implicitly allowed. - :paramtype allowed_external_redirect_urls: list[str] - :keyword cookie_expiration: The configuration settings of the session cookie's expiration. - :paramtype cookie_expiration: ~azure.mgmt.appcontainers.models.CookieExpiration - :keyword nonce: The configuration settings of the nonce used in the login flow. - :paramtype nonce: ~azure.mgmt.appcontainers.models.Nonce + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.appcontainers.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.appcontainers.models.PrivateLinkServiceConnectionState """ super().__init__(**kwargs) - self.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 - self.nonce = nonce + self.group_ids = None + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None -class LoginRoutes(_serialization.Model): - """The routes that specify the endpoints used for login and logout requests. +class PrivateEndpointConnectionListResult(_serialization.Model): + """List of private endpoint connection associated with the specified resource. - :ivar logout_endpoint: The endpoint at which a logout request should be made. - :vartype logout_endpoint: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str """ - _attribute_map = { - "logout_endpoint": {"key": "logoutEndpoint", "type": "str"}, + _validation = { + "next_link": {"readonly": True}, } - def __init__(self, *, logout_endpoint: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword logout_endpoint: The endpoint at which a logout request should be made. - :paramtype logout_endpoint: str - """ - super().__init__(**kwargs) - self.logout_endpoint = logout_endpoint - - -class LoginScopes(_serialization.Model): - """The configuration settings of the login flow, including the scopes that should be requested. - - :ivar scopes: A list of the scopes that should be requested while authenticating. - :vartype scopes: list[str] - """ - _attribute_map = { - "scopes": {"key": "scopes", "type": "[str]"}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, scopes: Optional[List[str]] = None, **kwargs: Any) -> None: + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: """ - :keyword scopes: A list of the scopes that should be requested while authenticating. - :paramtype scopes: list[str] + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] """ super().__init__(**kwargs) - self.scopes = scopes + self.value = value + self.next_link = None -class ManagedCertificate(TrackedResource): - """Managed certificates used for Custom Domain bindings of Container Apps in a Managed - Environment. +class PrivateLinkResource(Resource): + """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -6126,12 +11517,12 @@ class ManagedCertificate(TrackedResource): :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.ManagedCertificateProperties + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -6139,7 +11530,8 @@ class ManagedCertificate(TrackedResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "location": {"required": True}, + "group_id": {"readonly": True}, + "required_members": {"readonly": True}, } _attribute_map = { @@ -6147,152 +11539,249 @@ class ManagedCertificate(TrackedResource): "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": "ManagedCertificateProperties"}, + "group_id": {"key": "properties.groupId", "type": "str"}, + "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, + "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.ManagedCertificateProperties"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, required_zone_names: Optional[List[str]] = 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.ManagedCertificateProperties + :keyword required_zone_names: The private link resource private link DNS zone name. + :paramtype required_zone_names: list[str] """ - super().__init__(tags=tags, location=location, **kwargs) - self.properties = properties + super().__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names -class ManagedCertificateCollection(_serialization.Model): - """Collection of Managed Certificates. +class PrivateLinkResourceListResult(_serialization.Model): + """A list of private link resources. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.ManagedCertificate] - :ivar next_link: Link to next page of resources. + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.appcontainers.models.PrivateLinkResource] + :ivar next_link: URL to get the next set of operation list results (if there are any). :vartype next_link: str """ _validation = { - "value": {"required": True}, "next_link": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[ManagedCertificate]"}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.ManagedCertificate"], **kwargs: Any) -> None: + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs: Any) -> None: """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.ManagedCertificate] + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.appcontainers.models.PrivateLinkResource] """ super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedCertificatePatch(_serialization.Model): - """A managed certificate to update. +class PrivateLinkServiceConnectionState(_serialization.Model): + """A collection of information about the state of the connection between service consumer and + provider. - :ivar tags: Application-specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". + :vartype status: str or ~azure.mgmt.appcontainers.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype actions_required: str """ _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "actions_required": {"key": "actionsRequired", "type": "str"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword tags: Application-specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". + :paramtype status: str or + ~azure.mgmt.appcontainers.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str """ super().__init__(**kwargs) - self.tags = tags + self.status = status + self.description = description + self.actions_required = actions_required -class ManagedCertificateProperties(_serialization.Model): - """Certificate resource specific properties. +class QueueScaleRule(_serialization.Model): + """Container App container Azure Queue based scaling rule. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar account_name: Storage account name. required if using managed identity to authenticate. + :vartype account_name: str + :ivar queue_name: Queue name. + :vartype queue_name: str + :ivar queue_length: Queue length. + :vartype queue_length: int + :ivar auth: Authentication secrets for the queue scale rule. + :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :vartype identity: str + """ + + _attribute_map = { + "account_name": {"key": "accountName", "type": "str"}, + "queue_name": {"key": "queueName", "type": "str"}, + "queue_length": {"key": "queueLength", "type": "int"}, + "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "identity": {"key": "identity", "type": "str"}, + } + + def __init__( + self, + *, + account_name: Optional[str] = None, + queue_name: Optional[str] = None, + queue_length: Optional[int] = None, + auth: Optional[List["_models.ScaleRuleAuth"]] = None, + identity: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword account_name: Storage account name. required if using managed identity to + authenticate. + :paramtype account_name: str + :keyword queue_name: Queue name. + :paramtype queue_name: str + :keyword queue_length: Queue length. + :paramtype queue_length: int + :keyword auth: Authentication secrets for the queue scale rule. + :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :paramtype identity: str + """ + super().__init__(**kwargs) + self.account_name = account_name + self.queue_name = queue_name + self.queue_length = queue_length + self.auth = auth + self.identity = identity + + +class RegistryCredentials(_serialization.Model): + """Container App Private Registry. + + :ivar server: Container Registry Server. + :vartype server: str + :ivar username: Container Registry Username. + :vartype username: str + :ivar password_secret_ref: The name of the Secret that contains the registry login password. + :vartype password_secret_ref: str + :ivar identity: A Managed Identity to use to authenticate with Azure Container Registry. For + user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned + identities, use 'system'. + :vartype identity: str + """ + + _attribute_map = { + "server": {"key": "server", "type": "str"}, + "username": {"key": "username", "type": "str"}, + "password_secret_ref": {"key": "passwordSecretRef", "type": "str"}, + "identity": {"key": "identity", "type": "str"}, + } + + def __init__( + self, + *, + server: Optional[str] = None, + username: Optional[str] = None, + password_secret_ref: Optional[str] = None, + identity: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword server: Container Registry Server. + :paramtype server: str + :keyword username: Container Registry Username. + :paramtype username: str + :keyword password_secret_ref: The name of the Secret that contains the registry login password. + :paramtype password_secret_ref: str + :keyword identity: A Managed Identity to use to authenticate with Azure Container Registry. For + user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned + identities, use 'system'. + :paramtype identity: str + """ + super().__init__(**kwargs) + self.server = server + self.username = username + self.password_secret_ref = password_secret_ref + self.identity = identity + + +class RegistryInfo(_serialization.Model): + """Container App registry information. - :ivar 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 subject_name: Subject name of the certificate. - :vartype subject_name: str - :ivar error: Any error occurred during the certificate provision. - :vartype error: str - :ivar domain_control_validation: Selected type of domain control validation for managed - certificates. Known values are: "CNAME", "HTTP", and "TXT". - :vartype domain_control_validation: str or - ~azure.mgmt.appcontainers.models.ManagedCertificateDomainControlValidation - :ivar validation_token: A TXT token used for DNS TXT domain control validation when issuing - this type of managed certificates. - :vartype validation_token: str + :ivar registry_url: registry server Url. + :vartype registry_url: str + :ivar registry_user_name: registry username. + :vartype registry_user_name: str + :ivar registry_password: registry secret. + :vartype registry_password: str """ - _validation = { - "provisioning_state": {"readonly": True}, - "error": {"readonly": True}, - "validation_token": {"readonly": True}, - } - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "subject_name": {"key": "subjectName", "type": "str"}, - "error": {"key": "error", "type": "str"}, - "domain_control_validation": {"key": "domainControlValidation", "type": "str"}, - "validation_token": {"key": "validationToken", "type": "str"}, + "registry_url": {"key": "registryUrl", "type": "str"}, + "registry_user_name": {"key": "registryUserName", "type": "str"}, + "registry_password": {"key": "registryPassword", "type": "str"}, } def __init__( self, *, - subject_name: Optional[str] = None, - domain_control_validation: Optional[Union[str, "_models.ManagedCertificateDomainControlValidation"]] = None, + registry_url: Optional[str] = None, + registry_user_name: Optional[str] = None, + registry_password: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword subject_name: Subject name of the certificate. - :paramtype subject_name: str - :keyword domain_control_validation: Selected type of domain control validation for managed - certificates. Known values are: "CNAME", "HTTP", and "TXT". - :paramtype domain_control_validation: str or - ~azure.mgmt.appcontainers.models.ManagedCertificateDomainControlValidation + :keyword registry_url: registry server Url. + :paramtype registry_url: str + :keyword registry_user_name: registry username. + :paramtype registry_user_name: str + :keyword registry_password: registry secret. + :paramtype registry_password: str """ super().__init__(**kwargs) - self.provisioning_state = None - self.subject_name = subject_name - self.error = None - self.domain_control_validation = domain_control_validation - self.validation_token = None + self.registry_url = registry_url + self.registry_user_name = registry_user_name + self.registry_password = registry_password -class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance-attributes - """An environment for hosting container apps. +class Replica(ProxyResource): + """Container App Revision Replica. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -6302,58 +11791,17 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- :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 kind: Kind of the Environment. - :vartype kind: str - :ivar provisioning_state: Provisioning state of the Environment. Known values are: "Succeeded", - "Failed", "Canceled", "Waiting", "InitializationInProgress", "InfrastructureSetupInProgress", - "InfrastructureSetupComplete", "ScheduledForDelete", "UpgradeRequested", and "UpgradeFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appcontainers.models.EnvironmentProvisioningState - :ivar dapr_ai_instrumentation_key: Azure Monitor instrumentation key used by Dapr to export - Service to Service communication telemetry. - :vartype dapr_ai_instrumentation_key: str - :ivar dapr_ai_connection_string: Application Insights connection string used by Dapr to export - Service to Service communication telemetry. - :vartype dapr_ai_connection_string: str - :ivar vnet_configuration: Vnet configuration for the environment. - :vartype vnet_configuration: ~azure.mgmt.appcontainers.models.VnetConfiguration - :ivar deployment_errors: Any errors that occurred during deployment or deployment validation. - :vartype deployment_errors: str - :ivar default_domain: Default Domain Name for the cluster. - :vartype default_domain: str - :ivar static_ip: Static IP of the Environment. - :vartype static_ip: str - :ivar app_logs_configuration: Cluster configuration which enables the log daemon to export - app logs to a destination. Currently only "log-analytics" is - supported. - :vartype app_logs_configuration: ~azure.mgmt.appcontainers.models.AppLogsConfiguration - :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. - :vartype custom_domain_configuration: - ~azure.mgmt.appcontainers.models.CustomDomainConfiguration - :ivar event_stream_endpoint: The endpoint of the eventstream of the Environment. - :vartype event_stream_endpoint: str - :ivar workload_profiles: Workload profiles configured for the Managed Environment. - :vartype workload_profiles: list[~azure.mgmt.appcontainers.models.WorkloadProfile] - :ivar keda_configuration: The configuration of Keda component. - :vartype keda_configuration: ~azure.mgmt.appcontainers.models.KedaConfiguration - :ivar dapr_configuration: The configuration of Dapr component. - :vartype dapr_configuration: ~azure.mgmt.appcontainers.models.DaprConfiguration - :ivar infrastructure_resource_group: Name of the platform-managed resource group created for - the Managed Environment to host infrastructure resources. If a subnet ID is provided, this - resource group will be created in the same subscription as the subnet. - :vartype infrastructure_resource_group: str - :ivar peer_authentication: Peer authentication settings for the Managed Environment. - :vartype peer_authentication: - ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerAuthentication - :ivar peer_traffic_configuration: Peer traffic settings for the Managed Environment. - :vartype peer_traffic_configuration: - ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfiguration + :ivar created_time: Timestamp describing when the pod was created by controller. + :vartype created_time: ~datetime.datetime + :ivar running_state: Current running state of the replica. Known values are: "Running", + "NotRunning", and "Unknown". + :vartype running_state: str or ~azure.mgmt.appcontainers.models.ContainerAppReplicaRunningState + :ivar running_state_details: The details of replica current running state. + :vartype running_state_details: str + :ivar containers: The containers collection under a replica. + :vartype containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] + :ivar init_containers: The init containers collection under a replica. + :vartype init_containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] """ _validation = { @@ -6361,12 +11809,9 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "location": {"required": True}, - "provisioning_state": {"readonly": True}, - "deployment_errors": {"readonly": True}, - "default_domain": {"readonly": True}, - "static_ip": {"readonly": True}, - "event_stream_endpoint": {"readonly": True}, + "created_time": {"readonly": True}, + "running_state": {"readonly": True}, + "running_state_details": {"readonly": True}, } _attribute_map = { @@ -6374,197 +11819,290 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- "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"}, - "kind": {"key": "kind", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "dapr_ai_instrumentation_key": {"key": "properties.daprAIInstrumentationKey", "type": "str"}, - "dapr_ai_connection_string": {"key": "properties.daprAIConnectionString", "type": "str"}, - "vnet_configuration": {"key": "properties.vnetConfiguration", "type": "VnetConfiguration"}, - "deployment_errors": {"key": "properties.deploymentErrors", "type": "str"}, - "default_domain": {"key": "properties.defaultDomain", "type": "str"}, - "static_ip": {"key": "properties.staticIp", "type": "str"}, - "app_logs_configuration": {"key": "properties.appLogsConfiguration", "type": "AppLogsConfiguration"}, - "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"}, - "custom_domain_configuration": { - "key": "properties.customDomainConfiguration", - "type": "CustomDomainConfiguration", - }, - "event_stream_endpoint": {"key": "properties.eventStreamEndpoint", "type": "str"}, - "workload_profiles": {"key": "properties.workloadProfiles", "type": "[WorkloadProfile]"}, - "keda_configuration": {"key": "properties.kedaConfiguration", "type": "KedaConfiguration"}, - "dapr_configuration": {"key": "properties.daprConfiguration", "type": "DaprConfiguration"}, - "infrastructure_resource_group": {"key": "properties.infrastructureResourceGroup", "type": "str"}, - "peer_authentication": { - "key": "properties.peerAuthentication", - "type": "ManagedEnvironmentPropertiesPeerAuthentication", - }, - "peer_traffic_configuration": { - "key": "properties.peerTrafficConfiguration", - "type": "ManagedEnvironmentPropertiesPeerTrafficConfiguration", - }, + "created_time": {"key": "properties.createdTime", "type": "iso-8601"}, + "running_state": {"key": "properties.runningState", "type": "str"}, + "running_state_details": {"key": "properties.runningStateDetails", "type": "str"}, + "containers": {"key": "properties.containers", "type": "[ReplicaContainer]"}, + "init_containers": {"key": "properties.initContainers", "type": "[ReplicaContainer]"}, } - def __init__( # pylint: disable=too-many-locals + def __init__( self, *, - location: str, - tags: Optional[Dict[str, str]] = None, - kind: Optional[str] = None, - dapr_ai_instrumentation_key: Optional[str] = None, - dapr_ai_connection_string: Optional[str] = None, - vnet_configuration: Optional["_models.VnetConfiguration"] = None, - app_logs_configuration: Optional["_models.AppLogsConfiguration"] = None, - zone_redundant: Optional[bool] = None, - custom_domain_configuration: Optional["_models.CustomDomainConfiguration"] = None, - workload_profiles: Optional[List["_models.WorkloadProfile"]] = None, - keda_configuration: Optional["_models.KedaConfiguration"] = None, - dapr_configuration: Optional["_models.DaprConfiguration"] = None, - infrastructure_resource_group: Optional[str] = None, - peer_authentication: Optional["_models.ManagedEnvironmentPropertiesPeerAuthentication"] = None, - peer_traffic_configuration: Optional["_models.ManagedEnvironmentPropertiesPeerTrafficConfiguration"] = None, + containers: Optional[List["_models.ReplicaContainer"]] = None, + init_containers: Optional[List["_models.ReplicaContainer"]] = 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 kind: Kind of the Environment. - :paramtype kind: str - :keyword dapr_ai_instrumentation_key: Azure Monitor instrumentation key used by Dapr to export - Service to Service communication telemetry. - :paramtype dapr_ai_instrumentation_key: str - :keyword dapr_ai_connection_string: Application Insights connection string used by Dapr to - export Service to Service communication telemetry. - :paramtype dapr_ai_connection_string: str - :keyword vnet_configuration: Vnet configuration for the environment. - :paramtype vnet_configuration: ~azure.mgmt.appcontainers.models.VnetConfiguration - :keyword app_logs_configuration: Cluster configuration which enables the log daemon to export - app logs to a destination. Currently only "log-analytics" is - supported. - :paramtype app_logs_configuration: ~azure.mgmt.appcontainers.models.AppLogsConfiguration - :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. - :paramtype custom_domain_configuration: - ~azure.mgmt.appcontainers.models.CustomDomainConfiguration - :keyword workload_profiles: Workload profiles configured for the Managed Environment. - :paramtype workload_profiles: list[~azure.mgmt.appcontainers.models.WorkloadProfile] - :keyword keda_configuration: The configuration of Keda component. - :paramtype keda_configuration: ~azure.mgmt.appcontainers.models.KedaConfiguration - :keyword dapr_configuration: The configuration of Dapr component. - :paramtype dapr_configuration: ~azure.mgmt.appcontainers.models.DaprConfiguration - :keyword infrastructure_resource_group: Name of the platform-managed resource group created for - the Managed Environment to host infrastructure resources. If a subnet ID is provided, this - resource group will be created in the same subscription as the subnet. - :paramtype infrastructure_resource_group: str - :keyword peer_authentication: Peer authentication settings for the Managed Environment. - :paramtype peer_authentication: - ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerAuthentication - :keyword peer_traffic_configuration: Peer traffic settings for the Managed Environment. - :paramtype peer_traffic_configuration: - ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfiguration + :keyword containers: The containers collection under a replica. + :paramtype containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] + :keyword init_containers: The init containers collection under a replica. + :paramtype init_containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] """ - super().__init__(tags=tags, location=location, **kwargs) - self.kind = kind - self.provisioning_state = None - self.dapr_ai_instrumentation_key = dapr_ai_instrumentation_key - self.dapr_ai_connection_string = dapr_ai_connection_string - self.vnet_configuration = vnet_configuration - self.deployment_errors = None - self.default_domain = None - self.static_ip = None - self.app_logs_configuration = app_logs_configuration - self.zone_redundant = zone_redundant - self.custom_domain_configuration = custom_domain_configuration - self.event_stream_endpoint = None - self.workload_profiles = workload_profiles - self.keda_configuration = keda_configuration - self.dapr_configuration = dapr_configuration - self.infrastructure_resource_group = infrastructure_resource_group - self.peer_authentication = peer_authentication - self.peer_traffic_configuration = peer_traffic_configuration + super().__init__(**kwargs) + self.created_time = None + self.running_state = None + self.running_state_details = None + self.containers = containers + self.init_containers = init_containers -class ManagedEnvironmentPropertiesPeerAuthentication(_serialization.Model): # pylint: disable=name-too-long - """Peer authentication settings for the Managed Environment. +class ReplicaCollection(_serialization.Model): + """Container App Revision Replicas collection ARM resource. - :ivar mtls: Mutual TLS authentication settings for the Managed Environment. - :vartype mtls: ~azure.mgmt.appcontainers.models.Mtls + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.Replica] """ + _validation = { + "value": {"required": True}, + } + _attribute_map = { - "mtls": {"key": "mtls", "type": "Mtls"}, + "value": {"key": "value", "type": "[Replica]"}, } - def __init__(self, *, mtls: Optional["_models.Mtls"] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.Replica"], **kwargs: Any) -> None: """ - :keyword mtls: Mutual TLS authentication settings for the Managed Environment. - :paramtype mtls: ~azure.mgmt.appcontainers.models.Mtls + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.Replica] """ super().__init__(**kwargs) - self.mtls = mtls + self.value = value -class ManagedEnvironmentPropertiesPeerTrafficConfiguration(_serialization.Model): # pylint: disable=name-too-long - """Peer traffic settings for the Managed Environment. +class ReplicaContainer(_serialization.Model): + """Container object under Container App Revision Replica. - :ivar encryption: Peer traffic encryption settings for the Managed Environment. - :vartype encryption: - ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The Name of the Container. + :vartype name: str + :ivar container_id: The Id of the Container. + :vartype container_id: str + :ivar ready: The container ready status. + :vartype ready: bool + :ivar started: The container start status. + :vartype started: bool + :ivar restart_count: The container restart count. + :vartype restart_count: int + :ivar running_state: Current running state of the container. Known values are: "Running", + "Terminated", and "Waiting". + :vartype running_state: str or + ~azure.mgmt.appcontainers.models.ContainerAppContainerRunningState + :ivar running_state_details: The details of container current running state. + :vartype running_state_details: str + :ivar log_stream_endpoint: Log Stream endpoint. + :vartype log_stream_endpoint: str + :ivar exec_endpoint: Container exec endpoint. + :vartype exec_endpoint: str + :ivar debug_endpoint: Container debug endpoint. + :vartype debug_endpoint: str """ + _validation = { + "running_state": {"readonly": True}, + "running_state_details": {"readonly": True}, + "log_stream_endpoint": {"readonly": True}, + "exec_endpoint": {"readonly": True}, + "debug_endpoint": {"readonly": True}, + } + _attribute_map = { - "encryption": {"key": "encryption", "type": "ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption"}, + "name": {"key": "name", "type": "str"}, + "container_id": {"key": "containerId", "type": "str"}, + "ready": {"key": "ready", "type": "bool"}, + "started": {"key": "started", "type": "bool"}, + "restart_count": {"key": "restartCount", "type": "int"}, + "running_state": {"key": "runningState", "type": "str"}, + "running_state_details": {"key": "runningStateDetails", "type": "str"}, + "log_stream_endpoint": {"key": "logStreamEndpoint", "type": "str"}, + "exec_endpoint": {"key": "execEndpoint", "type": "str"}, + "debug_endpoint": {"key": "debugEndpoint", "type": "str"}, } def __init__( self, *, - encryption: Optional["_models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption"] = None, + name: Optional[str] = None, + container_id: Optional[str] = None, + ready: Optional[bool] = None, + started: Optional[bool] = None, + restart_count: Optional[int] = None, **kwargs: Any ) -> None: """ - :keyword encryption: Peer traffic encryption settings for the Managed Environment. - :paramtype encryption: - ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption + :keyword name: The Name of the Container. + :paramtype name: str + :keyword container_id: The Id of the Container. + :paramtype container_id: str + :keyword ready: The container ready status. + :paramtype ready: bool + :keyword started: The container start status. + :paramtype started: bool + :keyword restart_count: The container restart count. + :paramtype restart_count: int """ super().__init__(**kwargs) - self.encryption = encryption + self.name = name + self.container_id = container_id + self.ready = ready + self.started = started + self.restart_count = restart_count + self.running_state = None + self.running_state_details = None + self.log_stream_endpoint = None + self.exec_endpoint = None + self.debug_endpoint = None -class ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption( - _serialization.Model -): # pylint: disable=name-too-long - """Peer traffic encryption settings for the Managed Environment. +class ReplicaExecutionStatus(_serialization.Model): + """Container Apps Job execution replica status. - :ivar enabled: Boolean indicating whether the peer traffic encryption is enabled. - :vartype enabled: bool + :ivar name: Replica Name. + :vartype name: str + :ivar containers: Containers in the execution replica. + :vartype containers: list[~azure.mgmt.appcontainers.models.ContainerExecutionStatus] """ _attribute_map = { - "enabled": {"key": "enabled", "type": "bool"}, + "name": {"key": "name", "type": "str"}, + "containers": {"key": "containers", "type": "[ContainerExecutionStatus]"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + containers: Optional[List["_models.ContainerExecutionStatus"]] = None, + **kwargs: Any + ) -> None: """ - :keyword enabled: Boolean indicating whether the peer traffic encryption is enabled. - :paramtype enabled: bool + :keyword name: Replica Name. + :paramtype name: str + :keyword containers: Containers in the execution replica. + :paramtype containers: list[~azure.mgmt.appcontainers.models.ContainerExecutionStatus] """ super().__init__(**kwargs) - self.enabled = enabled + self.name = name + self.containers = containers -class ManagedEnvironmentsCollection(_serialization.Model): - """Collection of Environments. +class Revision(ProxyResource): # pylint: disable=too-many-instance-attributes + """Container App Revision. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar created_time: Timestamp describing when the revision was created + by controller. + :vartype created_time: ~datetime.datetime + :ivar last_active_time: Timestamp describing when the revision was last active. Only meaningful + when revision is inactive. + :vartype last_active_time: ~datetime.datetime + :ivar fqdn: Fully qualified domain name of the revision. + :vartype fqdn: str + :ivar template: Container App Revision Template with all possible settings and the + defaults if user did not provide them. The defaults are populated + as they were at the creation time. + :vartype template: ~azure.mgmt.appcontainers.models.Template + :ivar active: Boolean describing if the Revision is Active. + :vartype active: bool + :ivar replicas: Number of pods currently running for this revision. + :vartype replicas: int + :ivar traffic_weight: Traffic weight assigned to this revision. + :vartype traffic_weight: int + :ivar labels: List of labels assigned to this revision. + :vartype labels: list[str] + :ivar provisioning_error: Optional Field - Platform Error Message. + :vartype provisioning_error: str + :ivar health_state: Current health State of the revision. Known values are: "Healthy", + "Unhealthy", and "None". + :vartype health_state: str or ~azure.mgmt.appcontainers.models.RevisionHealthState + :ivar provisioning_state: Current provisioning State of the revision. Known values are: + "Provisioning", "Provisioned", "Failed", "Deprovisioning", and "Deprovisioned". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.RevisionProvisioningState + :ivar running_state: Current running state of the revision. Known values are: "Running", + "Processing", "Stopped", "Degraded", "Failed", and "Unknown". + :vartype running_state: str or ~azure.mgmt.appcontainers.models.RevisionRunningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "created_time": {"readonly": True}, + "last_active_time": {"readonly": True}, + "fqdn": {"readonly": True}, + "template": {"readonly": True}, + "active": {"readonly": True}, + "replicas": {"readonly": True}, + "traffic_weight": {"readonly": True}, + "labels": {"readonly": True}, + "provisioning_error": {"readonly": True}, + "health_state": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "running_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "created_time": {"key": "properties.createdTime", "type": "iso-8601"}, + "last_active_time": {"key": "properties.lastActiveTime", "type": "iso-8601"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "template": {"key": "properties.template", "type": "Template"}, + "active": {"key": "properties.active", "type": "bool"}, + "replicas": {"key": "properties.replicas", "type": "int"}, + "traffic_weight": {"key": "properties.trafficWeight", "type": "int"}, + "labels": {"key": "properties.labels", "type": "[str]"}, + "provisioning_error": {"key": "properties.provisioningError", "type": "str"}, + "health_state": {"key": "properties.healthState", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "running_state": {"key": "properties.runningState", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.created_time = None + self.last_active_time = None + self.fqdn = None + self.template = None + self.active = None + self.replicas = None + self.traffic_weight = None + self.labels = None + self.provisioning_error = None + self.health_state = None + self.provisioning_state = None + self.running_state = None + + +class RevisionCollection(_serialization.Model): + """Container App Revisions collection ARM resource. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironment] + :vartype value: list[~azure.mgmt.appcontainers.models.Revision] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -6575,795 +12113,749 @@ class ManagedEnvironmentsCollection(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[ManagedEnvironment]"}, + "value": {"key": "value", "type": "[Revision]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.ManagedEnvironment"], **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.Revision"], **kwargs: Any) -> None: """ :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironment] + :paramtype value: list[~azure.mgmt.appcontainers.models.Revision] """ super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedEnvironmentStorage(ProxyResource): - """Storage resource for managedEnvironment. - - Variables are only populated by the server, and will be ignored when sending a request. +class Runtime(_serialization.Model): + """Container App Runtime configuration. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar properties: Storage properties. - :vartype properties: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorageProperties + :ivar java: Java app configuration. + :vartype java: ~azure.mgmt.appcontainers.models.RuntimeJava + :ivar dotnet: .NET app configuration. + :vartype dotnet: ~azure.mgmt.appcontainers.models.RuntimeDotnet """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "ManagedEnvironmentStorageProperties"}, + "java": {"key": "java", "type": "RuntimeJava"}, + "dotnet": {"key": "dotnet", "type": "RuntimeDotnet"}, } def __init__( - self, *, properties: Optional["_models.ManagedEnvironmentStorageProperties"] = None, **kwargs: Any + self, + *, + java: Optional["_models.RuntimeJava"] = None, + dotnet: Optional["_models.RuntimeDotnet"] = None, + **kwargs: Any ) -> None: """ - :keyword properties: Storage properties. - :paramtype properties: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorageProperties + :keyword java: Java app configuration. + :paramtype java: ~azure.mgmt.appcontainers.models.RuntimeJava + :keyword dotnet: .NET app configuration. + :paramtype dotnet: ~azure.mgmt.appcontainers.models.RuntimeDotnet """ super().__init__(**kwargs) - self.properties = properties + self.java = java + self.dotnet = dotnet -class ManagedEnvironmentStorageProperties(_serialization.Model): - """Storage properties. +class RuntimeDotnet(_serialization.Model): + """.NET app configuration. - :ivar azure_file: Azure file properties. - :vartype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + :ivar auto_configure_data_protection: Auto configure the ASP.NET Core Data Protection feature. + :vartype auto_configure_data_protection: bool """ _attribute_map = { - "azure_file": {"key": "azureFile", "type": "AzureFileProperties"}, + "auto_configure_data_protection": {"key": "autoConfigureDataProtection", "type": "bool"}, } - def __init__(self, *, azure_file: Optional["_models.AzureFileProperties"] = None, **kwargs: Any) -> None: + def __init__(self, *, auto_configure_data_protection: Optional[bool] = None, **kwargs: Any) -> None: """ - :keyword azure_file: Azure file properties. - :paramtype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + :keyword auto_configure_data_protection: Auto configure the ASP.NET Core Data Protection + feature. + :paramtype auto_configure_data_protection: bool """ super().__init__(**kwargs) - self.azure_file = azure_file + self.auto_configure_data_protection = auto_configure_data_protection -class ManagedEnvironmentStoragesCollection(_serialization.Model): - """Collection of Storage for Environments. - - All required parameters must be populated in order to send to server. +class RuntimeJava(_serialization.Model): + """Java app configuration. - :ivar value: Collection of storage resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage] + :ivar enable_metrics: Enable jmx core metrics for the java app. + :vartype enable_metrics: bool + :ivar java_agent: Diagnostic capabilities achieved by java agent. + :vartype java_agent: ~azure.mgmt.appcontainers.models.RuntimeJavaAgent """ - _validation = { - "value": {"required": True}, - } - _attribute_map = { - "value": {"key": "value", "type": "[ManagedEnvironmentStorage]"}, + "enable_metrics": {"key": "enableMetrics", "type": "bool"}, + "java_agent": {"key": "javaAgent", "type": "RuntimeJavaAgent"}, } - def __init__(self, *, value: List["_models.ManagedEnvironmentStorage"], **kwargs: Any) -> None: + def __init__( + self, + *, + enable_metrics: Optional[bool] = None, + java_agent: Optional["_models.RuntimeJavaAgent"] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Collection of storage resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage] + :keyword enable_metrics: Enable jmx core metrics for the java app. + :paramtype enable_metrics: bool + :keyword java_agent: Diagnostic capabilities achieved by java agent. + :paramtype java_agent: ~azure.mgmt.appcontainers.models.RuntimeJavaAgent """ super().__init__(**kwargs) - self.value = value + self.enable_metrics = enable_metrics + self.java_agent = java_agent -class ManagedServiceIdentity(_serialization.Model): - """Managed service identity (system assigned and/or user assigned identities). - - Variables are only populated by the server, and will be ignored when sending a request. +class RuntimeJavaAgent(_serialization.Model): + """Diagnostic capabilities achieved by java agent. - All required parameters must be populated in order to send to server. - - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types - are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appcontainers.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.appcontainers.models.UserAssignedIdentity] + :ivar enabled: Enable java agent injection for the java app. + :vartype enabled: bool + :ivar logging: Capabilities on the java logging scenario. + :vartype logging: ~azure.mgmt.appcontainers.models.RuntimeJavaAgentLogging """ - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, - } - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + "enabled": {"key": "enabled", "type": "bool"}, + "logging": {"key": "logging", "type": "RuntimeJavaAgentLogging"}, } def __init__( self, *, - type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + enabled: Optional[bool] = None, + logging: Optional["_models.RuntimeJavaAgentLogging"] = None, **kwargs: Any ) -> None: """ - :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned - types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appcontainers.models.ManagedServiceIdentityType - :keyword user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.appcontainers.models.UserAssignedIdentity] + :keyword enabled: Enable java agent injection for the java app. + :paramtype enabled: bool + :keyword logging: Capabilities on the java logging scenario. + :paramtype logging: ~azure.mgmt.appcontainers.models.RuntimeJavaAgentLogging """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - self.user_assigned_identities = user_assigned_identities + self.enabled = enabled + self.logging = logging -class Mtls(_serialization.Model): - """Configuration properties for mutual TLS authentication. +class RuntimeJavaAgentLogging(_serialization.Model): + """Capabilities on the java logging scenario. - :ivar enabled: Boolean indicating whether the mutual TLS authentication is enabled. - :vartype enabled: bool + :ivar logger_settings: Settings of the logger for the java app. + :vartype logger_settings: list[~azure.mgmt.appcontainers.models.LoggerSetting] """ _attribute_map = { - "enabled": {"key": "enabled", "type": "bool"}, + "logger_settings": {"key": "loggerSettings", "type": "[LoggerSetting]"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + def __init__(self, *, logger_settings: Optional[List["_models.LoggerSetting"]] = None, **kwargs: Any) -> None: """ - :keyword enabled: Boolean indicating whether the mutual TLS authentication is enabled. - :paramtype enabled: bool + :keyword logger_settings: Settings of the logger for the java app. + :paramtype logger_settings: list[~azure.mgmt.appcontainers.models.LoggerSetting] """ super().__init__(**kwargs) - self.enabled = enabled + self.logger_settings = logger_settings -class Nonce(_serialization.Model): - """The configuration settings of the nonce used in the login flow. +class Scale(_serialization.Model): + """Container App scaling configurations. - :ivar validate_nonce: :code:`false` if the nonce should not be validated while - completing the login flow; otherwise, :code:`true`. - :vartype validate_nonce: bool - :ivar nonce_expiration_interval: The time after the request is made when the nonce should - expire. - :vartype nonce_expiration_interval: str + :ivar min_replicas: Optional. Minimum number of container replicas. + :vartype min_replicas: int + :ivar max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not set. + :vartype max_replicas: int + :ivar cooldown_period: Optional. KEDA Cooldown Period. Defaults to 300 seconds if not set. + :vartype cooldown_period: int + :ivar polling_interval: Optional. KEDA Polling Interval. Defaults to 30 seconds if not set. + :vartype polling_interval: int + :ivar rules: Scaling rules. + :vartype rules: list[~azure.mgmt.appcontainers.models.ScaleRule] """ _attribute_map = { - "validate_nonce": {"key": "validateNonce", "type": "bool"}, - "nonce_expiration_interval": {"key": "nonceExpirationInterval", "type": "str"}, + "min_replicas": {"key": "minReplicas", "type": "int"}, + "max_replicas": {"key": "maxReplicas", "type": "int"}, + "cooldown_period": {"key": "cooldownPeriod", "type": "int"}, + "polling_interval": {"key": "pollingInterval", "type": "int"}, + "rules": {"key": "rules", "type": "[ScaleRule]"}, } def __init__( - self, *, validate_nonce: Optional[bool] = None, nonce_expiration_interval: Optional[str] = None, **kwargs: Any + self, + *, + min_replicas: Optional[int] = None, + max_replicas: int = 10, + cooldown_period: Optional[int] = None, + polling_interval: Optional[int] = None, + rules: Optional[List["_models.ScaleRule"]] = None, + **kwargs: Any ) -> None: """ - :keyword validate_nonce: :code:`false` if the nonce should not be validated while - completing the login flow; otherwise, :code:`true`. - :paramtype validate_nonce: bool - :keyword nonce_expiration_interval: The time after the request is made when the nonce should - expire. - :paramtype nonce_expiration_interval: str + :keyword min_replicas: Optional. Minimum number of container replicas. + :paramtype min_replicas: int + :keyword max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not + set. + :paramtype max_replicas: int + :keyword cooldown_period: Optional. KEDA Cooldown Period. Defaults to 300 seconds if not set. + :paramtype cooldown_period: int + :keyword polling_interval: Optional. KEDA Polling Interval. Defaults to 30 seconds if not set. + :paramtype polling_interval: int + :keyword rules: Scaling rules. + :paramtype rules: list[~azure.mgmt.appcontainers.models.ScaleRule] """ super().__init__(**kwargs) - self.validate_nonce = validate_nonce - self.nonce_expiration_interval = nonce_expiration_interval + self.min_replicas = min_replicas + self.max_replicas = max_replicas + self.cooldown_period = cooldown_period + self.polling_interval = polling_interval + self.rules = rules -class OpenIdConnectClientCredential(_serialization.Model): - """The authentication client credentials of the custom Open ID Connect provider. +class ScaleConfiguration(_serialization.Model): + """Scale configuration. - :ivar method: The method that should be used to authenticate the user. Default value is - "ClientSecretPost". - :vartype method: str - :ivar client_secret_setting_name: The app setting that contains the client secret for the - custom Open ID Connect provider. - :vartype client_secret_setting_name: str + :ivar max_concurrent_sessions: The maximum count of sessions at the same time. + :vartype max_concurrent_sessions: int + :ivar ready_session_instances: The minimum count of ready session instances. + :vartype ready_session_instances: int """ _attribute_map = { - "method": {"key": "method", "type": "str"}, - "client_secret_setting_name": {"key": "clientSecretSettingName", "type": "str"}, + "max_concurrent_sessions": {"key": "maxConcurrentSessions", "type": "int"}, + "ready_session_instances": {"key": "readySessionInstances", "type": "int"}, } def __init__( self, *, - method: Optional[Literal["ClientSecretPost"]] = None, - client_secret_setting_name: Optional[str] = None, + max_concurrent_sessions: Optional[int] = None, + ready_session_instances: Optional[int] = None, **kwargs: Any ) -> None: """ - :keyword method: The method that should be used to authenticate the user. Default value is - "ClientSecretPost". - :paramtype method: str - :keyword client_secret_setting_name: The app setting that contains the client secret for the - custom Open ID Connect provider. - :paramtype client_secret_setting_name: str + :keyword max_concurrent_sessions: The maximum count of sessions at the same time. + :paramtype max_concurrent_sessions: int + :keyword ready_session_instances: The minimum count of ready session instances. + :paramtype ready_session_instances: int """ super().__init__(**kwargs) - self.method = method - self.client_secret_setting_name = client_secret_setting_name + self.max_concurrent_sessions = max_concurrent_sessions + self.ready_session_instances = ready_session_instances -class OpenIdConnectConfig(_serialization.Model): - """The configuration settings of the endpoints used for the custom Open ID Connect provider. +class ScaleRule(_serialization.Model): + """Container App container scaling rule. - :ivar authorization_endpoint: The endpoint to be used to make an authorization request. - :vartype authorization_endpoint: str - :ivar token_endpoint: The endpoint to be used to request a token. - :vartype token_endpoint: str - :ivar issuer: The endpoint that issues the token. - :vartype issuer: str - :ivar certification_uri: The endpoint that provides the keys necessary to validate the token. - :vartype certification_uri: str - :ivar well_known_open_id_configuration: The endpoint that contains all the configuration - endpoints for the provider. - :vartype well_known_open_id_configuration: str + :ivar name: Scale Rule Name. + :vartype name: str + :ivar azure_queue: Azure Queue based scaling. + :vartype azure_queue: ~azure.mgmt.appcontainers.models.QueueScaleRule + :ivar custom: Custom scale rule. + :vartype custom: ~azure.mgmt.appcontainers.models.CustomScaleRule + :ivar http: HTTP requests based scaling. + :vartype http: ~azure.mgmt.appcontainers.models.HttpScaleRule + :ivar tcp: Tcp requests based scaling. + :vartype tcp: ~azure.mgmt.appcontainers.models.TcpScaleRule """ _attribute_map = { - "authorization_endpoint": {"key": "authorizationEndpoint", "type": "str"}, - "token_endpoint": {"key": "tokenEndpoint", "type": "str"}, - "issuer": {"key": "issuer", "type": "str"}, - "certification_uri": {"key": "certificationUri", "type": "str"}, - "well_known_open_id_configuration": {"key": "wellKnownOpenIdConfiguration", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "azure_queue": {"key": "azureQueue", "type": "QueueScaleRule"}, + "custom": {"key": "custom", "type": "CustomScaleRule"}, + "http": {"key": "http", "type": "HttpScaleRule"}, + "tcp": {"key": "tcp", "type": "TcpScaleRule"}, } def __init__( self, *, - authorization_endpoint: Optional[str] = None, - token_endpoint: Optional[str] = None, - issuer: Optional[str] = None, - certification_uri: Optional[str] = None, - well_known_open_id_configuration: Optional[str] = None, + name: Optional[str] = None, + azure_queue: Optional["_models.QueueScaleRule"] = None, + custom: Optional["_models.CustomScaleRule"] = None, + http: Optional["_models.HttpScaleRule"] = None, + tcp: Optional["_models.TcpScaleRule"] = None, **kwargs: Any ) -> None: """ - :keyword authorization_endpoint: The endpoint to be used to make an authorization request. - :paramtype authorization_endpoint: str - :keyword token_endpoint: The endpoint to be used to request a token. - :paramtype token_endpoint: str - :keyword issuer: The endpoint that issues the token. - :paramtype issuer: str - :keyword certification_uri: The endpoint that provides the keys necessary to validate the - token. - :paramtype certification_uri: str - :keyword well_known_open_id_configuration: The endpoint that contains all the configuration - endpoints for the provider. - :paramtype well_known_open_id_configuration: str + :keyword name: Scale Rule Name. + :paramtype name: str + :keyword azure_queue: Azure Queue based scaling. + :paramtype azure_queue: ~azure.mgmt.appcontainers.models.QueueScaleRule + :keyword custom: Custom scale rule. + :paramtype custom: ~azure.mgmt.appcontainers.models.CustomScaleRule + :keyword http: HTTP requests based scaling. + :paramtype http: ~azure.mgmt.appcontainers.models.HttpScaleRule + :keyword tcp: Tcp requests based scaling. + :paramtype tcp: ~azure.mgmt.appcontainers.models.TcpScaleRule + """ + super().__init__(**kwargs) + self.name = name + self.azure_queue = azure_queue + self.custom = custom + self.http = http + self.tcp = tcp + + +class ScaleRuleAuth(_serialization.Model): + """Auth Secrets for Scale Rule. + + :ivar secret_ref: Name of the secret from which to pull the auth params. + :vartype secret_ref: str + :ivar trigger_parameter: Trigger Parameter that uses the secret. + :vartype trigger_parameter: str + """ + + _attribute_map = { + "secret_ref": {"key": "secretRef", "type": "str"}, + "trigger_parameter": {"key": "triggerParameter", "type": "str"}, + } + + def __init__( + self, *, secret_ref: Optional[str] = None, trigger_parameter: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword secret_ref: Name of the secret from which to pull the auth params. + :paramtype secret_ref: str + :keyword trigger_parameter: Trigger Parameter that uses the secret. + :paramtype trigger_parameter: str """ super().__init__(**kwargs) - self.authorization_endpoint = authorization_endpoint - self.token_endpoint = token_endpoint - self.issuer = issuer - self.certification_uri = certification_uri - self.well_known_open_id_configuration = well_known_open_id_configuration + self.secret_ref = secret_ref + self.trigger_parameter = trigger_parameter -class OpenIdConnectLogin(_serialization.Model): - """The configuration settings of the login flow of the custom Open ID Connect provider. +class ScgRoute(_serialization.Model): + """Spring Cloud Gateway route definition. - :ivar name_claim_type: The name of the claim that contains the users name. - :vartype name_claim_type: str - :ivar scopes: A list of the scopes that should be requested while authenticating. - :vartype scopes: list[str] + All required parameters must be populated in order to send to server. + + :ivar id: Id of the route. Required. + :vartype id: str + :ivar uri: Uri of the route. Required. + :vartype uri: str + :ivar predicates: Predicates of the route. + :vartype predicates: list[str] + :ivar filters: Filters of the route. + :vartype filters: list[str] + :ivar order: Order of the route. + :vartype order: int """ + _validation = { + "id": {"required": True}, + "uri": {"required": True}, + } + _attribute_map = { - "name_claim_type": {"key": "nameClaimType", "type": "str"}, - "scopes": {"key": "scopes", "type": "[str]"}, + "id": {"key": "id", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, + "predicates": {"key": "predicates", "type": "[str]"}, + "filters": {"key": "filters", "type": "[str]"}, + "order": {"key": "order", "type": "int"}, } def __init__( - self, *, name_claim_type: Optional[str] = None, scopes: Optional[List[str]] = None, **kwargs: Any + self, + *, + id: str, # pylint: disable=redefined-builtin + uri: str, + predicates: Optional[List[str]] = None, + filters: Optional[List[str]] = None, + order: Optional[int] = None, + **kwargs: Any ) -> None: """ - :keyword name_claim_type: The name of the claim that contains the users name. - :paramtype name_claim_type: str - :keyword scopes: A list of the scopes that should be requested while authenticating. - :paramtype scopes: list[str] + :keyword id: Id of the route. Required. + :paramtype id: str + :keyword uri: Uri of the route. Required. + :paramtype uri: str + :keyword predicates: Predicates of the route. + :paramtype predicates: list[str] + :keyword filters: Filters of the route. + :paramtype filters: list[str] + :keyword order: Order of the route. + :paramtype order: int """ super().__init__(**kwargs) - self.name_claim_type = name_claim_type - self.scopes = scopes + self.id = id + self.uri = uri + self.predicates = predicates + self.filters = filters + self.order = order -class OpenIdConnectRegistration(_serialization.Model): - """The configuration settings of the app registration for the custom Open ID Connect provider. +class ScheduledEntry(_serialization.Model): + """Maintenance schedule entry for a managed environment. - :ivar client_id: The client id of the custom Open ID Connect provider. - :vartype client_id: str - :ivar client_credential: The authentication credentials of the custom Open ID Connect provider. - :vartype client_credential: ~azure.mgmt.appcontainers.models.OpenIdConnectClientCredential - :ivar open_id_connect_configuration: The configuration settings of the endpoints used for the - custom Open ID Connect provider. - :vartype open_id_connect_configuration: ~azure.mgmt.appcontainers.models.OpenIdConnectConfig + All required parameters must be populated in order to send to server. + + :ivar week_day: Day of the week when a managed environment can be patched. Required. Known + values are: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", + "Everyday", and "Weekend". + :vartype week_day: str or ~azure.mgmt.appcontainers.models.WeekDay + :ivar start_hour_utc: Start hour after which managed environment maintenance can start from 0 + to 23 hour. Required. + :vartype start_hour_utc: int + :ivar duration_hours: Length of maintenance window range from 8 to 24 hours. + :vartype duration_hours: int """ + _validation = { + "week_day": {"required": True}, + "start_hour_utc": {"required": True}, + } + _attribute_map = { - "client_id": {"key": "clientId", "type": "str"}, - "client_credential": {"key": "clientCredential", "type": "OpenIdConnectClientCredential"}, - "open_id_connect_configuration": {"key": "openIdConnectConfiguration", "type": "OpenIdConnectConfig"}, + "week_day": {"key": "weekDay", "type": "str"}, + "start_hour_utc": {"key": "startHourUtc", "type": "int"}, + "duration_hours": {"key": "durationHours", "type": "int"}, } def __init__( self, *, - client_id: Optional[str] = None, - client_credential: Optional["_models.OpenIdConnectClientCredential"] = None, - open_id_connect_configuration: Optional["_models.OpenIdConnectConfig"] = None, + week_day: Union[str, "_models.WeekDay"], + start_hour_utc: int, + duration_hours: Optional[int] = None, **kwargs: Any ) -> None: """ - :keyword client_id: The client id of the custom Open ID Connect provider. - :paramtype client_id: str - :keyword client_credential: The authentication credentials of the custom Open ID Connect - provider. - :paramtype client_credential: ~azure.mgmt.appcontainers.models.OpenIdConnectClientCredential - :keyword open_id_connect_configuration: The configuration settings of the endpoints used for - the custom Open ID Connect provider. - :paramtype open_id_connect_configuration: ~azure.mgmt.appcontainers.models.OpenIdConnectConfig + :keyword week_day: Day of the week when a managed environment can be patched. Required. Known + values are: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", + "Everyday", and "Weekend". + :paramtype week_day: str or ~azure.mgmt.appcontainers.models.WeekDay + :keyword start_hour_utc: Start hour after which managed environment maintenance can start from + 0 to 23 hour. Required. + :paramtype start_hour_utc: int + :keyword duration_hours: Length of maintenance window range from 8 to 24 hours. + :paramtype duration_hours: int """ super().__init__(**kwargs) - self.client_id = client_id - self.client_credential = client_credential - self.open_id_connect_configuration = open_id_connect_configuration + self.week_day = week_day + self.start_hour_utc = start_hour_utc + self.duration_hours = duration_hours -class OperationDetail(_serialization.Model): - """Operation detail payload. +class Secret(_serialization.Model): + """Secret definition. - :ivar name: Name of the operation. + :ivar name: Secret Name. :vartype name: str - :ivar is_data_action: Indicates whether the operation is a data action. - :vartype is_data_action: bool - :ivar display: Display of the operation. - :vartype display: ~azure.mgmt.appcontainers.models.OperationDisplay - :ivar origin: Origin of the operation. - :vartype origin: str + :ivar value: Secret Value. + :vartype value: str + :ivar identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or + System to use a system-assigned identity. + :vartype identity: str + :ivar key_vault_url: Azure Key Vault URL pointing to the secret referenced by the container + app. + :vartype key_vault_url: str """ _attribute_map = { "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, + "value": {"key": "value", "type": "str"}, + "identity": {"key": "identity", "type": "str"}, + "key_vault_url": {"key": "keyVaultUrl", "type": "str"}, } def __init__( self, *, name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["_models.OperationDisplay"] = None, - origin: Optional[str] = None, + value: Optional[str] = None, + identity: Optional[str] = None, + key_vault_url: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword name: Name of the operation. + :keyword name: Secret Name. :paramtype name: str - :keyword is_data_action: Indicates whether the operation is a data action. - :paramtype is_data_action: bool - :keyword display: Display of the operation. - :paramtype display: ~azure.mgmt.appcontainers.models.OperationDisplay - :keyword origin: Origin of the operation. - :paramtype origin: str + :keyword value: Secret Value. + :paramtype value: str + :keyword identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or + System to use a system-assigned identity. + :paramtype identity: str + :keyword key_vault_url: Azure Key Vault URL pointing to the secret referenced by the container + app. + :paramtype key_vault_url: str """ super().__init__(**kwargs) self.name = name - self.is_data_action = is_data_action - self.display = display - self.origin = origin + self.value = value + self.identity = identity + self.key_vault_url = key_vault_url -class OperationDisplay(_serialization.Model): - """Operation display payload. +class SecretsCollection(_serialization.Model): + """Container App Secrets Collection ARM resource. - :ivar provider: Resource provider of the operation. - :vartype provider: str - :ivar resource: Resource of the operation. - :vartype resource: str - :ivar operation: Localized friendly name for the operation. - :vartype operation: str - :ivar description: Localized friendly description for the operation. - :vartype description: str + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ContainerAppSecret] """ + _validation = { + "value": {"required": True}, + } + _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, + "value": {"key": "value", "type": "[ContainerAppSecret]"}, } - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, value: List["_models.ContainerAppSecret"], **kwargs: Any) -> None: """ - :keyword provider: Resource provider of the operation. - :paramtype provider: str - :keyword resource: Resource of the operation. - :paramtype resource: str - :keyword operation: Localized friendly name for the operation. - :paramtype operation: str - :keyword description: Localized friendly description for the operation. - :paramtype description: str + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ContainerAppSecret] """ super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description + self.value = value -class QueueScaleRule(_serialization.Model): - """Container App container Azure Queue based scaling rule. +class SecretVolumeItem(_serialization.Model): + """Secret to be added to volume. - :ivar queue_name: Queue name. - :vartype queue_name: str - :ivar queue_length: Queue length. - :vartype queue_length: int - :ivar auth: Authentication secrets for the queue scale rule. - :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar secret_ref: Name of the Container App secret from which to pull the secret value. + :vartype secret_ref: str + :ivar path: Path to project secret to. If no path is provided, path defaults to name of secret + listed in secretRef. + :vartype path: str """ _attribute_map = { - "queue_name": {"key": "queueName", "type": "str"}, - "queue_length": {"key": "queueLength", "type": "int"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "secret_ref": {"key": "secretRef", "type": "str"}, + "path": {"key": "path", "type": "str"}, } - def __init__( - self, - *, - queue_name: Optional[str] = None, - queue_length: Optional[int] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, secret_ref: Optional[str] = None, path: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword queue_name: Queue name. - :paramtype queue_name: str - :keyword queue_length: Queue length. - :paramtype queue_length: int - :keyword auth: Authentication secrets for the queue scale rule. - :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword secret_ref: Name of the Container App secret from which to pull the secret value. + :paramtype secret_ref: str + :keyword path: Path to project secret to. If no path is provided, path defaults to name of + secret listed in secretRef. + :paramtype path: str """ super().__init__(**kwargs) - self.queue_name = queue_name - self.queue_length = queue_length - self.auth = auth + self.secret_ref = secret_ref + self.path = path -class RegistryCredentials(_serialization.Model): - """Container App Private Registry. +class Service(_serialization.Model): + """Container App to be a dev service. - :ivar server: Container Registry Server. - :vartype server: str - :ivar username: Container Registry Username. - :vartype username: str - :ivar password_secret_ref: The name of the Secret that contains the registry login password. - :vartype password_secret_ref: str - :ivar identity: A Managed Identity to use to authenticate with Azure Container Registry. For - user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned - identities, use 'system'. - :vartype identity: str + All required parameters must be populated in order to send to server. + + :ivar type: Dev ContainerApp service type. Required. + :vartype type: str """ - _attribute_map = { - "server": {"key": "server", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "password_secret_ref": {"key": "passwordSecretRef", "type": "str"}, - "identity": {"key": "identity", "type": "str"}, + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - server: Optional[str] = None, - username: Optional[str] = None, - password_secret_ref: Optional[str] = None, - identity: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, type: str, **kwargs: Any) -> None: """ - :keyword server: Container Registry Server. - :paramtype server: str - :keyword username: Container Registry Username. - :paramtype username: str - :keyword password_secret_ref: The name of the Secret that contains the registry login password. - :paramtype password_secret_ref: str - :keyword identity: A Managed Identity to use to authenticate with Azure Container Registry. For - user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned - identities, use 'system'. - :paramtype identity: str + :keyword type: Dev ContainerApp service type. Required. + :paramtype type: str """ super().__init__(**kwargs) - self.server = server - self.username = username - self.password_secret_ref = password_secret_ref - self.identity = identity + self.type = type -class RegistryInfo(_serialization.Model): - """Container App registry information. +class ServiceBind(_serialization.Model): + """Configuration to bind a ContainerApp to a dev ContainerApp Service. - :ivar registry_url: registry server Url. - :vartype registry_url: str - :ivar registry_user_name: registry username. - :vartype registry_user_name: str - :ivar registry_password: registry secret. - :vartype registry_password: str + :ivar service_id: Resource id of the target service. + :vartype service_id: str + :ivar name: Name of the service bind. + :vartype name: str + :ivar client_type: Type of the client to be used to connect to the service. + :vartype client_type: str + :ivar customized_keys: Customized keys for customizing injected values to the app. + :vartype customized_keys: dict[str, str] """ _attribute_map = { - "registry_url": {"key": "registryUrl", "type": "str"}, - "registry_user_name": {"key": "registryUserName", "type": "str"}, - "registry_password": {"key": "registryPassword", "type": "str"}, + "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, *, - registry_url: Optional[str] = None, - registry_user_name: Optional[str] = None, - registry_password: Optional[str] = None, + 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 registry_url: registry server Url. - :paramtype registry_url: str - :keyword registry_user_name: registry username. - :paramtype registry_user_name: str - :keyword registry_password: registry secret. - :paramtype registry_password: str + :keyword 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.registry_url = registry_url - self.registry_user_name = registry_user_name - self.registry_password = registry_password - + self.service_id = service_id + self.name = name + self.client_type = client_type + self.customized_keys = customized_keys -class Replica(ProxyResource): - """Container App Revision Replica. - Variables are only populated by the server, and will be ignored when sending a request. +class SessionContainer(_serialization.Model): + """Container definitions for the sessions of the session pool. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. + :ivar image: Container image tag. + :vartype image: str + :ivar name: Custom container name. :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar created_time: Timestamp describing when the pod was created by controller. - :vartype created_time: ~datetime.datetime - :ivar running_state: Current running state of the replica. Known values are: "Running", - "NotRunning", and "Unknown". - :vartype running_state: str or ~azure.mgmt.appcontainers.models.ContainerAppReplicaRunningState - :ivar running_state_details: The details of replica current running state. - :vartype running_state_details: str - :ivar containers: The containers collection under a replica. - :vartype containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] - :ivar init_containers: The init containers collection under a replica. - :vartype init_containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] + :ivar command: Container start command. + :vartype command: list[str] + :ivar args: Container start command arguments. + :vartype args: list[str] + :ivar env: Container environment variables. + :vartype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] + :ivar resources: Container resource requirements. + :vartype resources: ~azure.mgmt.appcontainers.models.SessionContainerResources """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "created_time": {"readonly": True}, - "running_state": {"readonly": True}, - "running_state_details": {"readonly": True}, - } - _attribute_map = { - "id": {"key": "id", "type": "str"}, + "image": {"key": "image", "type": "str"}, "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "created_time": {"key": "properties.createdTime", "type": "iso-8601"}, - "running_state": {"key": "properties.runningState", "type": "str"}, - "running_state_details": {"key": "properties.runningStateDetails", "type": "str"}, - "containers": {"key": "properties.containers", "type": "[ReplicaContainer]"}, - "init_containers": {"key": "properties.initContainers", "type": "[ReplicaContainer]"}, + "command": {"key": "command", "type": "[str]"}, + "args": {"key": "args", "type": "[str]"}, + "env": {"key": "env", "type": "[EnvironmentVar]"}, + "resources": {"key": "resources", "type": "SessionContainerResources"}, } def __init__( self, *, - containers: Optional[List["_models.ReplicaContainer"]] = None, - init_containers: Optional[List["_models.ReplicaContainer"]] = None, + image: Optional[str] = None, + name: Optional[str] = None, + command: Optional[List[str]] = None, + args: Optional[List[str]] = None, + env: Optional[List["_models.EnvironmentVar"]] = None, + resources: Optional["_models.SessionContainerResources"] = None, **kwargs: Any ) -> None: """ - :keyword containers: The containers collection under a replica. - :paramtype containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] - :keyword init_containers: The init containers collection under a replica. - :paramtype init_containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] + :keyword image: Container image tag. + :paramtype image: str + :keyword name: Custom container name. + :paramtype name: str + :keyword command: Container start command. + :paramtype command: list[str] + :keyword args: Container start command arguments. + :paramtype args: list[str] + :keyword env: Container environment variables. + :paramtype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] + :keyword resources: Container resource requirements. + :paramtype resources: ~azure.mgmt.appcontainers.models.SessionContainerResources """ super().__init__(**kwargs) - self.created_time = None - self.running_state = None - self.running_state_details = None - self.containers = containers - self.init_containers = init_containers - + self.image = image + self.name = name + self.command = command + self.args = args + self.env = env + self.resources = resources -class ReplicaCollection(_serialization.Model): - """Container App Revision Replicas collection ARM resource. - All required parameters must be populated in order to send to server. +class SessionContainerResources(_serialization.Model): + """Container resource requirements for sessions of the session pool. - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.Replica] + :ivar cpu: Required CPU in cores, e.g. 0.5. + :vartype cpu: float + :ivar memory: Required memory, e.g. "250Mb". + :vartype memory: str """ - _validation = { - "value": {"required": True}, - } - _attribute_map = { - "value": {"key": "value", "type": "[Replica]"}, + "cpu": {"key": "cpu", "type": "float"}, + "memory": {"key": "memory", "type": "str"}, } - def __init__(self, *, value: List["_models.Replica"], **kwargs: Any) -> None: + def __init__(self, *, cpu: Optional[float] = None, memory: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.Replica] + :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.value = value - + self.cpu = cpu + self.memory = memory -class ReplicaContainer(_serialization.Model): - """Container object under Container App Revision Replica. - Variables are only populated by the server, and will be ignored when sending a request. +class SessionIngress(_serialization.Model): + """Session pool ingress configuration. - :ivar name: The Name of the Container. - :vartype name: str - :ivar container_id: The Id of the Container. - :vartype container_id: str - :ivar ready: The container ready status. - :vartype ready: bool - :ivar started: The container start status. - :vartype started: bool - :ivar restart_count: The container restart count. - :vartype restart_count: int - :ivar running_state: Current running state of the container. Known values are: "Running", - "Terminated", and "Waiting". - :vartype running_state: str or - ~azure.mgmt.appcontainers.models.ContainerAppContainerRunningState - :ivar running_state_details: The details of container current running state. - :vartype running_state_details: str - :ivar log_stream_endpoint: Log Stream endpoint. - :vartype log_stream_endpoint: str - :ivar exec_endpoint: Container exec endpoint. - :vartype exec_endpoint: str + :ivar target_port: Target port in containers for traffic from ingress. + :vartype target_port: int """ - _validation = { - "running_state": {"readonly": True}, - "running_state_details": {"readonly": True}, - "log_stream_endpoint": {"readonly": True}, - "exec_endpoint": {"readonly": True}, - } - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "container_id": {"key": "containerId", "type": "str"}, - "ready": {"key": "ready", "type": "bool"}, - "started": {"key": "started", "type": "bool"}, - "restart_count": {"key": "restartCount", "type": "int"}, - "running_state": {"key": "runningState", "type": "str"}, - "running_state_details": {"key": "runningStateDetails", "type": "str"}, - "log_stream_endpoint": {"key": "logStreamEndpoint", "type": "str"}, - "exec_endpoint": {"key": "execEndpoint", "type": "str"}, + "target_port": {"key": "targetPort", "type": "int"}, } - def __init__( - self, - *, - name: Optional[str] = None, - container_id: Optional[str] = None, - ready: Optional[bool] = None, - started: Optional[bool] = None, - restart_count: Optional[int] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, target_port: Optional[int] = None, **kwargs: Any) -> None: """ - :keyword name: The Name of the Container. - :paramtype name: str - :keyword container_id: The Id of the Container. - :paramtype container_id: str - :keyword ready: The container ready status. - :paramtype ready: bool - :keyword started: The container start status. - :paramtype started: bool - :keyword restart_count: The container restart count. - :paramtype restart_count: int + :keyword target_port: Target port in containers for traffic from ingress. + :paramtype target_port: int + """ + super().__init__(**kwargs) + self.target_port = target_port + + +class SessionNetworkConfiguration(_serialization.Model): + """Session network configuration. + + :ivar status: Network status for the sessions. Known values are: "EgressEnabled" and + "EgressDisabled". + :vartype status: str or ~azure.mgmt.appcontainers.models.SessionNetworkStatus + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, *, status: Optional[Union[str, "_models.SessionNetworkStatus"]] = None, **kwargs: Any) -> None: + """ + :keyword status: Network status for the sessions. Known values are: "EgressEnabled" and + "EgressDisabled". + :paramtype status: str or ~azure.mgmt.appcontainers.models.SessionNetworkStatus """ super().__init__(**kwargs) - self.name = name - self.container_id = container_id - self.ready = ready - self.started = started - self.restart_count = restart_count - self.running_state = None - self.running_state_details = None - self.log_stream_endpoint = None - self.exec_endpoint = None + self.status = status -class Revision(ProxyResource): # pylint: disable=too-many-instance-attributes - """Container App Revision. +class SessionPool(TrackedResource): # pylint: disable=too-many-instance-attributes + """Container App session pool. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -7373,35 +12865,46 @@ class Revision(ProxyResource): # pylint: disable=too-many-instance-attributes :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar created_time: Timestamp describing when the revision was created - by controller. - :vartype created_time: ~datetime.datetime - :ivar last_active_time: Timestamp describing when the revision was last active. Only meaningful - when revision is inactive. - :vartype last_active_time: ~datetime.datetime - :ivar fqdn: Fully qualified domain name of the revision. - :vartype fqdn: str - :ivar template: Container App Revision Template with all possible settings and the - defaults if user did not provide them. The defaults are populated - as they were at the creation time. - :vartype template: ~azure.mgmt.appcontainers.models.Template - :ivar active: Boolean describing if the Revision is Active. - :vartype active: bool - :ivar replicas: Number of pods currently running for this revision. - :vartype replicas: int - :ivar traffic_weight: Traffic weight assigned to this revision. - :vartype traffic_weight: int - :ivar provisioning_error: Optional Field - Platform Error Message. - :vartype provisioning_error: str - :ivar health_state: Current health State of the revision. Known values are: "Healthy", - "Unhealthy", and "None". - :vartype health_state: str or ~azure.mgmt.appcontainers.models.RevisionHealthState - :ivar provisioning_state: Current provisioning State of the revision. Known values are: - "Provisioning", "Provisioned", "Failed", "Deprovisioning", and "Deprovisioned". - :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.RevisionProvisioningState - :ivar running_state: Current running state of the revision. Known values are: "Running", - "Processing", "Stopped", "Degraded", "Failed", and "Unknown". - :vartype running_state: str or ~azure.mgmt.appcontainers.models.RevisionRunningState + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar identity: Managed identities needed by a session pool to interact with other Azure + services to not maintain any secrets or credentials in code. + :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :ivar environment_id: Resource ID of the session pool's environment. + :vartype environment_id: str + :ivar container_type: The container type of the sessions. Known values are: "CustomContainer" + and "PythonLTS". + :vartype container_type: str or ~azure.mgmt.appcontainers.models.ContainerType + :ivar pool_management_type: The pool management type of the session pool. Known values are: + "Manual" and "Dynamic". + :vartype pool_management_type: str or ~azure.mgmt.appcontainers.models.PoolManagementType + :ivar node_count: The number of nodes the session pool is using. + :vartype node_count: int + :ivar scale_configuration: The scale configuration of the session pool. + :vartype scale_configuration: ~azure.mgmt.appcontainers.models.ScaleConfiguration + :ivar secrets: The secrets of the session pool. + :vartype secrets: list[~azure.mgmt.appcontainers.models.SessionPoolSecret] + :ivar dynamic_pool_configuration: The pool configuration if the poolManagementType is dynamic. + :vartype dynamic_pool_configuration: ~azure.mgmt.appcontainers.models.DynamicPoolConfiguration + :ivar custom_container_template: The custom container configuration if the containerType is + CustomContainer. + :vartype custom_container_template: ~azure.mgmt.appcontainers.models.CustomContainerTemplate + :ivar session_network_configuration: The network configuration of the sessions in the session + pool. + :vartype session_network_configuration: + ~azure.mgmt.appcontainers.models.SessionNetworkConfiguration + :ivar pool_management_endpoint: The endpoint to manage the pool. + :vartype pool_management_endpoint: str + :ivar provisioning_state: Provisioning state of the session pool. Known values are: + "InProgress", "Succeeded", "Failed", "Canceled", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.SessionPoolProvisioningState + :ivar managed_identity_settings: Optional settings for a Managed Identity that is assigned to + the Session pool. + :vartype managed_identity_settings: + list[~azure.mgmt.appcontainers.models.ManagedIdentitySetting] """ _validation = { @@ -7409,17 +12912,10 @@ class Revision(ProxyResource): # pylint: disable=too-many-instance-attributes "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "created_time": {"readonly": True}, - "last_active_time": {"readonly": True}, - "fqdn": {"readonly": True}, - "template": {"readonly": True}, - "active": {"readonly": True}, - "replicas": {"readonly": True}, - "traffic_weight": {"readonly": True}, - "provisioning_error": {"readonly": True}, - "health_state": {"readonly": True}, + "location": {"required": True}, + "node_count": {"readonly": True}, + "pool_management_endpoint": {"readonly": True}, "provisioning_state": {"readonly": True}, - "running_state": {"readonly": True}, } _attribute_map = { @@ -7427,44 +12923,107 @@ class Revision(ProxyResource): # pylint: disable=too-many-instance-attributes "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "created_time": {"key": "properties.createdTime", "type": "iso-8601"}, - "last_active_time": {"key": "properties.lastActiveTime", "type": "iso-8601"}, - "fqdn": {"key": "properties.fqdn", "type": "str"}, - "template": {"key": "properties.template", "type": "Template"}, - "active": {"key": "properties.active", "type": "bool"}, - "replicas": {"key": "properties.replicas", "type": "int"}, - "traffic_weight": {"key": "properties.trafficWeight", "type": "int"}, - "provisioning_error": {"key": "properties.provisioningError", "type": "str"}, - "health_state": {"key": "properties.healthState", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "environment_id": {"key": "properties.environmentId", "type": "str"}, + "container_type": {"key": "properties.containerType", "type": "str"}, + "pool_management_type": {"key": "properties.poolManagementType", "type": "str"}, + "node_count": {"key": "properties.nodeCount", "type": "int"}, + "scale_configuration": {"key": "properties.scaleConfiguration", "type": "ScaleConfiguration"}, + "secrets": {"key": "properties.secrets", "type": "[SessionPoolSecret]"}, + "dynamic_pool_configuration": { + "key": "properties.dynamicPoolConfiguration", + "type": "DynamicPoolConfiguration", + }, + "custom_container_template": {"key": "properties.customContainerTemplate", "type": "CustomContainerTemplate"}, + "session_network_configuration": { + "key": "properties.sessionNetworkConfiguration", + "type": "SessionNetworkConfiguration", + }, + "pool_management_endpoint": {"key": "properties.poolManagementEndpoint", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "running_state": {"key": "properties.runningState", "type": "str"}, + "managed_identity_settings": {"key": "properties.managedIdentitySettings", "type": "[ManagedIdentitySetting]"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.created_time = None - self.last_active_time = None - self.fqdn = None - self.template = None - self.active = None - self.replicas = None - self.traffic_weight = None - self.provisioning_error = None - self.health_state = None + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + environment_id: Optional[str] = None, + container_type: Optional[Union[str, "_models.ContainerType"]] = None, + pool_management_type: Optional[Union[str, "_models.PoolManagementType"]] = None, + scale_configuration: Optional["_models.ScaleConfiguration"] = None, + secrets: Optional[List["_models.SessionPoolSecret"]] = None, + dynamic_pool_configuration: Optional["_models.DynamicPoolConfiguration"] = None, + custom_container_template: Optional["_models.CustomContainerTemplate"] = None, + session_network_configuration: Optional["_models.SessionNetworkConfiguration"] = None, + managed_identity_settings: Optional[List["_models.ManagedIdentitySetting"]] = 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 identity: Managed identities needed by a session pool to interact with other Azure + services to not maintain any secrets or credentials in code. + :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :keyword environment_id: Resource ID of the session pool's environment. + :paramtype environment_id: str + :keyword container_type: The container type of the sessions. Known values are: + "CustomContainer" and "PythonLTS". + :paramtype container_type: str or ~azure.mgmt.appcontainers.models.ContainerType + :keyword pool_management_type: The pool management type of the session pool. Known values are: + "Manual" and "Dynamic". + :paramtype pool_management_type: str or ~azure.mgmt.appcontainers.models.PoolManagementType + :keyword scale_configuration: The scale configuration of the session pool. + :paramtype scale_configuration: ~azure.mgmt.appcontainers.models.ScaleConfiguration + :keyword secrets: The secrets of the session pool. + :paramtype secrets: list[~azure.mgmt.appcontainers.models.SessionPoolSecret] + :keyword dynamic_pool_configuration: The pool configuration if the poolManagementType is + dynamic. + :paramtype dynamic_pool_configuration: + ~azure.mgmt.appcontainers.models.DynamicPoolConfiguration + :keyword custom_container_template: The custom container configuration if the containerType is + CustomContainer. + :paramtype custom_container_template: ~azure.mgmt.appcontainers.models.CustomContainerTemplate + :keyword session_network_configuration: The network configuration of the sessions in the + session pool. + :paramtype session_network_configuration: + ~azure.mgmt.appcontainers.models.SessionNetworkConfiguration + :keyword managed_identity_settings: Optional settings for a Managed Identity that is assigned + to the Session pool. + :paramtype managed_identity_settings: + list[~azure.mgmt.appcontainers.models.ManagedIdentitySetting] + """ + super().__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.environment_id = environment_id + self.container_type = container_type + self.pool_management_type = pool_management_type + self.node_count = None + self.scale_configuration = scale_configuration + self.secrets = secrets + self.dynamic_pool_configuration = dynamic_pool_configuration + self.custom_container_template = custom_container_template + self.session_network_configuration = session_network_configuration + self.pool_management_endpoint = None self.provisioning_state = None - self.running_state = None + self.managed_identity_settings = managed_identity_settings -class RevisionCollection(_serialization.Model): - """Container App Revisions collection ARM resource. +class SessionPoolCollection(_serialization.Model): + """Session pool collection Azure resource. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.Revision] + :vartype value: list[~azure.mgmt.appcontainers.models.SessionPool] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -7475,408 +13034,599 @@ class RevisionCollection(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[Revision]"}, + "value": {"key": "value", "type": "[SessionPool]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.Revision"], **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.SessionPool"], **kwargs: Any) -> None: """ :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.Revision] + :paramtype value: list[~azure.mgmt.appcontainers.models.SessionPool] """ super().__init__(**kwargs) self.value = value self.next_link = None -class Scale(_serialization.Model): - """Container App scaling configurations. +class SessionPoolSecret(_serialization.Model): + """Secret definition. - :ivar min_replicas: Optional. Minimum number of container replicas. - :vartype min_replicas: int - :ivar max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not set. - :vartype max_replicas: int - :ivar rules: Scaling rules. - :vartype rules: list[~azure.mgmt.appcontainers.models.ScaleRule] + :ivar name: Secret Name. + :vartype name: str + :ivar value: Secret Value. + :vartype value: str """ _attribute_map = { - "min_replicas": {"key": "minReplicas", "type": "int"}, - "max_replicas": {"key": "maxReplicas", "type": "int"}, - "rules": {"key": "rules", "type": "[ScaleRule]"}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Secret Name. + :paramtype name: str + :keyword value: Secret Value. + :paramtype value: str + """ + super().__init__(**kwargs) + self.name = name + self.value = value + + +class SessionPoolUpdatableProperties(_serialization.Model): + """Container App session pool updatable properties. + + :ivar identity: Managed identities needed by a session pool to interact with other Azure + services to not maintain any secrets or credentials in code. + :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :ivar scale_configuration: The scale configuration of the session pool. + :vartype scale_configuration: ~azure.mgmt.appcontainers.models.ScaleConfiguration + :ivar secrets: The secrets of the session pool. + :vartype secrets: list[~azure.mgmt.appcontainers.models.SessionPoolSecret] + :ivar dynamic_pool_configuration: The pool configuration if the poolManagementType is dynamic. + :vartype dynamic_pool_configuration: ~azure.mgmt.appcontainers.models.DynamicPoolConfiguration + :ivar custom_container_template: The custom container configuration if the containerType is + CustomContainer. + :vartype custom_container_template: ~azure.mgmt.appcontainers.models.CustomContainerTemplate + :ivar session_network_configuration: The network configuration of the sessions in the session + pool. + :vartype session_network_configuration: + ~azure.mgmt.appcontainers.models.SessionNetworkConfiguration + """ + + _attribute_map = { + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "scale_configuration": {"key": "properties.scaleConfiguration", "type": "ScaleConfiguration"}, + "secrets": {"key": "properties.secrets", "type": "[SessionPoolSecret]"}, + "dynamic_pool_configuration": { + "key": "properties.dynamicPoolConfiguration", + "type": "DynamicPoolConfiguration", + }, + "custom_container_template": {"key": "properties.customContainerTemplate", "type": "CustomContainerTemplate"}, + "session_network_configuration": { + "key": "properties.sessionNetworkConfiguration", + "type": "SessionNetworkConfiguration", + }, } def __init__( self, *, - min_replicas: Optional[int] = None, - max_replicas: int = 10, - rules: Optional[List["_models.ScaleRule"]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + scale_configuration: Optional["_models.ScaleConfiguration"] = None, + secrets: Optional[List["_models.SessionPoolSecret"]] = None, + dynamic_pool_configuration: Optional["_models.DynamicPoolConfiguration"] = None, + custom_container_template: Optional["_models.CustomContainerTemplate"] = None, + session_network_configuration: Optional["_models.SessionNetworkConfiguration"] = None, **kwargs: Any ) -> None: """ - :keyword min_replicas: Optional. Minimum number of container replicas. - :paramtype min_replicas: int - :keyword max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not - set. - :paramtype max_replicas: int - :keyword rules: Scaling rules. - :paramtype rules: list[~azure.mgmt.appcontainers.models.ScaleRule] + :keyword identity: Managed identities needed by a session pool to interact with other Azure + services to not maintain any secrets or credentials in code. + :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :keyword scale_configuration: The scale configuration of the session pool. + :paramtype scale_configuration: ~azure.mgmt.appcontainers.models.ScaleConfiguration + :keyword secrets: The secrets of the session pool. + :paramtype secrets: list[~azure.mgmt.appcontainers.models.SessionPoolSecret] + :keyword dynamic_pool_configuration: The pool configuration if the poolManagementType is + dynamic. + :paramtype dynamic_pool_configuration: + ~azure.mgmt.appcontainers.models.DynamicPoolConfiguration + :keyword custom_container_template: The custom container configuration if the containerType is + CustomContainer. + :paramtype custom_container_template: ~azure.mgmt.appcontainers.models.CustomContainerTemplate + :keyword session_network_configuration: The network configuration of the sessions in the + session pool. + :paramtype session_network_configuration: + ~azure.mgmt.appcontainers.models.SessionNetworkConfiguration """ super().__init__(**kwargs) - self.min_replicas = min_replicas - self.max_replicas = max_replicas - self.rules = rules + self.identity = identity + self.scale_configuration = scale_configuration + self.secrets = secrets + self.dynamic_pool_configuration = dynamic_pool_configuration + self.custom_container_template = custom_container_template + self.session_network_configuration = session_network_configuration -class ScaleRule(_serialization.Model): - """Container App container scaling rule. +class SessionRegistryCredentials(_serialization.Model): + """Session pool private registry credentials. - :ivar name: Scale Rule Name. - :vartype name: str - :ivar azure_queue: Azure Queue based scaling. - :vartype azure_queue: ~azure.mgmt.appcontainers.models.QueueScaleRule - :ivar custom: Custom scale rule. - :vartype custom: ~azure.mgmt.appcontainers.models.CustomScaleRule - :ivar http: HTTP requests based scaling. - :vartype http: ~azure.mgmt.appcontainers.models.HttpScaleRule - :ivar tcp: Tcp requests based scaling. - :vartype tcp: ~azure.mgmt.appcontainers.models.TcpScaleRule + :ivar server: Container registry server. + :vartype server: str + :ivar username: Container registry username. + :vartype username: str + :ivar password_secret_ref: The name of the secret that contains the registry login password. + :vartype password_secret_ref: str + :ivar identity: A Managed Identity to use to authenticate with Azure Container Registry. For + user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned + identities, use 'system'. + :vartype identity: str """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "azure_queue": {"key": "azureQueue", "type": "QueueScaleRule"}, - "custom": {"key": "custom", "type": "CustomScaleRule"}, - "http": {"key": "http", "type": "HttpScaleRule"}, - "tcp": {"key": "tcp", "type": "TcpScaleRule"}, + "server": {"key": "server", "type": "str"}, + "username": {"key": "username", "type": "str"}, + "password_secret_ref": {"key": "passwordSecretRef", "type": "str"}, + "identity": {"key": "identity", "type": "str"}, } def __init__( self, *, - name: Optional[str] = None, - azure_queue: Optional["_models.QueueScaleRule"] = None, - custom: Optional["_models.CustomScaleRule"] = None, - http: Optional["_models.HttpScaleRule"] = None, - tcp: Optional["_models.TcpScaleRule"] = None, + server: Optional[str] = None, + username: Optional[str] = None, + password_secret_ref: Optional[str] = None, + identity: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword name: Scale Rule Name. - :paramtype name: str - :keyword azure_queue: Azure Queue based scaling. - :paramtype azure_queue: ~azure.mgmt.appcontainers.models.QueueScaleRule - :keyword custom: Custom scale rule. - :paramtype custom: ~azure.mgmt.appcontainers.models.CustomScaleRule - :keyword http: HTTP requests based scaling. - :paramtype http: ~azure.mgmt.appcontainers.models.HttpScaleRule - :keyword tcp: Tcp requests based scaling. - :paramtype tcp: ~azure.mgmt.appcontainers.models.TcpScaleRule + :keyword server: Container registry server. + :paramtype server: str + :keyword username: Container registry username. + :paramtype username: str + :keyword password_secret_ref: The name of the secret that contains the registry login password. + :paramtype password_secret_ref: str + :keyword identity: A Managed Identity to use to authenticate with Azure Container Registry. For + user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned + identities, use 'system'. + :paramtype identity: str """ super().__init__(**kwargs) - self.name = name - self.azure_queue = azure_queue - self.custom = custom - self.http = http - self.tcp = tcp + self.server = server + self.username = username + self.password_secret_ref = password_secret_ref + self.identity = identity -class ScaleRuleAuth(_serialization.Model): - """Auth Secrets for Scale Rule. +class SmbStorage(_serialization.Model): + """SMB storage properties. - :ivar secret_ref: Name of the secret from which to pull the auth params. - :vartype secret_ref: str - :ivar trigger_parameter: Trigger Parameter that uses the secret. - :vartype trigger_parameter: str + :ivar host: The host name or IP address of the SMB server. + :vartype host: str + :ivar share_name: The path to the SMB shared folder. + :vartype share_name: str + :ivar username: The user to log on to the SMB server. + :vartype username: str + :ivar domain: The domain name for the user. + :vartype domain: str + :ivar password: The password for the user. + :vartype password: str + :ivar access_mode: Access mode for storage. Known values are: "ReadOnly" and "ReadWrite". + :vartype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode """ _attribute_map = { - "secret_ref": {"key": "secretRef", "type": "str"}, - "trigger_parameter": {"key": "triggerParameter", "type": "str"}, + "host": {"key": "host", "type": "str"}, + "share_name": {"key": "shareName", "type": "str"}, + "username": {"key": "username", "type": "str"}, + "domain": {"key": "domain", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "access_mode": {"key": "accessMode", "type": "str"}, } def __init__( - self, *, secret_ref: Optional[str] = None, trigger_parameter: Optional[str] = None, **kwargs: Any + self, + *, + host: Optional[str] = None, + share_name: Optional[str] = None, + username: Optional[str] = None, + domain: Optional[str] = None, + password: Optional[str] = None, + access_mode: Optional[Union[str, "_models.AccessMode"]] = None, + **kwargs: Any ) -> None: """ - :keyword secret_ref: Name of the secret from which to pull the auth params. - :paramtype secret_ref: str - :keyword trigger_parameter: Trigger Parameter that uses the secret. - :paramtype trigger_parameter: str + :keyword host: The host name or IP address of the SMB server. + :paramtype host: str + :keyword share_name: The path to the SMB shared folder. + :paramtype share_name: str + :keyword username: The user to log on to the SMB server. + :paramtype username: str + :keyword domain: The domain name for the user. + :paramtype domain: str + :keyword password: The password for the user. + :paramtype password: str + :keyword access_mode: Access mode for storage. Known values are: "ReadOnly" and "ReadWrite". + :paramtype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode """ super().__init__(**kwargs) - self.secret_ref = secret_ref - self.trigger_parameter = trigger_parameter + self.host = host + self.share_name = share_name + self.username = username + self.domain = domain + self.password = password + self.access_mode = access_mode -class Secret(_serialization.Model): - """Secret definition. +class SourceControl(ProxyResource): + """Container App SourceControl. - :ivar name: Secret Name. + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. :vartype name: str - :ivar value: Secret Value. - :vartype value: str - :ivar identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or - System to use a system-assigned identity. - :vartype identity: str - :ivar key_vault_url: Azure Key Vault URL pointing to the secret referenced by the container - app. - :vartype key_vault_url: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar operation_state: Current provisioning State of the operation. Known values are: + "InProgress", "Succeeded", "Failed", and "Canceled". + :vartype operation_state: str or ~azure.mgmt.appcontainers.models.SourceControlOperationState + :ivar repo_url: The repo url which will be integrated to ContainerApp. + :vartype repo_url: str + :ivar branch: The branch which will trigger the auto deployment. + :vartype branch: str + :ivar github_action_configuration: Container App Revision Template with all possible settings + and the + defaults if user did not provide them. The defaults are populated + as they were at the creation time. + :vartype github_action_configuration: + ~azure.mgmt.appcontainers.models.GithubActionConfiguration """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "operation_state": {"readonly": True}, + } + _attribute_map = { + "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, - "identity": {"key": "identity", "type": "str"}, - "key_vault_url": {"key": "keyVaultUrl", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "operation_state": {"key": "properties.operationState", "type": "str"}, + "repo_url": {"key": "properties.repoUrl", "type": "str"}, + "branch": {"key": "properties.branch", "type": "str"}, + "github_action_configuration": { + "key": "properties.githubActionConfiguration", + "type": "GithubActionConfiguration", + }, } def __init__( self, *, - name: Optional[str] = None, - value: Optional[str] = None, - identity: Optional[str] = None, - key_vault_url: Optional[str] = None, + repo_url: Optional[str] = None, + branch: Optional[str] = None, + github_action_configuration: Optional["_models.GithubActionConfiguration"] = None, **kwargs: Any ) -> None: """ - :keyword name: Secret Name. - :paramtype name: str - :keyword value: Secret Value. - :paramtype value: str - :keyword identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or - System to use a system-assigned identity. - :paramtype identity: str - :keyword key_vault_url: Azure Key Vault URL pointing to the secret referenced by the container - app. - :paramtype key_vault_url: str + :keyword repo_url: The repo url which will be integrated to ContainerApp. + :paramtype repo_url: str + :keyword branch: The branch which will trigger the auto deployment. + :paramtype branch: str + :keyword github_action_configuration: Container App Revision Template with all possible + settings and the + defaults if user did not provide them. The defaults are populated + as they were at the creation time. + :paramtype github_action_configuration: + ~azure.mgmt.appcontainers.models.GithubActionConfiguration """ super().__init__(**kwargs) - self.name = name - self.value = value - self.identity = identity - self.key_vault_url = key_vault_url + self.operation_state = None + self.repo_url = repo_url + self.branch = branch + self.github_action_configuration = github_action_configuration -class SecretsCollection(_serialization.Model): - """Container App Secrets Collection ARM resource. +class SourceControlCollection(_serialization.Model): + """SourceControl collection ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.ContainerAppSecret] + :vartype value: list[~azure.mgmt.appcontainers.models.SourceControl] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ _validation = { "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[ContainerAppSecret]"}, + "value": {"key": "value", "type": "[SourceControl]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.ContainerAppSecret"], **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.SourceControl"], **kwargs: Any) -> None: """ :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.ContainerAppSecret] + :paramtype value: list[~azure.mgmt.appcontainers.models.SourceControl] """ super().__init__(**kwargs) self.value = value + self.next_link = None -class SecretVolumeItem(_serialization.Model): - """Secret to be added to volume. - - :ivar secret_ref: Name of the Container App secret from which to pull the secret value. - :vartype secret_ref: str - :ivar path: Path to project secret to. If no path is provided, path defaults to name of secret - listed in secretRef. - :vartype path: str - """ - - _attribute_map = { - "secret_ref": {"key": "secretRef", "type": "str"}, - "path": {"key": "path", "type": "str"}, - } - - def __init__(self, *, secret_ref: Optional[str] = None, path: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword secret_ref: Name of the Container App secret from which to pull the secret value. - :paramtype secret_ref: str - :keyword path: Path to project secret to. If no path is provided, path defaults to name of - secret listed in secretRef. - :paramtype path: str - """ - super().__init__(**kwargs) - self.secret_ref = secret_ref - self.path = path - +class SpringBootAdminComponent(JavaComponentProperties): + """Spring Boot Admin properties. -class Service(_serialization.Model): - """Container App to be a dev service. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. - :ivar type: Dev ContainerApp service type. Required. - :vartype type: str + :ivar component_type: Type of the Java Component. Required. Known values are: + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :ivar provisioning_state: Provisioning state of the Java Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState + :ivar configurations: List of Java Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar scale: Java component scaling configurations. + :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :ivar service_binds: List of Java Components that are bound to the Java component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :ivar ingress: Java Component Ingress configurations. + :vartype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress """ _validation = { - "type": {"required": True}, + "component_type": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - "type": {"key": "type", "type": "str"}, + "component_type": {"key": "componentType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "configurations": {"key": "configurations", "type": "[JavaComponentConfigurationProperty]"}, + "scale": {"key": "scale", "type": "JavaComponentPropertiesScale"}, + "service_binds": {"key": "serviceBinds", "type": "[JavaComponentServiceBind]"}, + "ingress": {"key": "ingress", "type": "JavaComponentIngress"}, } - def __init__(self, *, type: str, **kwargs: Any) -> None: - """ - :keyword type: Dev ContainerApp service type. Required. - :paramtype type: str + def __init__( + self, + *, + configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + scale: Optional["_models.JavaComponentPropertiesScale"] = None, + service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, + ingress: Optional["_models.JavaComponentIngress"] = None, + **kwargs: Any + ) -> None: """ - super().__init__(**kwargs) - self.type = type + :keyword configurations: List of Java Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :keyword scale: Java component scaling configurations. + :paramtype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :keyword service_binds: List of Java Components that are bound to the Java component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :keyword ingress: Java Component Ingress configurations. + :paramtype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress + """ + super().__init__(configurations=configurations, scale=scale, service_binds=service_binds, **kwargs) + self.component_type: str = "SpringBootAdmin" + self.ingress = ingress -class ServiceBind(_serialization.Model): - """Configuration to bind a ContainerApp to a dev ContainerApp Service. +class SpringCloudConfigComponent(JavaComponentProperties): + """Spring Cloud Config properties. - :ivar service_id: Resource id of the target service. - :vartype service_id: str - :ivar name: Name of the service bind. - :vartype name: str + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar component_type: Type of the Java Component. Required. Known values are: + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :ivar provisioning_state: Provisioning state of the Java Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState + :ivar configurations: List of Java Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar scale: Java component scaling configurations. + :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :ivar service_binds: List of Java Components that are bound to the Java component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] """ + _validation = { + "component_type": {"required": True}, + "provisioning_state": {"readonly": True}, + } + _attribute_map = { - "service_id": {"key": "serviceId", "type": "str"}, - "name": {"key": "name", "type": "str"}, + "component_type": {"key": "componentType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "configurations": {"key": "configurations", "type": "[JavaComponentConfigurationProperty]"}, + "scale": {"key": "scale", "type": "JavaComponentPropertiesScale"}, + "service_binds": {"key": "serviceBinds", "type": "[JavaComponentServiceBind]"}, } - def __init__(self, *, service_id: Optional[str] = None, name: Optional[str] = None, **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 + def __init__( + self, + *, + configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + scale: Optional["_models.JavaComponentPropertiesScale"] = None, + service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, + **kwargs: Any + ) -> None: """ - super().__init__(**kwargs) - self.service_id = service_id - self.name = name - - -class SourceControl(ProxyResource): - """Container App SourceControl. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar operation_state: Current provisioning State of the operation. Known values are: - "InProgress", "Succeeded", "Failed", and "Canceled". - :vartype operation_state: str or ~azure.mgmt.appcontainers.models.SourceControlOperationState - :ivar repo_url: The repo url which will be integrated to ContainerApp. - :vartype repo_url: str - :ivar branch: The branch which will trigger the auto deployment. - :vartype branch: str - :ivar github_action_configuration: Container App Revision Template with all possible settings - and the - defaults if user did not provide them. The defaults are populated - as they were at the creation time. - :vartype github_action_configuration: - ~azure.mgmt.appcontainers.models.GithubActionConfiguration + :keyword configurations: List of Java Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :keyword scale: Java component scaling configurations. + :paramtype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :keyword service_binds: List of Java Components that are bound to the Java component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + """ + super().__init__(configurations=configurations, scale=scale, service_binds=service_binds, **kwargs) + self.component_type: str = "SpringCloudConfig" + + +class SpringCloudEurekaComponent(JavaComponentProperties): + """Spring Cloud Eureka properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar component_type: Type of the Java Component. Required. Known values are: + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :ivar provisioning_state: Provisioning state of the Java Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState + :ivar configurations: List of Java Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar scale: Java component scaling configurations. + :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :ivar service_binds: List of Java Components that are bound to the Java component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :ivar ingress: Java Component Ingress configurations. + :vartype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "operation_state": {"readonly": True}, + "component_type": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "operation_state": {"key": "properties.operationState", "type": "str"}, - "repo_url": {"key": "properties.repoUrl", "type": "str"}, - "branch": {"key": "properties.branch", "type": "str"}, - "github_action_configuration": { - "key": "properties.githubActionConfiguration", - "type": "GithubActionConfiguration", - }, + "component_type": {"key": "componentType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "configurations": {"key": "configurations", "type": "[JavaComponentConfigurationProperty]"}, + "scale": {"key": "scale", "type": "JavaComponentPropertiesScale"}, + "service_binds": {"key": "serviceBinds", "type": "[JavaComponentServiceBind]"}, + "ingress": {"key": "ingress", "type": "JavaComponentIngress"}, } def __init__( self, *, - repo_url: Optional[str] = None, - branch: Optional[str] = None, - github_action_configuration: Optional["_models.GithubActionConfiguration"] = None, + configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + scale: Optional["_models.JavaComponentPropertiesScale"] = None, + service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, + ingress: Optional["_models.JavaComponentIngress"] = None, **kwargs: Any ) -> None: """ - :keyword repo_url: The repo url which will be integrated to ContainerApp. - :paramtype repo_url: str - :keyword branch: The branch which will trigger the auto deployment. - :paramtype branch: str - :keyword github_action_configuration: Container App Revision Template with all possible - settings and the - defaults if user did not provide them. The defaults are populated - as they were at the creation time. - :paramtype github_action_configuration: - ~azure.mgmt.appcontainers.models.GithubActionConfiguration - """ - super().__init__(**kwargs) - self.operation_state = None - self.repo_url = repo_url - self.branch = branch - self.github_action_configuration = github_action_configuration + :keyword configurations: List of Java Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :keyword scale: Java component scaling configurations. + :paramtype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :keyword service_binds: List of Java Components that are bound to the Java component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :keyword ingress: Java Component Ingress configurations. + :paramtype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress + """ + super().__init__(configurations=configurations, scale=scale, service_binds=service_binds, **kwargs) + self.component_type: str = "SpringCloudEureka" + self.ingress = ingress -class SourceControlCollection(_serialization.Model): - """SourceControl collection ARM resource. +class SpringCloudGatewayComponent(JavaComponentProperties): + """Spring Cloud Gateway properties. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.SourceControl] - :ivar next_link: Link to next page of resources. - :vartype next_link: str + :ivar component_type: Type of the Java Component. Required. Known values are: + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :ivar provisioning_state: Provisioning state of the Java Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState + :ivar configurations: List of Java Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar scale: Java component scaling configurations. + :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :ivar service_binds: List of Java Components that are bound to the Java component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :ivar ingress: Java Component Ingress configurations. + :vartype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress + :ivar spring_cloud_gateway_routes: Gateway route definition. + :vartype spring_cloud_gateway_routes: list[~azure.mgmt.appcontainers.models.ScgRoute] """ _validation = { - "value": {"required": True}, - "next_link": {"readonly": True}, + "component_type": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[SourceControl]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "component_type": {"key": "componentType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "configurations": {"key": "configurations", "type": "[JavaComponentConfigurationProperty]"}, + "scale": {"key": "scale", "type": "JavaComponentPropertiesScale"}, + "service_binds": {"key": "serviceBinds", "type": "[JavaComponentServiceBind]"}, + "ingress": {"key": "ingress", "type": "JavaComponentIngress"}, + "spring_cloud_gateway_routes": {"key": "springCloudGatewayRoutes", "type": "[ScgRoute]"}, } - def __init__(self, *, value: List["_models.SourceControl"], **kwargs: Any) -> None: - """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.SourceControl] + def __init__( + self, + *, + configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + scale: Optional["_models.JavaComponentPropertiesScale"] = None, + service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, + ingress: Optional["_models.JavaComponentIngress"] = None, + spring_cloud_gateway_routes: Optional[List["_models.ScgRoute"]] = None, + **kwargs: Any + ) -> None: """ - super().__init__(**kwargs) - self.value = value - self.next_link = None + :keyword configurations: List of Java Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :keyword scale: Java component scaling configurations. + :paramtype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :keyword service_binds: List of Java Components that are bound to the Java component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :keyword ingress: Java Component Ingress configurations. + :paramtype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress + :keyword spring_cloud_gateway_routes: Gateway route definition. + :paramtype spring_cloud_gateway_routes: list[~azure.mgmt.appcontainers.models.ScgRoute] + """ + super().__init__(configurations=configurations, scale=scale, service_binds=service_binds, **kwargs) + self.component_type: str = "SpringCloudGateway" + self.ingress = ingress + self.spring_cloud_gateway_routes = spring_cloud_gateway_routes class SystemData(_serialization.Model): @@ -7943,6 +13693,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. @@ -7950,11 +13740,15 @@ class TcpScaleRule(_serialization.Model): :vartype metadata: dict[str, str] :ivar auth: Authentication secrets for the tcp scale rule. :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :vartype identity: str """ _attribute_map = { "metadata": {"key": "metadata", "type": "{str}"}, "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "identity": {"key": "identity", "type": "str"}, } def __init__( @@ -7962,6 +13756,7 @@ def __init__( *, metadata: Optional[Dict[str, str]] = None, auth: Optional[List["_models.ScaleRuleAuth"]] = None, + identity: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -7969,10 +13764,14 @@ def __init__( :paramtype metadata: dict[str, str] :keyword auth: Authentication secrets for the tcp scale rule. :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :paramtype identity: str """ super().__init__(**kwargs) self.metadata = metadata self.auth = auth + self.identity = identity class Template(_serialization.Model): @@ -8052,6 +13851,40 @@ 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. @@ -8101,6 +13934,34 @@ def __init__( self.azure_blob_storage = azure_blob_storage +class TracesConfiguration(_serialization.Model): + """Configuration of Open Telemetry traces. + + :ivar include_dapr: Boolean indicating if including dapr traces. + :vartype include_dapr: bool + :ivar destinations: Open telemetry traces destinations. + :vartype destinations: list[str] + """ + + _attribute_map = { + "include_dapr": {"key": "includeDapr", "type": "bool"}, + "destinations": {"key": "destinations", "type": "[str]"}, + } + + def __init__( + self, *, include_dapr: Optional[bool] = None, destinations: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :keyword include_dapr: Boolean indicating if including dapr traces. + :paramtype include_dapr: bool + :keyword destinations: Open telemetry traces destinations. + :paramtype destinations: list[str] + """ + super().__init__(**kwargs) + self.include_dapr = include_dapr + self.destinations = destinations + + class TrafficWeight(_serialization.Model): """Traffic weight assigned to a revision. @@ -8394,15 +14255,15 @@ class Volume(_serialization.Model): :ivar name: Volume name. :vartype name: str :ivar storage_type: Storage type for the volume. If not provided, use EmptyDir. Known values - are: "AzureFile", "EmptyDir", and "Secret". + are: "AzureFile", "EmptyDir", "Secret", "NfsAzureFile", and "Smb". :vartype storage_type: str or ~azure.mgmt.appcontainers.models.StorageType :ivar storage_name: Name of storage resource. No need to provide for EmptyDir and Secret. :vartype storage_name: str :ivar secrets: List of secrets to be added in volume. If no secrets are provided, all secrets in collection will be added to volume. :vartype secrets: list[~azure.mgmt.appcontainers.models.SecretVolumeItem] - :ivar mount_options: Mount options used while mounting the AzureFile. Must be a comma-separated - string. + :ivar mount_options: Mount options used while mounting the Azure file share or NFS Azure file + share. Must be a comma-separated string. :vartype mount_options: str """ @@ -8428,15 +14289,15 @@ def __init__( :keyword name: Volume name. :paramtype name: str :keyword storage_type: Storage type for the volume. If not provided, use EmptyDir. Known values - are: "AzureFile", "EmptyDir", and "Secret". + are: "AzureFile", "EmptyDir", "Secret", "NfsAzureFile", and "Smb". :paramtype storage_type: str or ~azure.mgmt.appcontainers.models.StorageType :keyword storage_name: Name of storage resource. No need to provide for EmptyDir and Secret. :paramtype storage_name: str :keyword secrets: List of secrets to be added in volume. If no secrets are provided, all secrets in collection will be added to volume. :paramtype secrets: list[~azure.mgmt.appcontainers.models.SecretVolumeItem] - :keyword mount_options: Mount options used while mounting the AzureFile. Must be a - comma-separated string. + :keyword mount_options: Mount options used while mounting the Azure file share or NFS Azure + file share. Must be a comma-separated string. :paramtype mount_options: str """ super().__init__(**kwargs) @@ -8490,6 +14351,218 @@ def __init__( self.sub_path = sub_path +class WorkflowArtifacts(_serialization.Model): + """The workflow filter. + + :ivar app_settings: Application settings of the workflow. + :vartype app_settings: JSON + :ivar files: Files of the app. + :vartype files: JSON + :ivar files_to_delete: Files of the app to delete. + :vartype files_to_delete: list[str] + """ + + _attribute_map = { + "app_settings": {"key": "appSettings", "type": "object"}, + "files": {"key": "files", "type": "object"}, + "files_to_delete": {"key": "filesToDelete", "type": "[str]"}, + } + + def __init__( + self, + *, + app_settings: Optional[JSON] = None, + files: Optional[JSON] = None, + files_to_delete: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword app_settings: Application settings of the workflow. + :paramtype app_settings: JSON + :keyword files: Files of the app. + :paramtype files: JSON + :keyword files_to_delete: Files of the app to delete. + :paramtype files_to_delete: list[str] + """ + super().__init__(**kwargs) + self.app_settings = app_settings + self.files = files + self.files_to_delete = files_to_delete + + +class WorkflowEnvelope(_serialization.Model): + """Workflow properties definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource id. + :vartype id: str + :ivar name: Gets the resource name. + :vartype name: str + :ivar type: Gets the resource type. + :vartype type: str + :ivar kind: The resource kind. + :vartype kind: str + :ivar location: The resource location. + :vartype location: str + :ivar properties: Additional workflow properties. + :vartype properties: ~azure.mgmt.appcontainers.models.WorkflowEnvelopeProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "WorkflowEnvelopeProperties"}, + } + + def __init__( + self, + *, + kind: Optional[str] = None, + location: Optional[str] = None, + properties: Optional["_models.WorkflowEnvelopeProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword kind: The resource kind. + :paramtype kind: str + :keyword location: The resource location. + :paramtype location: str + :keyword properties: Additional workflow properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.WorkflowEnvelopeProperties + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.kind = kind + self.location = location + self.properties = properties + + +class WorkflowEnvelopeCollection(_serialization.Model): + """Collection of workflow information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.WorkflowEnvelope] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[WorkflowEnvelope]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.WorkflowEnvelope"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.WorkflowEnvelope] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class WorkflowEnvelopeProperties(_serialization.Model): + """Additional workflow properties. + + :ivar files: Gets or sets the files. + :vartype files: JSON + :ivar flow_state: Gets or sets the state of the workflow. Known values are: "NotSpecified", + "Completed", "Enabled", "Disabled", "Deleted", and "Suspended". + :vartype flow_state: str or ~azure.mgmt.appcontainers.models.WorkflowState + :ivar health: Gets or sets workflow health. + :vartype health: ~azure.mgmt.appcontainers.models.WorkflowHealth + """ + + _attribute_map = { + "files": {"key": "files", "type": "object"}, + "flow_state": {"key": "flowState", "type": "str"}, + "health": {"key": "health", "type": "WorkflowHealth"}, + } + + def __init__( + self, + *, + files: Optional[JSON] = None, + flow_state: Optional[Union[str, "_models.WorkflowState"]] = None, + health: Optional["_models.WorkflowHealth"] = None, + **kwargs: Any + ) -> None: + """ + :keyword files: Gets or sets the files. + :paramtype files: JSON + :keyword flow_state: Gets or sets the state of the workflow. Known values are: "NotSpecified", + "Completed", "Enabled", "Disabled", "Deleted", and "Suspended". + :paramtype flow_state: str or ~azure.mgmt.appcontainers.models.WorkflowState + :keyword health: Gets or sets workflow health. + :paramtype health: ~azure.mgmt.appcontainers.models.WorkflowHealth + """ + super().__init__(**kwargs) + self.files = files + self.flow_state = flow_state + self.health = health + + +class WorkflowHealth(_serialization.Model): + """Represents the workflow health. + + All required parameters must be populated in order to send to server. + + :ivar state: Gets or sets the workflow health state. Required. Known values are: + "NotSpecified", "Healthy", "Unhealthy", and "Unknown". + :vartype state: str or ~azure.mgmt.appcontainers.models.WorkflowHealthState + :ivar error: Gets or sets the workflow error. + :vartype error: ~azure.mgmt.appcontainers.models.ErrorEntity + """ + + _validation = { + "state": {"required": True}, + } + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + "error": {"key": "error", "type": "ErrorEntity"}, + } + + def __init__( + self, + *, + state: Union[str, "_models.WorkflowHealthState"], + error: Optional["_models.ErrorEntity"] = None, + **kwargs: Any + ) -> None: + """ + :keyword state: Gets or sets the workflow health state. Required. Known values are: + "NotSpecified", "Healthy", "Unhealthy", and "Unknown". + :paramtype state: str or ~azure.mgmt.appcontainers.models.WorkflowHealthState + :keyword error: Gets or sets the workflow error. + :paramtype error: ~azure.mgmt.appcontainers.models.ErrorEntity + """ + super().__init__(**kwargs) + self.state = state + self.error = error + + class WorkloadProfile(_serialization.Model): """Workload profile to scope container app execution. @@ -8497,6 +14570,9 @@ class WorkloadProfile(_serialization.Model): :ivar name: Workload profile type for the workloads to run on. Required. :vartype name: str + :ivar enable_fips: Whether to use a FIPS-enabled OS. Supported only for dedicated workload + profiles. + :vartype enable_fips: bool :ivar workload_profile_type: Workload profile type for the workloads to run on. Required. :vartype workload_profile_type: str :ivar minimum_count: The minimum capacity. @@ -8512,6 +14588,7 @@ class WorkloadProfile(_serialization.Model): _attribute_map = { "name": {"key": "name", "type": "str"}, + "enable_fips": {"key": "enableFips", "type": "bool"}, "workload_profile_type": {"key": "workloadProfileType", "type": "str"}, "minimum_count": {"key": "minimumCount", "type": "int"}, "maximum_count": {"key": "maximumCount", "type": "int"}, @@ -8522,6 +14599,7 @@ def __init__( *, name: str, workload_profile_type: str, + enable_fips: bool = False, minimum_count: Optional[int] = None, maximum_count: Optional[int] = None, **kwargs: Any @@ -8529,6 +14607,9 @@ def __init__( """ :keyword name: Workload profile type for the workloads to run on. Required. :paramtype name: str + :keyword enable_fips: Whether to use a FIPS-enabled OS. Supported only for dedicated workload + profiles. + :paramtype enable_fips: bool :keyword workload_profile_type: Workload profile type for the workloads to run on. Required. :paramtype workload_profile_type: str :keyword minimum_count: The minimum capacity. @@ -8538,6 +14619,7 @@ def __init__( """ super().__init__(**kwargs) self.name = name + self.enable_fips = enable_fips self.workload_profile_type = workload_profile_type self.minimum_count = minimum_count self.maximum_count = maximum_count @@ -8548,8 +14630,8 @@ class WorkloadProfileStates(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py index 1d1af7c18205..fed77a5ed4ea 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,29 +6,51 @@ # 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_by_builder_resource_operations import BuildsByBuilderResourceOperations +from ._builds_operations import BuildsOperations +from ._build_auth_token_operations import BuildAuthTokenOperations from ._connected_environments_operations import ConnectedEnvironmentsOperations from ._connected_environments_certificates_operations import ConnectedEnvironmentsCertificatesOperations from ._connected_environments_dapr_components_operations import ConnectedEnvironmentsDaprComponentsOperations from ._connected_environments_storages_operations import ConnectedEnvironmentsStoragesOperations from ._container_apps_operations import ContainerAppsOperations +from ._container_apps_builds_by_container_app_operations import ContainerAppsBuildsByContainerAppOperations +from ._container_apps_builds_operations import ContainerAppsBuildsOperations +from ._container_apps_patches_operations import ContainerAppsPatchesOperations +from ._container_apps_label_history_operations import ContainerAppsLabelHistoryOperations from ._container_apps_revisions_operations import ContainerAppsRevisionsOperations from ._container_apps_revision_replicas_operations import ContainerAppsRevisionReplicasOperations from ._container_apps_diagnostics_operations import ContainerAppsDiagnosticsOperations from ._managed_environment_diagnostics_operations import ManagedEnvironmentDiagnosticsOperations from ._managed_environments_diagnostics_operations import ManagedEnvironmentsDiagnosticsOperations from ._jobs_operations import JobsOperations +from ._dot_net_components_operations import DotNetComponentsOperations +from ._functions_extension_operations import FunctionsExtensionOperations from ._operations import Operations +from ._java_components_operations import JavaComponentsOperations from ._jobs_executions_operations import JobsExecutionsOperations from ._container_apps_api_client_operations import ContainerAppsAPIClientOperationsMixin +from ._logic_apps_operations import LogicAppsOperations from ._managed_environments_operations import ManagedEnvironmentsOperations from ._certificates_operations import CertificatesOperations from ._managed_certificates_operations import ManagedCertificatesOperations from ._namespaces_operations import NamespacesOperations +from ._managed_environment_private_endpoint_connections_operations import ( + ManagedEnvironmentPrivateEndpointConnectionsOperations, +) +from ._managed_environment_private_link_resources_operations import ManagedEnvironmentPrivateLinkResourcesOperations +from ._dapr_component_resiliency_policies_operations import DaprComponentResiliencyPoliciesOperations from ._dapr_components_operations import DaprComponentsOperations +from ._dapr_subscriptions_operations import DaprSubscriptionsOperations +from ._http_route_config_operations import HttpRouteConfigOperations +from ._maintenance_configurations_operations import MaintenanceConfigurationsOperations from ._managed_environments_storages_operations import ManagedEnvironmentsStoragesOperations +from ._container_apps_session_pools_operations import ContainerAppsSessionPoolsOperations from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations from ._usages_operations import UsagesOperations from ._managed_environment_usages_operations import ManagedEnvironmentUsagesOperations @@ -38,29 +60,49 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ + "AppResiliencyOperations", "ContainerAppsAuthConfigsOperations", "AvailableWorkloadProfilesOperations", "BillingMetersOperations", + "BuildersOperations", + "BuildsByBuilderResourceOperations", + "BuildsOperations", + "BuildAuthTokenOperations", "ConnectedEnvironmentsOperations", "ConnectedEnvironmentsCertificatesOperations", "ConnectedEnvironmentsDaprComponentsOperations", "ConnectedEnvironmentsStoragesOperations", "ContainerAppsOperations", + "ContainerAppsBuildsByContainerAppOperations", + "ContainerAppsBuildsOperations", + "ContainerAppsPatchesOperations", + "ContainerAppsLabelHistoryOperations", "ContainerAppsRevisionsOperations", "ContainerAppsRevisionReplicasOperations", "ContainerAppsDiagnosticsOperations", "ManagedEnvironmentDiagnosticsOperations", "ManagedEnvironmentsDiagnosticsOperations", "JobsOperations", + "DotNetComponentsOperations", + "FunctionsExtensionOperations", "Operations", + "JavaComponentsOperations", "JobsExecutionsOperations", "ContainerAppsAPIClientOperationsMixin", + "LogicAppsOperations", "ManagedEnvironmentsOperations", "CertificatesOperations", "ManagedCertificatesOperations", "NamespacesOperations", + "ManagedEnvironmentPrivateEndpointConnectionsOperations", + "ManagedEnvironmentPrivateLinkResourcesOperations", + "DaprComponentResiliencyPoliciesOperations", "DaprComponentsOperations", + "DaprSubscriptionsOperations", + "HttpRouteConfigOperations", + "MaintenanceConfigurationsOperations", "ManagedEnvironmentsStoragesOperations", + "ContainerAppsSessionPoolsOperations", "ContainerAppsSourceControlsOperations", "UsagesOperations", "ManagedEnvironmentUsagesOperations", 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..db8d88b4f4fc --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_app_resiliency_operations.py @@ -0,0 +1,731 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_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", "2024-10-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{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", "2024-10-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{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", "2024-10-02-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", "2024-10-02-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", "2024-10-02-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 + :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[bytes], + *, + 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[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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[bytes]], + **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[bytes] type. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO[bytes] + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @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 + :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[bytes], + *, + 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[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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[bytes]], + **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[bytes] type. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO[bytes] + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, 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 + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def 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 + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @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 + :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: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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) 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 8c26ddeffe62..19a6e58d1c47 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 @@ -27,7 +27,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -44,7 +43,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +52,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 531d90d1e903..0b43ed5ca647 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 @@ -25,7 +25,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -42,7 +41,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,7 +49,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/_build_auth_token_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_build_auth_token_operations.py new file mode 100644 index 000000000000..325b9ffa581a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_build_auth_token_operations.py @@ -0,0 +1,154 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, 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", "2024-10-02-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 BuildAuthTokenOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`build_auth_token` 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, 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 + :return: BuildToken or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildToken + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildToken] = kwargs.pop("cls", None) + + _request = build_list_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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildToken", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py new file mode 100644 index 000000000000..5577085edcaf --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py @@ -0,0 +1,980 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-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", "2024-10-02-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", "2024-10-02-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", "2024-10-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/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", "2024-10-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/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", "2024-10-02-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. + + :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: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.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 + :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: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, 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 + :return: BuilderResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuilderResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @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 + :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[bytes], + *, + 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[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either 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[bytes]], + **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[bytes] type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource or IO[bytes] + :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 + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BuilderResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BuilderResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + 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 + :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[bytes], + *, + 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[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either 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[bytes]], + **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[bytes] type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate or IO[bytes] + :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 + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BuilderResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BuilderResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, 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 + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_by_builder_resource_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_by_builder_resource_operations.py new file mode 100644 index 000000000000..5cb379b0db1c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_by_builder_resource_operations.py @@ -0,0 +1,174 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(resource_group_name: str, 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", "2024-10-02-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) + + +class BuildsByBuilderResourceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`builds_by_builder_resource` 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, 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 + :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: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py new file mode 100644 index 000000000000..7e0678221aa8 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py @@ -0,0 +1,567 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, 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", "2024-10-02-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", "2024-10-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/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", "2024-10-02-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) + + +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 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 + :return: BuildResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @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 + :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[bytes], + *, + 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[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either 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[bytes]], + **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[bytes] type. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource or IO[bytes] + :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 + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BuildResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BuildResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, 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 + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py index b52f67269b18..fc47999b7c38 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 @@ -28,7 +28,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -47,7 +46,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +55,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 ), @@ -80,7 +79,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +88,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 ), @@ -114,7 +113,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,7 +123,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 ), @@ -151,7 +150,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,7 +159,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 ), @@ -185,7 +184,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -195,7 +194,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 5ee5787e9b13..c192e8085d10 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 @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,18 +17,21 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -47,7 +50,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +59,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 ), @@ -84,7 +87,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +96,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 ), @@ -122,7 +125,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -132,7 +135,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 ), @@ -163,7 +166,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +175,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 ), @@ -201,7 +204,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -211,7 +214,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 ), @@ -400,8 +403,80 @@ def get( return deserialized # type: ignore + def _create_or_update_initial( + self, + resource_group_name: str, + connected_environment_name: str, + certificate_name: str, + certificate_envelope: Optional[Union[_models.Certificate, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_envelope, (IOBase, bytes)): + _content = certificate_envelope + else: + if certificate_envelope is not None: + _json = self._serialize.body(certificate_envelope, "Certificate") + else: + _json = None + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, @@ -410,7 +485,7 @@ def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Certificate: + ) -> LROPoller[_models.Certificate]: """Create or Update a Certificate. Create or Update a Certificate. @@ -427,13 +502,14 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of LROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, @@ -442,7 +518,7 @@ def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Certificate: + ) -> LROPoller[_models.Certificate]: """Create or Update a Certificate. Create or Update a Certificate. @@ -459,20 +535,21 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of LROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, certificate_name: str, certificate_envelope: Optional[Union[_models.Certificate, IO[bytes]]] = None, **kwargs: Any - ) -> _models.Certificate: + ) -> LROPoller[_models.Certificate]: """Create or Update a Certificate. Create or Update a Certificate. @@ -487,10 +564,64 @@ def create_or_update( :param certificate_envelope: Certificate to be created or updated. Is either a Certificate type or a IO[bytes] type. Default value is None. :type certificate_envelope: ~azure.mgmt.appcontainers.models.Certificate or IO[bytes] - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of LROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Certificate] :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.Certificate] = 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, + connected_environment_name=connected_environment_name, + certificate_name=certificate_name, + certificate_envelope=certificate_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Certificate", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Certificate].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Certificate]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, connected_environment_name: str, certificate_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -499,61 +630,55 @@ def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_envelope, (IOBase, bytes)): - _content = certificate_envelope - else: - if certificate_envelope is not None: - _json = self._serialize.body(certificate_envelope, "Certificate") - else: - _json = None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_create_or_update_request( + _request = build_delete_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, certificate_name=certificate_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, connected_environment_name: str, certificate_name: str, **kwargs: Any - ) -> None: + ) -> LROPoller[None]: """Deletes the specified Certificate. Deletes the specified Certificate. @@ -565,10 +690,61 @@ def delete( # pylint: disable=inconsistent-return-statements :type connected_environment_name: str :param certificate_name: Name of the Certificate. Required. :type certificate_name: str - :return: None or the result of cls(response) - :rtype: None + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + certificate_name=certificate_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + connected_environment_name: str, + certificate_name: str, + certificate_envelope: Union[_models.CertificatePatch, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -577,40 +753,65 @@ def delete( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_delete_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_envelope, (IOBase, bytes)): + _content = certificate_envelope + else: + _json = self._serialize.body(certificate_envelope, "CertificatePatch") + + _request = build_update_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, certificate_name=certificate_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload - def update( + def begin_update( self, resource_group_name: str, connected_environment_name: str, @@ -619,7 +820,7 @@ def update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Certificate: + ) -> LROPoller[_models.Certificate]: """Update properties of a certificate. Patches a certificate. Currently only patching of tags is supported. @@ -636,13 +837,14 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of LROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update( + def begin_update( self, resource_group_name: str, connected_environment_name: str, @@ -651,7 +853,7 @@ def update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Certificate: + ) -> LROPoller[_models.Certificate]: """Update properties of a certificate. Patches a certificate. Currently only patching of tags is supported. @@ -668,20 +870,21 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of LROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def update( + def begin_update( self, resource_group_name: str, connected_environment_name: str, certificate_name: str, certificate_envelope: Union[_models.CertificatePatch, IO[bytes]], **kwargs: Any - ) -> _models.Certificate: + ) -> LROPoller[_models.Certificate]: """Update properties of a certificate. Patches a certificate. Currently only patching of tags is supported. @@ -696,62 +899,57 @@ def update( :param certificate_envelope: Properties of a certificate that need to be updated. Is either a CertificatePatch type or a IO[bytes] type. Required. :type certificate_envelope: ~azure.mgmt.appcontainers.models.CertificatePatch or IO[bytes] - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of LROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Certificate] = 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, + connected_environment_name=connected_environment_name, + certificate_name=certificate_name, + certificate_envelope=certificate_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_envelope, (IOBase, bytes)): - _content = certificate_envelope - else: - _json = self._serialize.body(certificate_envelope, "CertificatePatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - connected_environment_name=connected_environment_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Certificate", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + 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[_models.Certificate].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Certificate]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Certificate", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_dapr_components_operations.py index e17fc47ace78..65b74b5a369e 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 @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,18 +17,21 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -47,7 +50,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +59,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 ), @@ -80,7 +83,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +92,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 ), @@ -114,7 +117,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,7 +127,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 ), @@ -151,7 +154,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,7 +163,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 ), @@ -185,7 +188,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +197,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 ), @@ -235,7 +238,7 @@ def __init__(self, *args, **kwargs): @distributed_trace def list( self, resource_group_name: str, connected_environment_name: str, **kwargs: Any - ) -> Iterable["_models.DaprComponent"]: + ) -> Iterable["_models.ConnectedEnvironmentDaprComponent"]: """Get the Dapr Components for a connected environment. Get the Dapr Components for a connected environment. @@ -245,15 +248,17 @@ def list( :type resource_group_name: str :param connected_environment_name: Name of the connected environment. Required. :type connected_environment_name: str - :return: An iterator like instance of either DaprComponent or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DaprComponent] + :return: An iterator like instance of either ConnectedEnvironmentDaprComponent or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent] :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.DaprComponentsCollection] = kwargs.pop("cls", None) + cls: ClsType[_models.ConnectedEnvironmentDaprComponentsCollection] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -294,7 +299,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("DaprComponentsCollection", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironmentDaprComponentsCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -321,7 +326,7 @@ def get_next(next_link=None): @distributed_trace def get( self, resource_group_name: str, connected_environment_name: str, component_name: str, **kwargs: Any - ) -> _models.DaprComponent: + ) -> _models.ConnectedEnvironmentDaprComponent: """Get a dapr component. Get a dapr component. @@ -333,8 +338,8 @@ def get( :type connected_environment_name: str :param component_name: Name of the Dapr Component. Required. :type component_name: str - :return: DaprComponent or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponent + :return: ConnectedEnvironmentDaprComponent or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -349,7 +354,7 @@ def get( _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.DaprComponent] = kwargs.pop("cls", None) + cls: ClsType[_models.ConnectedEnvironmentDaprComponent] = kwargs.pop("cls", None) _request = build_get_request( resource_group_name=resource_group_name, @@ -374,7 +379,76 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) + deserialized = self._deserialize("ConnectedEnvironmentDaprComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + connected_environment_name: str, + component_name: str, + dapr_component_envelope: Union[_models.ConnectedEnvironmentDaprComponent, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dapr_component_envelope, (IOBase, bytes)): + _content = dapr_component_envelope + else: + _json = self._serialize.body(dapr_component_envelope, "ConnectedEnvironmentDaprComponent") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -382,16 +456,16 @@ def get( return deserialized # type: ignore @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, component_name: str, - dapr_component_envelope: _models.DaprComponent, + dapr_component_envelope: _models.ConnectedEnvironmentDaprComponent, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DaprComponent: + ) -> LROPoller[_models.ConnectedEnvironmentDaprComponent]: """Creates or updates a Dapr Component. Creates or updates a Dapr Component in a connected environment. @@ -404,17 +478,20 @@ def create_or_update( :param component_name: Name of the Dapr Component. Required. :type component_name: str :param dapr_component_envelope: Configuration details of the Dapr Component. Required. - :type dapr_component_envelope: ~azure.mgmt.appcontainers.models.DaprComponent + :type dapr_component_envelope: + ~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: DaprComponent or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponent + :return: An instance of LROPoller that returns either ConnectedEnvironmentDaprComponent or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, @@ -423,7 +500,7 @@ def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DaprComponent: + ) -> LROPoller[_models.ConnectedEnvironmentDaprComponent]: """Creates or updates a Dapr Component. Creates or updates a Dapr Component in a connected environment. @@ -440,20 +517,22 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: DaprComponent or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponent + :return: An instance of LROPoller that returns either ConnectedEnvironmentDaprComponent or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, component_name: str, - dapr_component_envelope: Union[_models.DaprComponent, IO[bytes]], + dapr_component_envelope: Union[_models.ConnectedEnvironmentDaprComponent, IO[bytes]], **kwargs: Any - ) -> _models.DaprComponent: + ) -> LROPoller[_models.ConnectedEnvironmentDaprComponent]: """Creates or updates a Dapr Component. Creates or updates a Dapr Component in a connected environment. @@ -466,12 +545,68 @@ def create_or_update( :param component_name: Name of the Dapr Component. Required. :type component_name: str :param dapr_component_envelope: Configuration details of the Dapr Component. Is either a - DaprComponent type or a IO[bytes] type. Required. - :type dapr_component_envelope: ~azure.mgmt.appcontainers.models.DaprComponent or IO[bytes] - :return: DaprComponent or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponent + ConnectedEnvironmentDaprComponent type or a IO[bytes] type. Required. + :type dapr_component_envelope: + ~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent or IO[bytes] + :return: An instance of LROPoller that returns either ConnectedEnvironmentDaprComponent or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent] :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.ConnectedEnvironmentDaprComponent] = 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, + connected_environment_name=connected_environment_name, + component_name=component_name, + dapr_component_envelope=dapr_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConnectedEnvironmentDaprComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ConnectedEnvironmentDaprComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ConnectedEnvironmentDaprComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, connected_environment_name: str, component_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -480,58 +615,55 @@ def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DaprComponent] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dapr_component_envelope, (IOBase, bytes)): - _content = dapr_component_envelope - else: - _json = self._serialize.body(dapr_component_envelope, "DaprComponent") - - _request = build_create_or_update_request( + _request = build_delete_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, component_name=component_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, connected_environment_name: str, component_name: str, **kwargs: Any - ) -> None: + ) -> LROPoller[None]: """Delete a Dapr Component. Delete a Dapr Component from a connected environment. @@ -543,49 +675,52 @@ def delete( # pylint: disable=inconsistent-return-statements :type connected_environment_name: str :param component_name: Name of the Dapr Component. Required. :type component_name: str - :return: None or the result of cls(response) - :rtype: None + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + component_name=component_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - _request = build_delete_request( - resource_group_name=resource_group_name, - connected_environment_name=connected_environment_name, - component_name=component_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - if cls: - return cls(pipeline_response, None, {}) # type: ignore + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list_secrets( 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 8cc118ef41ed..812b37cbd79e 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 @@ -32,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -49,13 +48,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-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 @@ -73,7 +72,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +81,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 ), @@ -105,7 +104,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +113,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 ), @@ -138,7 +137,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -148,7 +147,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 ), @@ -174,7 +173,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,7 +182,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 ), @@ -207,7 +206,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -216,7 +215,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 ), @@ -240,7 +239,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -250,7 +249,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 b3af32c3d699..21e1db7d698c 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 @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,17 +16,20 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -45,7 +48,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +57,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 ), @@ -78,7 +81,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +90,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 ), @@ -112,7 +115,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -122,7 +125,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 ), @@ -149,7 +152,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +161,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 ), @@ -319,8 +322,77 @@ def get( return deserialized # type: ignore + def _create_or_update_initial( + self, + resource_group_name: str, + connected_environment_name: str, + storage_name: str, + storage_envelope: Union[_models.ConnectedEnvironmentStorage, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(storage_envelope, (IOBase, bytes)): + _content = storage_envelope + else: + _json = self._serialize.body(storage_envelope, "ConnectedEnvironmentStorage") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + storage_name=storage_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, @@ -329,7 +401,7 @@ def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ConnectedEnvironmentStorage: + ) -> LROPoller[_models.ConnectedEnvironmentStorage]: """Create or update storage for a connectedEnvironment. Create or update storage for a connectedEnvironment. @@ -346,13 +418,15 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ConnectedEnvironmentStorage or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage + :return: An instance of LROPoller that returns either ConnectedEnvironmentStorage or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, @@ -361,7 +435,7 @@ def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ConnectedEnvironmentStorage: + ) -> LROPoller[_models.ConnectedEnvironmentStorage]: """Create or update storage for a connectedEnvironment. Create or update storage for a connectedEnvironment. @@ -378,20 +452,22 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: ConnectedEnvironmentStorage or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage + :return: An instance of LROPoller that returns either ConnectedEnvironmentStorage or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, storage_name: str, storage_envelope: Union[_models.ConnectedEnvironmentStorage, IO[bytes]], **kwargs: Any - ) -> _models.ConnectedEnvironmentStorage: + ) -> LROPoller[_models.ConnectedEnvironmentStorage]: """Create or update storage for a connectedEnvironment. Create or update storage for a connectedEnvironment. @@ -407,10 +483,65 @@ def create_or_update( ConnectedEnvironmentStorage type or a IO[bytes] type. Required. :type storage_envelope: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage or IO[bytes] - :return: ConnectedEnvironmentStorage or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage + :return: An instance of LROPoller that returns either ConnectedEnvironmentStorage or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage] :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.ConnectedEnvironmentStorage] = 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, + connected_environment_name=connected_environment_name, + storage_name=storage_name, + storage_envelope=storage_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ConnectedEnvironmentStorage].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ConnectedEnvironmentStorage]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, connected_environment_name: str, storage_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -419,58 +550,55 @@ def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConnectedEnvironmentStorage] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_envelope, (IOBase, bytes)): - _content = storage_envelope - else: - _json = self._serialize.body(storage_envelope, "ConnectedEnvironmentStorage") - - _request = build_create_or_update_request( + _request = build_delete_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, storage_name=storage_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, connected_environment_name: str, storage_name: str, **kwargs: Any - ) -> None: + ) -> LROPoller[None]: """Delete storage for a connectedEnvironment. Delete storage for a connectedEnvironment. @@ -482,46 +610,49 @@ def delete( # pylint: disable=inconsistent-return-statements :type connected_environment_name: str :param storage_name: Name of the storage. Required. :type storage_name: str - :return: None or the result of cls(response) - :rtype: None + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - connected_environment_name=connected_environment_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + storage_name=storage_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py index 1d368cb997b1..90018f385669 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 @@ -44,7 +44,7 @@ def build_job_execution_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +53,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 ), @@ -80,7 +80,7 @@ def build_get_custom_domain_verification_id_request( # pylint: disable=name-too _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +88,7 @@ def build_get_custom_domain_verification_id_request( # pylint: disable=name-too "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/getCustomDomainVerificationId" ) # 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"), } _url: str = _url.format(**path_format_arguments) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py index 9a3a95761f7a..240da8f023cd 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 @@ -28,7 +28,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -47,7 +46,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +55,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 ), @@ -80,7 +79,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +88,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 ), @@ -114,7 +113,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,7 +123,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 ), @@ -151,7 +150,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,7 +159,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_builds_by_container_app_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_by_container_app_operations.py new file mode 100644 index 000000000000..e00a7631b1e0 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_by_container_app_operations.py @@ -0,0 +1,180 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, container_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/builds", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ContainerAppsBuildsByContainerAppOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_builds_by_container_app` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, container_app_name: str, **kwargs: Any + ) -> Iterable["_models.ContainerAppsBuildResource"]: + """List Container Apps Build resources by Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :return: An iterator like instance of either ContainerAppsBuildResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ContainerAppsBuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsBuildCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ContainerAppsBuildCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_operations.py new file mode 100644 index 000000000000..6e061fd965ff --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_operations.py @@ -0,0 +1,314 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterator, Optional, Type, TypeVar, Union, cast + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, container_app_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/builds/{buildName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "buildName": _SERIALIZER.url( + "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, container_app_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/builds/{buildName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "buildName": _SERIALIZER.url( + "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ContainerAppsBuildsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_builds` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> _models.ContainerAppsBuildResource: + """Get a Container Apps Build resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: ContainerAppsBuildResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ContainerAppsBuildResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsBuildResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ContainerAppsBuildResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a Container Apps Build resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_diagnostics_operations.py index e44dfadc1c0c..efbb6f2c5576 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 @@ -27,7 +27,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -46,7 +45,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +54,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 ), @@ -79,7 +78,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +87,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 ), @@ -118,7 +117,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +126,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 ), @@ -153,7 +152,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +161,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 ), @@ -187,7 +186,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -196,7 +195,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_label_history_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_label_history_operations.py new file mode 100644 index 000000000000..1037088ab3d6 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_label_history_operations.py @@ -0,0 +1,289 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_label_history_request( + resource_group_name: str, + container_app_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/labelHistory", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_label_history_request( + resource_group_name: str, container_app_name: str, label_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/labelHistory/{labelName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "labelName": _SERIALIZER.url("label_name", label_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 ContainerAppsLabelHistoryOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_label_history` 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_label_history( + self, resource_group_name: str, container_app_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.LabelHistory"]: + """Get the Label History for a given Container App. + + Get the Label History for a given Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param filter: The filter to apply on the operation. Default value is None. + :type filter: str + :return: An iterator like instance of either LabelHistory or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.LabelHistory] + :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.LabelHistoryCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_label_history_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("LabelHistoryCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_label_history( + self, resource_group_name: str, container_app_name: str, label_name: str, **kwargs: Any + ) -> _models.LabelHistory: + """Get the history of a label. + + Get the history of a label. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param label_name: Name of the Container App label. Required. + :type label_name: str + :return: LabelHistory or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LabelHistory + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabelHistory] = kwargs.pop("cls", None) + + _request = build_get_label_history_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + label_name=label_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LabelHistory", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py index 00cdac90d313..17c9803e0fd4 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 @@ -32,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -49,13 +48,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-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 @@ -73,7 +72,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +81,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 ), @@ -105,7 +104,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +113,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 ), @@ -138,7 +137,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -148,7 +147,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 ), @@ -174,7 +173,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,7 +182,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 ), @@ -207,7 +206,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -217,7 +216,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 ), @@ -248,7 +247,7 @@ def build_list_custom_host_name_analysis_request( # pylint: disable=name-too-lo _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -257,7 +256,7 @@ def build_list_custom_host_name_analysis_request( # pylint: disable=name-too-lo "/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 ), @@ -283,7 +282,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -292,7 +291,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 ), @@ -316,7 +315,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -325,7 +324,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 ), @@ -349,7 +348,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -358,7 +357,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 ), @@ -384,7 +383,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -393,7 +392,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_patches_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_patches_operations.py new file mode 100644 index 000000000000..174d1f7dd566 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_patches_operations.py @@ -0,0 +1,856 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_container_app_request( + resource_group_name: str, + container_app_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, container_app_name: str, patch_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches/{patchName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "patchName": _SERIALIZER.url( + "patch_name", patch_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, container_app_name: str, patch_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches/{patchName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "patchName": _SERIALIZER.url( + "patch_name", patch_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_skip_configure_request( + resource_group_name: str, container_app_name: str, patch_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches/{patchName}/skipConfig", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "patchName": _SERIALIZER.url( + "patch_name", patch_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_apply_request( + resource_group_name: str, container_app_name: str, patch_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches/{patchName}/apply", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "patchName": _SERIALIZER.url( + "patch_name", patch_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ContainerAppsPatchesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_patches` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_container_app( + self, resource_group_name: str, container_app_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.ContainerAppsPatchResource"]: + """List Container Apps Patch resources by ContainerApp. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param filter: The filter to apply on the operation. For example, + $filter=properties/patchApplyStatus eq 'Succeeded'. Default value is None. + :type filter: str + :return: An iterator like instance of either ContainerAppsPatchResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PatchCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_container_app_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PatchCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> _models.ContainerAppsPatchResource: + """Get details for specific Container Apps Patch by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: ContainerAppsPatchResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ContainerAppsPatchResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsPatchResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ContainerAppsPatchResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete specific Container Apps Patch by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _skip_configure_initial( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: Union[_models.PatchSkipConfig, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(patch_skip_config, (IOBase, bytes)): + _content = patch_skip_config + else: + _json = self._serialize.body(patch_skip_config, "PatchSkipConfig") + + _request = build_skip_configure_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: _models.PatchSkipConfig, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Required. + :type patch_skip_config: ~azure.mgmt.appcontainers.models.PatchSkipConfig + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Required. + :type patch_skip_config: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: Union[_models.PatchSkipConfig, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Is either a PatchSkipConfig + type or a IO[bytes] type. Required. + :type patch_skip_config: ~azure.mgmt.appcontainers.models.PatchSkipConfig or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._skip_configure_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + patch_skip_config=patch_skip_config, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _apply_initial( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_apply_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_apply( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> LROPoller[_models.ContainerAppsPatchResource]: + """Apply a Container Apps Patch resource with patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: An instance of LROPoller that returns either ContainerAppsPatchResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsPatchResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._apply_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ContainerAppsPatchResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ContainerAppsPatchResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ContainerAppsPatchResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py index d268ee7cc212..0d0caeed41b4 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 @@ -25,7 +25,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -49,7 +48,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +57,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 ), @@ -84,7 +83,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +92,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 cfe88374040c..d55d277896b1 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 @@ -27,7 +27,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -51,7 +50,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +59,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 ), @@ -86,7 +85,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +94,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 ), @@ -120,7 +119,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +128,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 ), @@ -154,7 +153,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -163,7 +162,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 ), @@ -188,7 +187,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -197,7 +196,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_session_pools_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_session_pools_operations.py new file mode 100644 index 000000000000..f24cfbfff7bf --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_session_pools_operations.py @@ -0,0 +1,997 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/sessionPools") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, session_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sessionPoolName": _SERIALIZER.url( + "session_pool_name", session_pool_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, session_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sessionPoolName": _SERIALIZER.url( + "session_pool_name", session_pool_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, session_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sessionPoolName": _SERIALIZER.url( + "session_pool_name", session_pool_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, session_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sessionPoolName": _SERIALIZER.url( + "session_pool_name", session_pool_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ContainerAppsSessionPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_session_pools` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SessionPool"]: + """Get the session pools in a given subscription. + + Get the session pools in a given subscription. + + :return: An iterator like instance of either SessionPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionPoolCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SessionPoolCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SessionPool"]: + """Get the session pools in a given resource group of a subscription. + + Get the session pools in a given resource group of a subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either SessionPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionPoolCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SessionPoolCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, session_pool_name: str, **kwargs: Any) -> _models.SessionPool: + """Get the properties of a session pool. + + Get the properties of a session pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :return: SessionPool or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.SessionPool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionPool] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionPool", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: Union[_models.SessionPool, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_pool_envelope, (IOBase, bytes)): + _content = session_pool_envelope + else: + _json = self._serialize.body(session_pool_envelope, "SessionPool") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: _models.SessionPool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionPool]: + """Create or update a session pool. + + Create or update a session pool with the given properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionPool]: + """Create or update a session pool. + + Create or update a session pool with the given properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: Union[_models.SessionPool, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.SessionPool]: + """Create or update a session pool. + + Create or update a session pool with the given properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Is either a SessionPool + type or a IO[bytes] type. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPool or IO[bytes] + :return: An instance of LROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SessionPool] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + session_pool_envelope=session_pool_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SessionPool", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.SessionPool].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SessionPool]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: Union[_models.SessionPoolUpdatableProperties, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_pool_envelope, (IOBase, bytes)): + _content = session_pool_envelope + else: + _json = self._serialize.body(session_pool_envelope, "SessionPoolUpdatableProperties") + + _request = build_update_request( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: _models.SessionPoolUpdatableProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionPool]: + """Update properties of a session pool. + + Patches a session pool using JSON merge patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPoolUpdatableProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionPool]: + """Update properties of a session pool. + + Patches a session pool using JSON merge patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: Union[_models.SessionPoolUpdatableProperties, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.SessionPool]: + """Update properties of a session pool. + + Patches a session pool using JSON merge patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Is either a + SessionPoolUpdatableProperties type or a IO[bytes] type. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPoolUpdatableProperties or + IO[bytes] + :return: An instance of LROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SessionPool] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + session_pool_envelope=session_pool_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SessionPool", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.SessionPool].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SessionPool]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, session_pool_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, session_pool_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a session pool. + + Delete the session pool with the given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py index 16bfd652f7ff..88d9271bb8ae 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 @@ -32,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -51,7 +50,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +59,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 ), @@ -84,7 +83,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +92,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 ), @@ -113,12 +112,18 @@ def build_get_request( def build_create_or_update_request( - resource_group_name: str, container_app_name: str, source_control_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + container_app_name: str, + source_control_name: str, + subscription_id: str, + *, + x_ms_github_auxiliary: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +133,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 ), @@ -142,6 +147,8 @@ def build_create_or_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if x_ms_github_auxiliary is not None: + _headers["x-ms-github-auxiliary"] = _SERIALIZER.header("x_ms_github_auxiliary", x_ms_github_auxiliary, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -150,12 +157,20 @@ def build_create_or_update_request( def build_delete_request( - resource_group_name: str, container_app_name: str, source_control_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + container_app_name: str, + source_control_name: str, + subscription_id: str, + *, + x_ms_github_auxiliary: Optional[str] = None, + ignore_workflow_deletion_failure: Optional[bool] = None, + delete_workflow: Optional[bool] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +179,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 ), @@ -175,9 +190,17 @@ def build_delete_request( _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + if ignore_workflow_deletion_failure is not None: + _params["ignoreWorkflowDeletionFailure"] = _SERIALIZER.query( + "ignore_workflow_deletion_failure", ignore_workflow_deletion_failure, "bool" + ) + if delete_workflow is not None: + _params["deleteWorkflow"] = _SERIALIZER.query("delete_workflow", delete_workflow, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if x_ms_github_auxiliary is not None: + _headers["x-ms-github-auxiliary"] = _SERIALIZER.header("x_ms_github_auxiliary", x_ms_github_auxiliary, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) @@ -357,6 +380,7 @@ def _create_or_update_initial( container_app_name: str, source_control_name: str, source_control_envelope: Union[_models.SourceControl, IO[bytes]], + x_ms_github_auxiliary: Optional[str] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -387,6 +411,7 @@ def _create_or_update_initial( container_app_name=container_app_name, source_control_name=source_control_name, subscription_id=self._config.subscription_id, + x_ms_github_auxiliary=x_ms_github_auxiliary, api_version=api_version, content_type=content_type, json=_json, @@ -427,6 +452,7 @@ def begin_create_or_update( container_app_name: str, source_control_name: str, source_control_envelope: _models.SourceControl, + x_ms_github_auxiliary: Optional[str] = None, *, content_type: str = "application/json", **kwargs: Any @@ -445,6 +471,9 @@ def begin_create_or_update( :param source_control_envelope: Properties used to create a Container App SourceControl. Required. :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -461,6 +490,7 @@ def begin_create_or_update( container_app_name: str, source_control_name: str, source_control_envelope: IO[bytes], + x_ms_github_auxiliary: Optional[str] = None, *, content_type: str = "application/json", **kwargs: Any @@ -479,6 +509,9 @@ def begin_create_or_update( :param source_control_envelope: Properties used to create a Container App SourceControl. Required. :type source_control_envelope: IO[bytes] + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -495,6 +528,7 @@ def begin_create_or_update( container_app_name: str, source_control_name: str, source_control_envelope: Union[_models.SourceControl, IO[bytes]], + x_ms_github_auxiliary: Optional[str] = None, **kwargs: Any ) -> LROPoller[_models.SourceControl]: """Create or update the SourceControl for a Container App. @@ -511,6 +545,9 @@ def begin_create_or_update( :param source_control_envelope: Properties used to create a Container App SourceControl. Is either a SourceControl type or a IO[bytes] type. Required. :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl or IO[bytes] + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str :return: An instance of LROPoller that returns either SourceControl or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SourceControl] @@ -531,6 +568,7 @@ def begin_create_or_update( container_app_name=container_app_name, source_control_name=source_control_name, source_control_envelope=source_control_envelope, + x_ms_github_auxiliary=x_ms_github_auxiliary, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -565,7 +603,14 @@ def get_long_running_output(pipeline_response): ) def _delete_initial( - self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any + self, + resource_group_name: str, + container_app_name: str, + source_control_name: str, + x_ms_github_auxiliary: Optional[str] = None, + ignore_workflow_deletion_failure: Optional[bool] = None, + delete_workflow: Optional[bool] = None, + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -586,6 +631,9 @@ def _delete_initial( container_app_name=container_app_name, source_control_name=source_control_name, subscription_id=self._config.subscription_id, + x_ms_github_auxiliary=x_ms_github_auxiliary, + ignore_workflow_deletion_failure=ignore_workflow_deletion_failure, + delete_workflow=delete_workflow, api_version=api_version, headers=_headers, params=_params, @@ -618,7 +666,14 @@ def _delete_initial( @distributed_trace def begin_delete( - self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any + self, + resource_group_name: str, + container_app_name: str, + source_control_name: str, + x_ms_github_auxiliary: Optional[str] = None, + ignore_workflow_deletion_failure: Optional[bool] = None, + delete_workflow: Optional[bool] = None, + **kwargs: Any ) -> LROPoller[None]: """Delete a Container App SourceControl. @@ -631,6 +686,14 @@ def begin_delete( :type container_app_name: str :param source_control_name: Name of the Container App SourceControl. Required. :type source_control_name: str + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str + :param ignore_workflow_deletion_failure: Ignore Workflow Deletion Failure. Default value is + None. + :type ignore_workflow_deletion_failure: bool + :param delete_workflow: Delete workflow. Default value is None. + :type delete_workflow: bool :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -648,6 +711,9 @@ def begin_delete( resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, + x_ms_github_auxiliary=x_ms_github_auxiliary, + ignore_workflow_deletion_failure=ignore_workflow_deletion_failure, + delete_workflow=delete_workflow, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, 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..810e672a5c2e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_component_resiliency_policies_operations.py @@ -0,0 +1,583 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, 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", "2024-10-02-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", "2024-10-02-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", "2024-10-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/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", "2024-10-02-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: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`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 + :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: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + @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 + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + 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 + :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[bytes], + *, + 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[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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[bytes]], + **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[bytes] type. + Required. + :type dapr_component_resiliency_policy_envelope: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy or IO[bytes] + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, 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 + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore 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 a73f5b7efe74..271972c3c708 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 @@ -28,7 +28,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -47,7 +46,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +55,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 ), @@ -80,7 +79,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +88,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 ), @@ -114,7 +113,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,7 +123,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 ), @@ -151,7 +150,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,7 +159,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 ), @@ -185,7 +184,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +193,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..a31af5584136 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_subscriptions_operations.py @@ -0,0 +1,554 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-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", "2024-10-02-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", "2024-10-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/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", "2024-10-02-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 + :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: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("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) + + @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 + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprSubscription", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + 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 + :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[bytes], + *, + 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[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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[bytes]], + **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[bytes] type. Required. + :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription or + IO[bytes] + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprSubscription", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, 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 + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dot_net_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dot_net_components_operations.py new file mode 100644 index 000000000000..246f97db6b85 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dot_net_components_operations.py @@ -0,0 +1,932 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents", + ) # 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", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{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", 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, 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", "2024-10-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{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", 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, 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", "2024-10-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{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", 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, 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", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{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", 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 DotNetComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`dot_net_components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> Iterable["_models.DotNetComponent"]: + """Get the .NET Components for a managed environment. + + Get the .NET Components 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 + :return: An iterator like instance of either DotNetComponent or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DotNetComponent] + :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.DotNetComponentsCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DotNetComponentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any) -> _models.DotNetComponent: + """Get a .NET Component. + + Get a .NET 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 name: Name of the .NET Component. Required. + :type name: str + :return: DotNetComponent or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DotNetComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DotNetComponent] = 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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dot_net_component_envelope, (IOBase, bytes)): + _content = dot_net_component_envelope + else: + _json = self._serialize.body(dot_net_component_envelope, "DotNetComponent") + + _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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: _models.DotNetComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component 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 .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component 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 .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component 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 .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Is either a + DotNetComponent type or a IO[bytes] type. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent or IO[bytes] + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :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.DotNetComponent] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + dot_net_component_envelope=dot_net_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DotNetComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DotNetComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dot_net_component_envelope, (IOBase, bytes)): + _content = dot_net_component_envelope + else: + _json = self._serialize.body(dot_net_component_envelope, "DotNetComponent") + + _request = build_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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: _models.DotNetComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Is either a + DotNetComponent type or a IO[bytes] type. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent or IO[bytes] + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :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.DotNetComponent] = 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, + environment_name=environment_name, + name=name, + dot_net_component_envelope=dot_net_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DotNetComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DotNetComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a .NET Component. + + Delete a .NET 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 name: Name of the .NET Component. Required. + :type name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_functions_extension_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_functions_extension_operations.py new file mode 100644 index 000000000000..a1ecfbecd7ea --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_functions_extension_operations.py @@ -0,0 +1,170 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_invoke_functions_host_request( + resource_group_name: str, + container_app_name: str, + revision_name: str, + function_app_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/providers/Microsoft.App/functions/{functionAppName}/invoke", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "revisionName": _SERIALIZER.url("revision_name", revision_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "functionAppName": _SERIALIZER.url("function_app_name", function_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class FunctionsExtensionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`functions_extension` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def invoke_functions_host( + self, + resource_group_name: str, + container_app_name: str, + revision_name: str, + function_app_name: str, + **kwargs: Any + ) -> str: + """Proxies a Functions host call to the function app backed by the container app. + + Proxies a Functions host call to the function app backed by the container app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param revision_name: Name of the Container App Revision, the parent resource. Required. + :type revision_name: str + :param function_app_name: Name of the Function App, the extension resource. Required. + :type function_app_name: str + :return: str or the result of cls(response) + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_invoke_functions_host_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + revision_name=revision_name, + function_app_name=function_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("str", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_http_route_config_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_http_route_config_operations.py new file mode 100644 index 000000000000..6d48916b807f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_http_route_config_operations.py @@ -0,0 +1,750 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, environment_name: str, http_route_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/httpRouteConfigs/{httpRouteName}", + ) # 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\._\(\)]+$"), + "httpRouteName": _SERIALIZER.url( + "http_route_name", http_route_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, environment_name: str, http_route_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/httpRouteConfigs/{httpRouteName}", + ) # 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\._\(\)]+$"), + "httpRouteName": _SERIALIZER.url( + "http_route_name", http_route_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, environment_name: str, http_route_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/httpRouteConfigs/{httpRouteName}", + ) # 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"), + "httpRouteName": _SERIALIZER.url("http_route_name", http_route_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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, environment_name: str, http_route_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/httpRouteConfigs/{httpRouteName}", + ) # 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\._\(\)]+$"), + "httpRouteName": _SERIALIZER.url( + "http_route_name", http_route_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/httpRouteConfigs", + ) # 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 HttpRouteConfigOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`http_route_config` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, environment_name: str, http_route_name: str, **kwargs: Any + ) -> _models.HttpRouteConfig: + """Get the specified Managed Http Route Config. + + Get the specified Managed Http Route Config. + + :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 http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.HttpRouteConfig] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + http_route_name=http_route_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HttpRouteConfig", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: Optional[_models.HttpRouteConfig] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Create or Update a Http Route Config. + + Create or Update a Http Route Config. + + :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 http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Http Route config to be created or updated. Default value is + None. + :type http_route_config_envelope: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Create or Update a Http Route Config. + + Create or Update a Http Route Config. + + :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 http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Http Route config to be created or updated. Default value is + None. + :type http_route_config_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: Optional[Union[_models.HttpRouteConfig, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Create or Update a Http Route Config. + + Create or Update a Http Route Config. + + :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 http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Http Route config to be created or updated. Is either a + HttpRouteConfig type or a IO[bytes] type. Default value is None. + :type http_route_config_envelope: ~azure.mgmt.appcontainers.models.HttpRouteConfig or IO[bytes] + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HttpRouteConfig] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(http_route_config_envelope, (IOBase, bytes)): + _content = http_route_config_envelope + else: + if http_route_config_envelope is not None: + _json = self._serialize.body(http_route_config_envelope, "HttpRouteConfig") + else: + _json = None + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + http_route_name=http_route_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HttpRouteConfig", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: _models.HttpRouteConfig, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Update tags of a manged http route object. + + Patches an http route config resource. Only patching of tags is supported. + + :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 http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Properties of http route config that need to be updated. + Required. + :type http_route_config_envelope: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Update tags of a manged http route object. + + Patches an http route config resource. Only patching of tags is supported. + + :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 http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Properties of http route config that need to be updated. + Required. + :type http_route_config_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: Union[_models.HttpRouteConfig, IO[bytes]], + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Update tags of a manged http route object. + + Patches an http route config resource. Only patching of tags is supported. + + :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 http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Properties of http route config that need to be updated. Is + either a HttpRouteConfig type or a IO[bytes] type. Required. + :type http_route_config_envelope: ~azure.mgmt.appcontainers.models.HttpRouteConfig or IO[bytes] + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HttpRouteConfig] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(http_route_config_envelope, (IOBase, bytes)): + _content = http_route_config_envelope + else: + _json = self._serialize.body(http_route_config_envelope, "HttpRouteConfig") + + _request = build_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + http_route_name=http_route_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HttpRouteConfig", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, http_route_name: str, **kwargs: Any + ) -> None: + """Deletes the specified Managed Http Route. + + Deletes the specified Managed Http Route. + + :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 http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + http_route_name=http_route_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> Iterable["_models.HttpRouteConfig"]: + """Get the Managed Http Routes in a given managed environment. + + Get the Managed Http Routes in a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either HttpRouteConfig or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.HttpRouteConfig] + :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.HttpRouteConfigCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("HttpRouteConfigCollection", 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) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py new file mode 100644 index 000000000000..4f2b95d2929a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py @@ -0,0 +1,930 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents", + ) # 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", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{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", 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, 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", "2024-10-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{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", 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, 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", "2024-10-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{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", 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, 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", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{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", 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 JavaComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`java_components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> Iterable["_models.JavaComponent"]: + """Get the Java Components for a managed environment. + + Get the Java Components 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 + :return: An iterator like instance of either JavaComponent or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.JavaComponent] + :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.JavaComponentsCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("JavaComponentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any) -> _models.JavaComponent: + """Get a Java Component. + + Get a Java 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 name: Name of the Java Component. Required. + :type name: str + :return: JavaComponent or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.JavaComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.JavaComponent] = 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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("JavaComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(java_component_envelope, (IOBase, bytes)): + _content = java_component_envelope + else: + _json = self._serialize.body(java_component_envelope, "JavaComponent") + + _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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: _models.JavaComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JavaComponent]: + """Creates or updates a Java Component. + + Creates or updates a Java Component 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 Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JavaComponent]: + """Creates or updates a Java Component. + + Creates or updates a Java Component 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 Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.JavaComponent]: + """Creates or updates a Java Component. + + Creates or updates a Java Component 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 Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Is either a + JavaComponent type or a IO[bytes] type. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent or IO[bytes] + :return: An instance of LROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :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.JavaComponent] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + java_component_envelope=java_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JavaComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.JavaComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.JavaComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(java_component_envelope, (IOBase, bytes)): + _content = java_component_envelope + else: + _json = self._serialize.body(java_component_envelope, "JavaComponent") + + _request = build_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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: _models.JavaComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JavaComponent]: + """Update properties of a Java Component. + + Patches a Java Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JavaComponent]: + """Update properties of a Java Component. + + Patches a Java Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.JavaComponent]: + """Update properties of a Java Component. + + Patches a Java Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Is either a + JavaComponent type or a IO[bytes] type. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent or IO[bytes] + :return: An instance of LROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :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.JavaComponent] = 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, + environment_name=environment_name, + name=name, + java_component_envelope=java_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JavaComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.JavaComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.JavaComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a Java Component. + + Delete a Java 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 name: Name of the Java Component. Required. + :type name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_executions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_executions_operations.py index 2a817c4e35f7..fd225be62508 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 @@ -27,7 +27,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -46,7 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +54,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 823ccca2a63e..ad44309ef2cb 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 @@ -32,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -51,7 +50,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +59,7 @@ def build_list_detectors_request( "/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", 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 ), @@ -84,7 +83,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +92,7 @@ def build_get_detector_request( "/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", 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 +117,7 @@ def build_proxy_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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +126,7 @@ def build_proxy_get_request( "/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", 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,13 +149,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-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 @@ -174,7 +173,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,7 +182,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 ), @@ -204,7 +203,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +212,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 ), @@ -237,7 +236,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -247,7 +246,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 ), @@ -271,7 +270,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -280,7 +279,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 ), @@ -302,7 +301,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -312,7 +311,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 ), @@ -336,7 +335,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -346,7 +345,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 ), @@ -372,7 +371,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -381,7 +380,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 ), @@ -408,7 +407,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -417,7 +416,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 ), @@ -441,7 +440,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -450,7 +449,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 ), @@ -468,7 +467,69 @@ def build_list_secrets_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -class JobsOperations: +def build_resume_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", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/resume", + ) # 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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_suspend_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", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/suspend", + ) # 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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class JobsOperations: # pylint: disable=too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. @@ -636,7 +697,7 @@ def get_detector( @distributed_trace def proxy_get(self, resource_group_name: str, job_name: str, api_name: str, **kwargs: Any) -> _models.Job: - """Get the properties of a Container App Job. + """Get the properties for a given Container App Job. Get the properties of a Container App Job. @@ -1910,3 +1971,233 @@ def list_secrets(self, resource_group_name: str, job_name: str, **kwargs: Any) - return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + + def _resume_initial(self, resource_group_name: str, job_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_resume_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_resume(self, resource_group_name: str, job_name: str, **kwargs: Any) -> LROPoller[_models.Job]: + """Resumes a suspended job. + + Resumes a suspended 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: Name of the Job. Required. + :type job_name: str + :return: An instance of LROPoller that returns either Job or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Job] + :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.Job] = 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._resume_initial( + resource_group_name=resource_group_name, + job_name=job_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Job", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Job].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Job](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _suspend_initial(self, resource_group_name: str, job_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_suspend_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_suspend(self, resource_group_name: str, job_name: str, **kwargs: Any) -> LROPoller[_models.Job]: + """Suspends a job. + + Suspends a 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: Name of the Job. Required. + :type job_name: str + :return: An instance of LROPoller that returns either Job or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Job] + :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.Job] = 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._suspend_initial( + resource_group_name=resource_group_name, + job_name=job_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Job", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Job].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Job](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_logic_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_logic_apps_operations.py new file mode 100644 index 000000000000..f0e443a98e75 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_logic_apps_operations.py @@ -0,0 +1,1074 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_workflows_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/workflows", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_workflow_request( + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/workflows/{workflowName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "workflowName": _SERIALIZER.url( + "workflow_name", workflow_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deploy_workflow_artifacts_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/deployWorkflowArtifacts", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_workflows_connections_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/listWorkflowsConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_invoke_request( + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + subscription_id: str, + *, + x_ms_logic_apps_proxy_path: str, + x_ms_logic_apps_proxy_method: Union[str, _models.LogicAppsProxyMethod], + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/invoke", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["x-ms-logicApps-proxy-path"] = _SERIALIZER.header( + "x_ms_logic_apps_proxy_path", x_ms_logic_apps_proxy_path, "str" + ) + _headers["x-ms-logicApps-proxy-method"] = _SERIALIZER.header( + "x_ms_logic_apps_proxy_method", x_ms_logic_apps_proxy_method, "str" + ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class LogicAppsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`logic_apps` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> _models.LogicApp: + """Gets a logic app extension resource. + + Gets a logic app extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LogicApp] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LogicApp", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: _models.LogicApp, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Required. + :type resource: ~azure.mgmt.appcontainers.models.LogicApp + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: Union[_models.LogicApp, IO[bytes]], + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Is either a LogicApp type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.appcontainers.models.LogicApp or IO[bytes] + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LogicApp] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "LogicApp") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LogicApp", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> None: + """Deletes a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_workflows( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> Iterable["_models.WorkflowEnvelope"]: + """List the workflows for a logic app. + + List the workflows for a logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: An iterator like instance of either WorkflowEnvelope or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.WorkflowEnvelope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelopeCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_workflows_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WorkflowEnvelopeCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_workflow( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, workflow_name: str, **kwargs: Any + ) -> _models.WorkflowEnvelope: + """Get workflow information by its name. + + Get workflow information by its name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_name: Workflow name. Required. + :type workflow_name: str + :return: WorkflowEnvelope or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.WorkflowEnvelope + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelope] = kwargs.pop("cls", None) + + _request = build_get_workflow_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + workflow_name=workflow_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[_models.WorkflowArtifacts] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Default value is + None. + :type workflow_artifacts: ~azure.mgmt.appcontainers.models.WorkflowArtifacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Default value is + None. + :type workflow_artifacts: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[Union[_models.WorkflowArtifacts, IO[bytes]]] = None, + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Is either a + WorkflowArtifacts type or a IO[bytes] type. Default value is None. + :type workflow_artifacts: ~azure.mgmt.appcontainers.models.WorkflowArtifacts or IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workflow_artifacts, (IOBase, bytes)): + _content = workflow_artifacts + else: + if workflow_artifacts is not None: + _json = self._serialize.body(workflow_artifacts, "WorkflowArtifacts") + else: + _json = None + + _request = build_deploy_workflow_artifacts_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_workflows_connections( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> _models.WorkflowEnvelope: + """Gets logic app's connections. + + Gets logic app's connections. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: WorkflowEnvelope or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.WorkflowEnvelope + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelope] = kwargs.pop("cls", None) + + _request = build_list_workflows_connections_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def invoke( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + x_ms_logic_apps_proxy_path: str, + x_ms_logic_apps_proxy_method: Union[str, _models.LogicAppsProxyMethod], + **kwargs: Any + ) -> JSON: + """Proxies a the API call to the logic app backed by the container app. + + Proxies a the API call to the logic app backed by the container app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the LogicApp App, the extension resource. Required. + :type logic_app_name: str + :param x_ms_logic_apps_proxy_path: The proxy path for the API call. Required. + :type x_ms_logic_apps_proxy_path: str + :param x_ms_logic_apps_proxy_method: The proxy method for the API call. Known values are: "GET" + and "POST". Required. + :type x_ms_logic_apps_proxy_method: str or + ~azure.mgmt.appcontainers.models.LogicAppsProxyMethod + :return: JSON or the result of cls(response) + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_invoke_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + x_ms_logic_apps_proxy_path=x_ms_logic_apps_proxy_path, + x_ms_logic_apps_proxy_method=x_ms_logic_apps_proxy_method, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("object", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_maintenance_configurations_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_maintenance_configurations_operations.py new file mode 100644 index 000000000000..6388e0b6f72d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_maintenance_configurations_operations.py @@ -0,0 +1,548 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/maintenanceConfigurations", + ) # 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_create_or_update_request( + resource_group_name: str, environment_name: str, config_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironment/{environmentName}/maintenanceConfigurations/{configName}", + ) # 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\._\(\)]+$"), + "configName": _SERIALIZER.url("config_name", config_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, environment_name: str, config_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironment/{environmentName}/maintenanceConfigurations/{configName}", + ) # 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\._\(\)]+$"), + "configName": _SERIALIZER.url("config_name", config_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, environment_name: str, config_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironment/{environmentName}/maintenanceConfigurations/{configName}", + ) # 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\._\(\)]+$"), + "configName": _SERIALIZER.url("config_name", config_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 MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`maintenance_configurations` 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.MaintenanceConfigurationResource"]: + """Gets all maintenance configurations in the specified 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: The name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either MaintenanceConfigurationResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource] + :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.MaintenanceConfigurationCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MaintenanceConfigurationCollection", 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) + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + config_name: str, + maintenance_configuration_envelope: _models.MaintenanceConfigurationResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfigurationResource: + """Create or update the maintenance configuration for 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: The name of the Managed Environment. Required. + :type environment_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param maintenance_configuration_envelope: Parameters to set the maintenance configuration for + ManagedEnvironment . Required. + :type maintenance_configuration_envelope: + ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MaintenanceConfigurationResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + config_name: str, + maintenance_configuration_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfigurationResource: + """Create or update the maintenance configuration for 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: The name of the Managed Environment. Required. + :type environment_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param maintenance_configuration_envelope: Parameters to set the maintenance configuration for + ManagedEnvironment . Required. + :type maintenance_configuration_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: MaintenanceConfigurationResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + config_name: str, + maintenance_configuration_envelope: Union[_models.MaintenanceConfigurationResource, IO[bytes]], + **kwargs: Any + ) -> _models.MaintenanceConfigurationResource: + """Create or update the maintenance configuration for 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: The name of the Managed Environment. Required. + :type environment_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param maintenance_configuration_envelope: Parameters to set the maintenance configuration for + ManagedEnvironment . Is either a MaintenanceConfigurationResource type or a IO[bytes] type. + Required. + :type maintenance_configuration_envelope: + ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource or IO[bytes] + :return: MaintenanceConfigurationResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MaintenanceConfigurationResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(maintenance_configuration_envelope, (IOBase, bytes)): + _content = maintenance_configuration_envelope + else: + _json = self._serialize.body(maintenance_configuration_envelope, "MaintenanceConfigurationResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MaintenanceConfigurationResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, config_name: str, **kwargs: Any + ) -> None: + """Deletes the maintenance configuration of a ManagedEnvironment . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: The name of the Managed Environment. Required. + :type environment_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, environment_name: str, config_name: str, **kwargs: Any + ) -> _models.MaintenanceConfigurationResource: + """Gets the maintenance configuration of a ManagedEnvironment . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: The name of the Managed Environment. Required. + :type environment_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :return: MaintenanceConfigurationResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MaintenanceConfigurationResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MaintenanceConfigurationResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_certificates_operations.py index 3a1b2fd048f1..1059b5137e01 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 @@ -32,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -51,7 +50,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +59,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 ), @@ -85,7 +84,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -95,7 +94,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 ), @@ -122,7 +121,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +130,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 ), @@ -156,7 +155,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -166,7 +165,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 ), @@ -193,7 +192,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -202,7 +201,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 28b2c8dd63f3..8bc2f29dded5 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 @@ -25,7 +25,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -44,7 +43,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +52,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 ), @@ -77,7 +76,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +85,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_private_endpoint_connections_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..6f8d28c71d70 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_endpoint_connections_operations.py @@ -0,0 +1,710 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateEndpointConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ManagedEnvironmentPrivateEndpointConnectionsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`managed_environment_private_endpoint_connections` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnection"]: + """List private endpoint connections for a given managed environment. + + List private endpoint connections for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Get a private endpoint connection for a given managed environment. + + Get a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(private_endpoint_connection_envelope, (IOBase, bytes)): + _content = private_endpoint_connection_envelope + else: + _json = self._serialize.body(private_endpoint_connection_envelope, "PrivateEndpointConnection") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Required. + :type private_endpoint_connection_envelope: + ~azure.mgmt.appcontainers.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Required. + :type private_endpoint_connection_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. + :type private_endpoint_connection_envelope: + ~azure.mgmt.appcontainers.models.PrivateEndpointConnection or IO[bytes] + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection_envelope=private_endpoint_connection_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a private endpoint connection for a given managed environment. + + Delete a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_link_resources_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_link_resources_operations.py new file mode 100644 index 000000000000..f3387d5363d1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_link_resources_operations.py @@ -0,0 +1,178 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateLinkResources", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ManagedEnvironmentPrivateLinkResourcesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`managed_environment_private_link_resources` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateLinkResource"]: + """List private link resources for a given managed environment. + + List private link resources for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py index 3cb052f8ef03..cd876682660c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py @@ -27,7 +27,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -46,7 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +54,7 @@ def build_list_request( "/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", 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_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_diagnostics_operations.py index b5b544b084fb..d76f3d3d0801 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 @@ -25,7 +25,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -44,7 +43,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +52,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 eb2d6a401338..ba8095dcc277 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 @@ -32,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -49,13 +48,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-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 @@ -73,7 +72,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +81,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 ), @@ -105,7 +104,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +113,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 ), @@ -138,7 +137,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -148,7 +147,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 ), @@ -174,7 +173,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,7 +182,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 ), @@ -207,7 +206,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -217,7 +216,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 ), @@ -243,7 +242,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -252,7 +251,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 ), @@ -276,7 +275,7 @@ def build_list_workload_profile_states_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -285,7 +284,7 @@ def build_list_workload_profile_states_request( # pylint: disable=name-too-long "/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 cb9e48e718de..740818210fdd 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 @@ -26,7 +26,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -45,7 +44,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +53,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 ), @@ -78,7 +77,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +86,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 ), @@ -112,7 +111,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -122,7 +121,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 ), @@ -149,7 +148,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +157,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 0f1cef41dd13..d62bd5f1e85e 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 @@ -26,7 +26,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -45,7 +44,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -55,7 +54,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 c0abef6f27ab..1522dca0b06a 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 @@ -27,7 +27,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -44,7 +43,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", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-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 index a99b84cddefe..ce2f7ced53af 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py @@ -27,7 +27,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -44,7 +43,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +52,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), - "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 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..dc57975eeb8f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_create_or_update.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 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/2024-10-02-preview/examples/AppResiliency_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_delete.py new file mode 100644 index 000000000000..325630bae6e8 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_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 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/2024-10-02-preview/examples/AppResiliency_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_get.py new file mode 100644 index 000000000000..42ed014e1f31 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_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 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/2024-10-02-preview/examples/AppResiliency_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_list.py new file mode 100644 index 000000000000..ae03f4c1cfdd --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_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 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/2024-10-02-preview/examples/AppResiliency_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.py new file mode 100644 index 000000000000..87d0a4fc6c4c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from 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/2024-10-02-preview/examples/AppResiliency_Patch.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_blob_storage_token_store_client_id_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_blob_storage_token_store_client_id_create_or_update.py new file mode 100644 index 000000000000..2adf908ae230 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_blob_storage_token_store_client_id_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 auth_configs_blob_storage_token_store_client_id_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.container_apps_auth_configs.create_or_update( + resource_group_name="rg1", + container_app_name="myapp", + auth_config_name="current", + auth_config_envelope={ + "properties": { + "encryptionSettings": { + "containerAppAuthEncryptionSecretName": "testEncryptionSecretName", + "containerAppAuthSigningSecretName": "testSigningSecretName", + }, + "globalValidation": {"unauthenticatedClientAction": "AllowAnonymous"}, + "identityProviders": { + "facebook": {"registration": {"appId": "123", "appSecretSettingName": "facebook-secret"}} + }, + "login": { + "tokenStore": { + "azureBlobStorage": { + "blobContainerUri": "https://test.blob.core.windows.net/container1", + "clientId": "00000000-0000-0000-0000-000000000000", + } + } + }, + "platform": {"enabled": True}, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/AuthConfigs_BlobStorageTokenStore_ClientId_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_blob_storage_token_store_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_blob_storage_token_store_create_or_update.py new file mode 100644 index 000000000000..baf60e4bd47f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_blob_storage_token_store_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 auth_configs_blob_storage_token_store_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.container_apps_auth_configs.create_or_update( + resource_group_name="rg1", + container_app_name="myapp", + auth_config_name="current", + auth_config_envelope={ + "properties": { + "encryptionSettings": { + "containerAppAuthEncryptionSecretName": "testEncryptionSecretName", + "containerAppAuthSigningSecretName": "testSigningSecretName", + }, + "globalValidation": {"unauthenticatedClientAction": "AllowAnonymous"}, + "identityProviders": { + "facebook": {"registration": {"appId": "123", "appSecretSettingName": "facebook-secret"}} + }, + "login": { + "tokenStore": { + "azureBlobStorage": { + "blobContainerUri": "https://test.blob.core.windows.net/container1", + "managedIdentityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", + } + } + }, + "platform": {"enabled": True}, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/AuthConfigs_BlobStorageTokenStore_CreateOrUpdate.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 624220b47933..7273acf7498b 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -53,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/AuthConfigs_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/AuthConfigs_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_delete.py index ba040bbd2aa2..52d2a1164355 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 @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/AuthConfigs_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/AuthConfigs_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_get.py index 3938c1cbfe61..ae1fa40b1ab2 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/AuthConfigs_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/AuthConfigs_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_list_by_container.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_list_by_container.py index 5e68fc393e08..269ed648c668 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/AuthConfigs_ListByContainer.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/AuthConfigs_ListByContainer.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/available_workload_profiles_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/available_workload_profiles_get.py index 983b5fa9ee20..1bde669af9bf 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/AvailableWorkloadProfiles_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/AvailableWorkloadProfiles_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/billing_meters_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/billing_meters_get.py index a0d779a0e42b..787aea9e84c0 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/BillingMeters_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/BillingMeters_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py new file mode 100644 index 000000000000..31e004d2d817 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py @@ -0,0 +1,65 @@ +# 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/2024-10-02-preview/examples/Builders_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_delete.py new file mode 100644 index 000000000000..28607c2251ea --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_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 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/2024-10-02-preview/examples/Builders_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_get.py new file mode 100644 index 000000000000..b3ce271e7c82 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_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 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/2024-10-02-preview/examples/Builders_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.py new file mode 100644 index 000000000000..34c156bb3920 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.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_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/2024-10-02-preview/examples/Builders_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.py new file mode 100644 index 000000000000..1a13bdf4b850 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.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_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/2024-10-02-preview/examples/Builders_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.py new file mode 100644 index 000000000000..2cb9875fc7f2 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.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 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/2024-10-02-preview/examples/Builders_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py new file mode 100644 index 000000000000..0f8a3789b406 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py @@ -0,0 +1,70 @@ +# 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/2024-10-02-preview/examples/Builds_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_delete.py new file mode 100644 index 000000000000..09550a96eb9f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_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 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/2024-10-02-preview/examples/Builds_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_get.py new file mode 100644 index 000000000000..af5c209ffda2 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_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 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/2024-10-02-preview/examples/Builds_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.py new file mode 100644 index 000000000000..bafbb8f6b417 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.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 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.build_auth_token.list( + resource_group_name="rg", + builder_name="testBuilder", + build_name="testBuild", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Builds_ListAuthToken.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py new file mode 100644 index 000000000000..dd88abf452a1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.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 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_by_builder_resource.list( + resource_group_name="rg", + builder_name="testBuilder", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Builds_ListByBuilderResource.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update.py index dff91853c9ea..f865daed111f 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Certificate_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.py new file mode 100644 index 000000000000..afd379141aaa --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.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 certificate_create_or_update_from_key_vault.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.certificates.create_or_update( + resource_group_name="examplerg", + environment_name="testcontainerenv", + certificate_name="certificate-firendly-name", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Certificate_CreateOrUpdate_FromKeyVault.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py index 90bd4a513ede..aced2de22090 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Certificate_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py index 5dcc3680dfa2..1eade3ebee4b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Certificate_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_check_name_availability.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_check_name_availability.py index 54c16c926ef1..cc6ad6d60d16 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificates_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Certificates_CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_list_by_managed_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_list_by_managed_environment.py index 2cc236f9fce0..c48d991455d9 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificates_ListByManagedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Certificates_ListByManagedEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py index d89bae1c7fdb..3a34d654d3a0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -41,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Certificates_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_create_or_update.py index cdca5d34c027..a95ec1537ab4 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 @@ -30,14 +30,14 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.connected_environments_certificates.create_or_update( + response = client.connected_environments_certificates.begin_create_or_update( resource_group_name="examplerg", connected_environment_name="testcontainerenv", certificate_name="certificate-firendly-name", - ) + ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironmentsCertificate_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_delete.py index 00f1ab1a0b5e..aa2e336dee07 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 @@ -30,13 +30,13 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - client.connected_environments_certificates.delete( + client.connected_environments_certificates.begin_delete( resource_group_name="examplerg", connected_environment_name="testcontainerenv", certificate_name="certificate-firendly-name", - ) + ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironmentsCertificate_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_get.py index ace6d53f08b0..9362fb268263 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironmentsCertificate_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_check_name_availability.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_check_name_availability.py index f22d461dea7c..862b812dbef8 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificates_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironmentsCertificates_CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_list_by_connected_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_list_by_connected_environment.py index 913aa57949a6..81bee97eb41f 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificates_ListByConnectedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironmentsCertificates_ListByConnectedEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_patch.py index 84aa2d9796cb..692b4e37b3e0 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -32,15 +30,15 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.connected_environments_certificates.update( + response = client.connected_environments_certificates.begin_update( resource_group_name="examplerg", connected_environment_name="testcontainerenv", certificate_name="certificate-firendly-name", certificate_envelope={"tags": {"tag1": "value1", "tag2": "value2"}}, - ) + ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironmentsCertificates_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_create_or_update.py index 0d2ee04d43ae..31942e081304 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -51,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironments_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_create_or_update.py index 8e001608e83c..f01562cfab8b 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -32,7 +30,7 @@ def main(): subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) - response = client.connected_environments_dapr_components.create_or_update( + response = client.connected_environments_dapr_components.begin_create_or_update( resource_group_name="examplerg", connected_environment_name="myenvironment", component_name="reddog", @@ -49,13 +47,20 @@ 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", } }, - ) + ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsDaprComponents_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironmentsDaprComponents_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_delete.py index 929cc80cc978..35504e0ad6d1 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 @@ -30,13 +30,13 @@ def main(): subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) - client.connected_environments_dapr_components.delete( + client.connected_environments_dapr_components.begin_delete( resource_group_name="examplerg", connected_environment_name="myenvironment", component_name="reddog", - ) + ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsDaprComponents_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironmentsDaprComponents_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_get.py index d6f1966fd4bf..c896316780d9 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsDaprComponents_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironmentsDaprComponents_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list.py index 6a55a4e1d8a0..c8bd64759b47 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsDaprComponents_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironmentsDaprComponents_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list_secrets.py index 6df6c3e05174..16a5bbaedb72 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_delete.py index e73072b39b27..e5921efe7d2e 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 @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironments_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_get.py index 313b7128c547..744b49c76dc1 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironments_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_resource_group.py index ed8b13df7429..ef3754fdbde7 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironments_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_subscription.py index ede57b26a655..106c8db462a0 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 @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironments_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_patch.py index 5f8bdb48eaf5..53ed7d818b04 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironments_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_create_or_update.py index d9472452801e..a3012e09046c 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -32,7 +30,7 @@ def main(): subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) - response = client.connected_environments_storages.create_or_update( + response = client.connected_environments_storages.begin_create_or_update( resource_group_name="examplerg", connected_environment_name="env", storage_name="jlaw-demo1", @@ -46,10 +44,10 @@ def main(): } } }, - ) + ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsStorages_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironmentsStorages_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_delete.py index 9f302e2a539c..b7583dc26866 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 @@ -30,13 +30,13 @@ def main(): subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) - client.connected_environments_storages.delete( + client.connected_environments_storages.begin_delete( resource_group_name="examplerg", connected_environment_name="env", storage_name="jlaw-demo1", - ) + ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsStorages_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironmentsStorages_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_get.py index 0385ae553809..b5bd6ead2add 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsStorages_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironmentsStorages_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_list.py index 5f3b4f472f24..108d540baeaa 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsStorages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ConnectedEnvironmentsStorages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_delete.py new file mode 100644 index 000000000000..9a636f287d4b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_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 container_apps_builds_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.container_apps_builds.begin_delete( + resource_group_name="rg", + container_app_name="testCapp", + build_name="testBuild", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerAppsBuilds_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_get.py new file mode 100644 index 000000000000..62a0ffb90a26 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_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 container_apps_builds_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_builds.get( + resource_group_name="rg", + container_app_name="testCapp", + build_name="testBuild", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerAppsBuilds_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_list_by_container_app.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_list_by_container_app.py new file mode 100644 index 000000000000..0706ef0a1f0d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_list_by_container_app.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_builds_list_by_container_app.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_builds_by_container_app.list( + resource_group_name="rg", + container_app_name="testCapp", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerAppsBuilds_ListByContainerApp.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py index 6e2cdf2b61b5..ceb5489a5dc8 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerApps_CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update.py index 22d752c240f7..c0f42165792a 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -34,8 +32,14 @@ def main(): response = client.container_apps.begin_create_or_update( resource_group_name="rg", - container_app_name="testcontainerapp0", + container_app_name="testcontainerApp0", container_app_envelope={ + "identity": { + "type": "SystemAssigned,UserAssigned", + "userAssignedIdentities": { + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity": {} + }, + }, "location": "East US", "properties": { "configuration": { @@ -48,6 +52,13 @@ def main(): "httpReadBufferSize": 30, "logLevel": "debug", }, + "identitySettings": [ + { + "identity": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity", + "lifecycle": "All", + }, + {"identity": "system", "lifecycle": "Init"}, + ], "ingress": { "additionalPortMappings": [ {"external": True, "targetPort": 1234}, @@ -91,17 +102,30 @@ def main(): ], "stickySessions": {"affinity": "sticky"}, "targetPort": 3000, - "traffic": [{"label": "production", "revisionName": "testcontainerapp0-ab1234", "weight": 100}], + "traffic": [{"label": "production", "revisionName": "testcontainerApp0-ab1234", "weight": 100}], }, "maxInactiveRevisions": 10, + "revisionTransitionThreshold": 100, + "runtime": { + "dotnet": {"autoConfigureDataProtection": True}, + "java": { + "enableMetrics": True, + "javaAgent": { + "enabled": True, + "logging": { + "loggerSettings": [{"level": "debug", "logger": "org.springframework.boot"}] + }, + }, + }, + }, "service": {"type": "redis"}, }, "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", "template": { "containers": [ { - "image": "repo/testcontainerapp0:v1", - "name": "testcontainerapp0", + "image": "repo/testcontainerApp0:v1", + "name": "testcontainerApp0", "probes": [ { "httpGet": { @@ -114,33 +138,66 @@ def main(): "type": "Liveness", } ], + "volumeMounts": [ + {"mountPath": "/mnt/path1", "subPath": "subPath1", "volumeName": "azurefile"}, + {"mountPath": "/mnt/path2", "subPath": "subPath2", "volumeName": "nfsazurefile"}, + ], } ], "initContainers": [ { "args": ["-c", "while true; do echo hello; sleep 10;done"], "command": ["/bin/sh"], - "image": "repo/testcontainerapp0:v4", + "image": "repo/testcontainerApp0:v4", "name": "testinitcontainerApp0", - "resources": {"cpu": 0.5, "memory": "1Gi"}, + "resources": {"cpu": 0.2, "gpu": 1, "memory": "100Mi"}, } ], "scale": { + "cooldownPeriod": 350, "maxReplicas": 5, "minReplicas": 1, + "pollingInterval": 35, "rules": [ { "custom": {"metadata": {"concurrentRequests": "50"}, "type": "http"}, "name": "httpscalingrule", - } + }, + { + "custom": { + "identity": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity", + "metadata": { + "messageCount": "5", + "namespace": "mynamespace", + "queueName": "myqueue", + }, + "type": "azure-servicebus", + }, + "name": "servicebus", + }, + { + "azureQueue": { + "accountName": "account1", + "identity": "system", + "queueLength": 1, + "queueName": "queue1", + }, + "name": "azure-queue", + }, ], }, "serviceBinds": [ { + "clientType": "dotnet", + "customizedKeys": {"DesiredKey": "defaultKey"}, "name": "redisService", "serviceId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/redisService", } ], + "volumes": [ + {"name": "azurefile", "storageName": "storage", "storageType": "AzureFile"}, + {"name": "nfsazurefile", "storageName": "nfsStorage", "storageType": "NfsAzureFile"}, + ], }, "workloadProfileName": "My-GP-01", }, @@ -149,6 +206,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerApps_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py new file mode 100644 index 000000000000..52039fa215b7 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py @@ -0,0 +1,163 @@ +# 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, + "revisionTransitionThreshold": 100, + "runtime": { + "dotnet": {"autoConfigureDataProtection": True}, + "java": { + "enableMetrics": True, + "javaAgent": { + "enabled": True, + "logging": { + "loggerSettings": [{"level": "debug", "logger": "org.springframework.boot"}] + }, + }, + }, + }, + }, + "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/connectedEnvironments/demokube", + "template": { + "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": { + "cooldownPeriod": 350, + "maxReplicas": 5, + "minReplicas": 1, + "pollingInterval": 35, + "rules": [ + { + "custom": {"metadata": {"concurrentRequests": "50"}, "type": "http"}, + "name": "httpscalingrule", + } + ], + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerApps_CreateOrUpdate_ConnectedEnvironment.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_delete.py index 5584e089d51f..ec45f4997ce4 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 @@ -32,10 +32,10 @@ def main(): client.container_apps.begin_delete( resource_group_name="rg", - container_app_name="testworkerapp0", + container_app_name="testWorkerApp0", ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerApps_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_get.py index d930996c61b2..bc5aa28eab85 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerAppsDiagnostics_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerAppsDiagnostics_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_list.py index 76593271c57f..561bf74e2547 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerAppsDiagnostics_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerAppsDiagnostics_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get.py index 90c811ae2ed6..e653fb277c06 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 @@ -32,11 +32,11 @@ def main(): response = client.container_apps_diagnostics.get_root( resource_group_name="rg", - container_app_name="testcontainerapp0", + container_app_name="testcontainerApp0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerApps_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get_auth_token.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get_auth_token.py index ccc19d0b27a3..37404f89a060 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 @@ -32,11 +32,11 @@ def main(): response = client.container_apps.get_auth_token( resource_group_name="rg", - container_app_name="testcontainerapp0", + container_app_name="testcontainerApp0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_GetAuthToken.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerApps_GetAuthToken.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_kind_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_kind_create_or_update.py new file mode 100644 index 000000000000..2f21554af5d9 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_kind_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 container_apps_kind_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps.begin_create_or_update( + resource_group_name="rg", + container_app_name="testcontainerAppKind", + container_app_envelope={ + "kind": "workflowapp", + "location": "East Us", + "managedBy": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.Web/sites/testcontainerAppKind", + "properties": { + "configuration": { + "activeRevisionsMode": "Single", + "ingress": {"allowInsecure": True, "external": True, "targetPort": 80}, + }, + "managedEnvironmentId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/testmanagedenv3", + "template": { + "containers": [ + { + "image": "default/logicapps-base:latest", + "name": "logicapps-container", + "resources": {"cpu": 1, "memory": "2.0Gi"}, + } + ], + "scale": {"cooldownPeriod": 350, "maxReplicas": 30, "minReplicas": 1, "pollingInterval": 35}, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerApps_Kind_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py index 046c42b04668..18052ae18b53 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerApps_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_subscription.py index 0c3297623ffb..124b566a2980 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 @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerApps_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_custom_host_name_analysis.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_custom_host_name_analysis.py index 658867e94928..398916ea4c44 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 @@ -32,11 +32,11 @@ def main(): response = client.container_apps.list_custom_host_name_analysis( resource_group_name="rg", - container_app_name="testcontainerapp0", + container_app_name="testcontainerApp0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_ListCustomHostNameAnalysis.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerApps_ListCustomHostNameAnalysis.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_secrets.py index 2f46811b10e5..b199c3f2b980 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 @@ -32,11 +32,11 @@ def main(): response = client.container_apps.list_secrets( resource_group_name="rg", - container_app_name="testcontainerapp0", + container_app_name="testcontainerApp0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerApps_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_managed_by_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_managed_by_create_or_update.py index 3888d2106624..9f9295a1c94c 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -34,7 +32,7 @@ def main(): response = client.container_apps.begin_create_or_update( resource_group_name="rg", - container_app_name="testcontainerappmanagedby", + container_app_name="testcontainerAppManagedBy", container_app_envelope={ "location": "East US", "managedBy": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.AppPlatform/Spring/springapp", @@ -44,7 +42,7 @@ def main(): "exposedPort": 4000, "external": True, "targetPort": 3000, - "traffic": [{"revisionName": "testcontainerappmanagedby-ab1234", "weight": 100}], + "traffic": [{"revisionName": "testcontainerAppManagedBy-ab1234", "weight": 100}], "transport": "tcp", } }, @@ -52,8 +50,8 @@ def main(): "template": { "containers": [ { - "image": "repo/testcontainerappmanagedby:v1", - "name": "testcontainerappmanagedby", + "image": "repo/testcontainerAppManagedBy:v1", + "name": "testcontainerAppManagedBy", "probes": [ { "initialDelaySeconds": 3, @@ -65,8 +63,10 @@ def main(): } ], "scale": { + "cooldownPeriod": 350, "maxReplicas": 5, "minReplicas": 1, + "pollingInterval": 35, "rules": [{"name": "tcpscalingrule", "tcp": {"metadata": {"concurrentConnections": "50"}}}], }, }, @@ -76,6 +76,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_ManagedBy_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerApps_ManagedBy_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patch.py index 8e098ca5d753..a73061a4f8ca 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -34,7 +32,7 @@ def main(): response = client.container_apps.begin_update( resource_group_name="rg", - container_app_name="testcontainerapp0", + container_app_name="testcontainerApp0", container_app_envelope={ "location": "East US", "properties": { @@ -78,16 +76,29 @@ def main(): ], "stickySessions": {"affinity": "sticky"}, "targetPort": 3000, - "traffic": [{"label": "production", "revisionName": "testcontainerapp0-ab1234", "weight": 100}], + "traffic": [{"label": "production", "revisionName": "testcontainerApp0-ab1234", "weight": 100}], }, "maxInactiveRevisions": 10, + "revisionTransitionThreshold": 100, + "runtime": { + "dotnet": {"autoConfigureDataProtection": True}, + "java": { + "enableMetrics": True, + "javaAgent": { + "enabled": True, + "logging": { + "loggerSettings": [{"level": "debug", "logger": "org.springframework.boot"}] + }, + }, + }, + }, "service": {"type": "redis"}, }, "template": { "containers": [ { - "image": "repo/testcontainerapp0:v1", - "name": "testcontainerapp0", + "image": "repo/testcontainerApp0:v1", + "name": "testcontainerApp0", "probes": [ { "httpGet": { @@ -104,14 +115,16 @@ def main(): ], "initContainers": [ { - "image": "repo/testcontainerapp0:v4", + "image": "repo/testcontainerApp0:v4", "name": "testinitcontainerApp0", - "resources": {"cpu": 0.5, "memory": "1Gi"}, + "resources": {"cpu": 0.2, "memory": "100Mi"}, } ], "scale": { + "cooldownPeriod": 350, "maxReplicas": 5, "minReplicas": 1, + "pollingInterval": 35, "rules": [ { "custom": {"metadata": {"concurrentRequests": "50"}, "type": "http"}, @@ -121,6 +134,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", } @@ -133,6 +148,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerApps_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_apply.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_apply.py new file mode 100644 index 000000000000..ee552ca815d0 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_apply.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_patches_apply.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_patches.begin_apply( + resource_group_name="rg", + container_app_name="test-app", + patch_name="testPatch-25fe4b", + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerAppsPatches_Apply.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_delete.py new file mode 100644 index 000000000000..0627552285eb --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_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 container_apps_patches_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.container_apps_patches.begin_delete( + resource_group_name="rg", + container_app_name="test-app", + patch_name="testPatch-25fe4b", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerAppsPatches_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_get.py new file mode 100644 index 000000000000..c40b32ca0d27 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_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 container_apps_patches_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_patches.get( + resource_group_name="rg", + container_app_name="test-app", + patch_name="testPatch-25fe4b", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerAppsPatches_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_list_by_container_app.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_list_by_container_app.py new file mode 100644 index 000000000000..23a422afc4ef --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_list_by_container_app.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_patches_list_by_container_app.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_patches.list_by_container_app( + resource_group_name="rg", + container_app_name="test-app", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerAppsPatches_ListByContainerApp.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_skip_configure.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_skip_configure.py new file mode 100644 index 000000000000..fcdf020e2e1b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_skip_configure.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_patches_skip_configure.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.container_apps_patches.begin_skip_configure( + resource_group_name="rg", + container_app_name="test-app", + patch_name="testPatch-25fe4b", + patch_skip_config={"skip": True}, + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerAppsPatches_Skip_Configure.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_source_to_cloud_app_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_source_to_cloud_app_create_or_update.py new file mode 100644 index 000000000000..1af1b231c13f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_source_to_cloud_app_create_or_update.py @@ -0,0 +1,167 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_source_to_cloud_app_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.container_apps.begin_create_or_update( + resource_group_name="rg", + container_app_name="testcontainerApp0", + container_app_envelope={ + "location": "East US", + "properties": { + "configuration": { + "dapr": { + "appPort": 3000, + "appProtocol": "http", + "enableApiLogging": True, + "enabled": True, + "httpMaxRequestSize": 10, + "httpReadBufferSize": 30, + "logLevel": "debug", + }, + "ingress": { + "additionalPortMappings": [ + {"external": True, "targetPort": 1234}, + {"exposedPort": 3456, "external": False, "targetPort": 2345}, + ], + "clientCertificateMode": "accept", + "corsPolicy": { + "allowCredentials": True, + "allowedHeaders": ["HEADER1", "HEADER2"], + "allowedMethods": ["GET", "POST"], + "allowedOrigins": ["https://a.test.com", "https://b.test.com"], + "exposeHeaders": ["HEADER3", "HEADER4"], + "maxAge": 1234, + }, + "customDomains": [ + { + "bindingType": "SniEnabled", + "certificateId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-name-dot-com", + "name": "www.my-name.com", + }, + { + "bindingType": "SniEnabled", + "certificateId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com", + "name": "www.my-other-name.com", + }, + ], + "external": True, + "ipSecurityRestrictions": [ + { + "action": "Allow", + "description": "Allowing all IP's within the subnet below to access containerapp", + "ipAddressRange": "192.168.1.1/32", + "name": "Allow work IP A subnet", + }, + { + "action": "Allow", + "description": "Allowing all IP's within the subnet below to access containerapp", + "ipAddressRange": "192.168.1.1/8", + "name": "Allow work IP B subnet", + }, + ], + "stickySessions": {"affinity": "sticky"}, + "targetPort": 3000, + "traffic": [{"label": "production", "revisionName": "testcontainerApp0-ab1234", "weight": 100}], + }, + "maxInactiveRevisions": 10, + "revisionTransitionThreshold": 100, + "service": {"type": "redis"}, + }, + "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", + "patchingConfiguration": {"patchingMode": "Automatic"}, + "template": { + "containers": [ + { + "image": "", + "imageType": "CloudBuild", + "name": "testcontainerApp0", + "probes": [ + { + "httpGet": { + "httpHeaders": [{"name": "Custom-Header", "value": "Awesome"}], + "path": "/health", + "port": 8080, + }, + "initialDelaySeconds": 3, + "periodSeconds": 3, + "type": "Liveness", + } + ], + "volumeMounts": [ + {"mountPath": "/mnt/path1", "subPath": "subPath1", "volumeName": "azurefile"}, + {"mountPath": "/mnt/path2", "subPath": "subPath2", "volumeName": "nfsazurefile"}, + ], + } + ], + "initContainers": [ + { + "args": ["-c", "while true; do echo hello; sleep 10;done"], + "command": ["/bin/sh"], + "image": "repo/testcontainerApp0:v4", + "name": "testinitcontainerApp0", + "resources": {"cpu": 0.2, "memory": "100Mi"}, + } + ], + "scale": { + "cooldownPeriod": 350, + "maxReplicas": 5, + "minReplicas": 1, + "pollingInterval": 35, + "rules": [ + { + "custom": {"metadata": {"concurrentRequests": "50"}, "type": "http"}, + "name": "httpscalingrule", + } + ], + }, + "serviceBinds": [ + { + "clientType": "dotnet", + "customizedKeys": {"DesiredKey": "defaultKey"}, + "name": "redisService", + "serviceId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/redisService", + } + ], + "volumes": [ + {"name": "azurefile", "storageName": "storage", "storageType": "AzureFile"}, + {"name": "nfsazurefile", "storageName": "nfsStorage", "storageType": "NfsAzureFile"}, + ], + }, + "workloadProfileName": "My-GP-01", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerApps_SourceToCloudApp_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py index 4b0f2b9068d6..5195c5cb9ede 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 @@ -32,11 +32,11 @@ def main(): response = client.container_apps.begin_start( resource_group_name="rg", - container_app_name="testworkerapp0", + container_app_name="testWorkerApp0", ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Start.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerApps_Start.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py index 89a46875376b..19d2ccb3e39a 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 @@ -32,11 +32,11 @@ def main(): response = client.container_apps.begin_stop( resource_group_name="rg", - container_app_name="testworkerApp0", + container_app_name="testWorkerApp0", ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Stop.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerApps_Stop.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_tcp_app_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_tcp_app_create_or_update.py index 6a91c457e976..a633d148a75d 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -34,7 +32,7 @@ def main(): response = client.container_apps.begin_create_or_update( resource_group_name="rg", - container_app_name="testcontainerapptcp", + container_app_name="testcontainerAppTcp", container_app_envelope={ "location": "East US", "properties": { @@ -43,7 +41,7 @@ def main(): "exposedPort": 4000, "external": True, "targetPort": 3000, - "traffic": [{"revisionName": "testcontainerapptcp-ab1234", "weight": 100}], + "traffic": [{"revisionName": "testcontainerAppTcp-ab1234", "weight": 100}], "transport": "tcp", } }, @@ -51,8 +49,8 @@ def main(): "template": { "containers": [ { - "image": "repo/testcontainerapptcp:v1", - "name": "testcontainerapptcp", + "image": "repo/testcontainerAppTcp:v1", + "name": "testcontainerAppTcp", "probes": [ { "initialDelaySeconds": 3, @@ -64,8 +62,10 @@ def main(): } ], "scale": { + "cooldownPeriod": 350, "maxReplicas": 5, "minReplicas": 1, + "pollingInterval": 35, "rules": [{"name": "tcpscalingrule", "tcp": {"metadata": {"concurrentConnections": "50"}}}], }, }, @@ -75,6 +75,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_TcpApp_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ContainerApps_TcpApp_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.py new file mode 100644 index 000000000000..93d3f28a268e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python 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/2024-10-02-preview/examples/DaprComponentResiliencyPolicies_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.py new file mode 100644 index 000000000000..b084d7ab4838 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python 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/2024-10-02-preview/examples/DaprComponentResiliencyPolicies_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.py new file mode 100644 index 000000000000..e1d7c062d599 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python 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/2024-10-02-preview/examples/DaprComponentResiliencyPolicies_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.py new file mode 100644 index 000000000000..57a7d30fc763 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.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 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": { + "circuitBreakerPolicy": {"consecutiveErrors": 5, "intervalInSeconds": 4, "timeoutInSeconds": 10}, + "httpRetryPolicy": { + "maxRetries": 15, + "retryBackOff": {"initialDelayInMilliseconds": 2000, "maxIntervalInMilliseconds": 5500}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 30}, + }, + "outboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 3, "intervalInSeconds": 60, "timeoutInSeconds": 20}, + "httpRetryPolicy": { + "maxRetries": 5, + "retryBackOff": {"initialDelayInMilliseconds": 100, "maxIntervalInMilliseconds": 30000}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 12}, + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_AllOptions.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.py new file mode 100644 index 000000000000..70f60a7dae0d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.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_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": { + "circuitBreakerPolicy": {"consecutiveErrors": 3, "intervalInSeconds": 60, "timeoutInSeconds": 20}, + "httpRetryPolicy": { + "maxRetries": 5, + "retryBackOff": {"initialDelayInMilliseconds": 100, "maxIntervalInMilliseconds": 30000}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 12}, + } + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_OutboundOnly.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.py new file mode 100644 index 000000000000..8c139b646551 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.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_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": { + "circuitBreakerPolicy": {"consecutiveErrors": 3, "timeoutInSeconds": 20}, + "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/2024-10-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_SparseOptions.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secret_store_component.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secret_store_component.py index fe6d1a18e37d..21ddfb573af3 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -49,6 +47,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", } }, @@ -56,6 +61,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_CreateOrUpdate_SecretStoreComponent.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/DaprComponents_CreateOrUpdate_SecretStoreComponent.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secrets.py index 5e087e9e1be1..5e9ddfbc25b7 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -49,6 +47,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", } }, @@ -56,6 +61,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_CreateOrUpdate_Secrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/DaprComponents_CreateOrUpdate_Secrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_delete.py index b77e9e25a41b..05278023c449 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 @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/DaprComponents_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secret_store_component.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secret_store_component.py index 704a23da3223..fcd400a1154b 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_Get_SecretStoreComponent.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/DaprComponents_Get_SecretStoreComponent.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secrets.py index 6770615c84dc..a7c2e8a267e5 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_Get_Secrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/DaprComponents_Get_Secrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list.py index 94ea0da382ea..5cf231655702 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/DaprComponents_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list_secrets.py index 134ef9102bad..e577d0aa359c 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/DaprComponents_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py new file mode 100644 index 000000000000..4d28a6ed0b70 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py @@ -0,0 +1,52 @@ +# 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/2024-10-02-preview/examples/DaprSubscriptions_CreateOrUpdate_BulkSubscribeAndScopes.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.py new file mode 100644 index 000000000000..a91260c03077 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from 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/2024-10-02-preview/examples/DaprSubscriptions_CreateOrUpdate_DefaultRoute.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py new file mode 100644 index 000000000000..f884820c624a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py @@ -0,0 +1,57 @@ +# 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/2024-10-02-preview/examples/DaprSubscriptions_CreateOrUpdate_RouteRulesAndMetadata.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_delete.py new file mode 100644 index 000000000000..bcb9a1ee4522 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_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_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/2024-10-02-preview/examples/DaprSubscriptions_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.py new file mode 100644 index 000000000000..82f93d9ac708 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.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_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/2024-10-02-preview/examples/DaprSubscriptions_Get_BulkSubscribeAndScopes.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.py new file mode 100644 index 000000000000..48236ced5402 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.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_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/2024-10-02-preview/examples/DaprSubscriptions_Get_DefaultRoute.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.py new file mode 100644 index 000000000000..c8cdb97688e4 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.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_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/2024-10-02-preview/examples/DaprSubscriptions_Get_RouteRulesAndMetadata.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_list.py new file mode 100644 index 000000000000..b025688ecb29 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_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_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/2024-10-02-preview/examples/DaprSubscriptions_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update.py new file mode 100644 index 000000000000..5d8bfd801452 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_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="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.begin_create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + dot_net_component_envelope={ + "properties": { + "componentType": "AspireDashboard", + "configurations": [{"propertyName": "dashboard-theme", "value": "dark"}], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/DotNetComponents_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update_service_bind.py new file mode 100644 index 000000000000..21ecd3ccf329 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update_service_bind.py @@ -0,0 +1,55 @@ +# 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 dot_net_components_create_or_update_service_bind.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.dot_net_components.begin_create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + dot_net_component_envelope={ + "properties": { + "componentType": "AspireDashboard", + "configurations": [{"propertyName": "dashboard-theme", "value": "dark"}], + "serviceBinds": [ + { + "name": "yellowcat", + "serviceId": "/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/yellowcat", + } + ], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/DotNetComponents_CreateOrUpdate_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_delete.py new file mode 100644 index 000000000000..f84c094e714a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_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 dot_net_components_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.dot_net_components.begin_delete( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/DotNetComponents_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get.py new file mode 100644 index 000000000000..39ad0dcddef5 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_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 dot_net_components_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.dot_net_components.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/DotNetComponents_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get_service_bind.py new file mode 100644 index 000000000000..4daf02ee43d9 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get_service_bind.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 dot_net_components_get_service_bind.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.dot_net_components.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/DotNetComponents_Get_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list.py new file mode 100644 index 000000000000..dcc4f532733c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_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 dot_net_components_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.dot_net_components.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/2024-10-02-preview/examples/DotNetComponents_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list_service_bind.py new file mode 100644 index 000000000000..6237c9c4507a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list_service_bind.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 dot_net_components_list_service_bind.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.dot_net_components.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/2024-10-02-preview/examples/DotNetComponents_List_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch.py new file mode 100644 index 000000000000..e87f815f47d1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_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="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.begin_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + dot_net_component_envelope={ + "properties": { + "componentType": "AspireDashboard", + "configurations": [{"propertyName": "dashboard-theme", "value": "dark"}], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/DotNetComponents_Patch.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch_service_bind.py new file mode 100644 index 000000000000..9f4bb5e3d0f8 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch_service_bind.py @@ -0,0 +1,55 @@ +# 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 dot_net_components_patch_service_bind.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.dot_net_components.begin_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + dot_net_component_envelope={ + "properties": { + "componentType": "AspireDashboard", + "configurations": [{"propertyName": "dashboard-theme", "value": "dark"}], + "serviceBinds": [ + { + "name": "yellowcat", + "serviceId": "/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/yellowcat", + } + ], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/DotNetComponents_Patch_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/functions_extension_post.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/functions_extension_post.py new file mode 100644 index 000000000000..0044378f856b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/functions_extension_post.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python functions_extension_post.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.functions_extension.invoke_functions_host( + resource_group_name="rg", + container_app_name="testcontainerApp0", + revision_name="testcontainerApp0-pjxhsye", + function_app_name="testcontainerApp0", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/FunctionsExtension_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_create_or_update.py new file mode 100644 index 000000000000..cf0e6eb3bfb1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_create_or_update.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 http_route_config_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.http_route_config.create_or_update( + resource_group_name="examplerg", + environment_name="testcontainerenv", + http_route_name="httproutefriendlyname", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/HttpRouteConfig_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_create_or_update_path_sep_prefix.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_create_or_update_path_sep_prefix.py new file mode 100644 index 000000000000..34923d4fc6b3 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_create_or_update_path_sep_prefix.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 http_route_config_create_or_update_path_sep_prefix.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.http_route_config.create_or_update( + resource_group_name="examplerg", + environment_name="testcontainerenv", + http_route_name="httproutefriendlyname", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/HttpRouteConfig_CreateOrUpdate_PathSepPrefix.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_create_or_update_prefix.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_create_or_update_prefix.py new file mode 100644 index 000000000000..a39c81c2123e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_create_or_update_prefix.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 http_route_config_create_or_update_prefix.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.http_route_config.create_or_update( + resource_group_name="examplerg", + environment_name="testcontainerenv", + http_route_name="httproutefriendlyname", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/HttpRouteConfig_CreateOrUpdatePrefix.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_delete.py new file mode 100644 index 000000000000..996539159ba1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_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 http_route_config_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.http_route_config.delete( + resource_group_name="examplerg", + environment_name="testcontainerenv", + http_route_name="httproutefriendlyname", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/HttpRouteConfig_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_get.py new file mode 100644 index 000000000000..2f22a94663ac --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_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 http_route_config_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.http_route_config.get( + resource_group_name="examplerg", + environment_name="testcontainerenv", + http_route_name="httproutefriendlyname", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/HttpRouteConfig_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_list_by_managed_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_list_by_managed_environment.py new file mode 100644 index 000000000000..9815fe668183 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_list_by_managed_environment.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 http_route_config_list_by_managed_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.http_route_config.list( + resource_group_name="examplerg", + environment_name="testcontainerenv", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/HttpRouteConfig_ListByManagedEnvironment.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_patch.py new file mode 100644 index 000000000000..4be23e65803c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_patch.py @@ -0,0 +1,63 @@ +# 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 http_route_config_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.http_route_config.update( + resource_group_name="examplerg", + environment_name="testcontainerenv", + http_route_name="httproutefriendlyname", + http_route_config_envelope={ + "properties": { + "customDomains": [ + { + "bindingType": "SniEnabled", + "certificateId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-1", + "name": "example.com", + } + ], + "rules": [ + { + "description": "random-description", + "routes": [ + {"action": {"prefixRewrite": "/v1/api"}, "match": {"caseSensitive": True, "path": "/v1"}} + ], + "targets": [{"containerApp": "capp-1", "revision": "rev-1", "weight": 100}], + } + ], + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/HttpRouteConfig_Patch.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py new file mode 100644 index 000000000000..5f2b11ab7700 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py @@ -0,0 +1,53 @@ +# 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 java_components_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="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.java_components.begin_create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + java_component_envelope={ + "properties": { + "componentType": "SpringBootAdmin", + "configurations": [ + {"propertyName": "spring.boot.admin.ui.enable-toasts", "value": "true"}, + {"propertyName": "spring.boot.admin.monitor.status-interval", "value": "10000ms"}, + ], + "scale": {"maxReplicas": 1, "minReplicas": 1}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/JavaComponents_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py new file mode 100644 index 000000000000..66121829ac80 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py @@ -0,0 +1,59 @@ +# 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 java_components_create_or_update_service_bind.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.java_components.begin_create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + java_component_envelope={ + "properties": { + "componentType": "SpringBootAdmin", + "configurations": [ + {"propertyName": "spring.boot.admin.ui.enable-toasts", "value": "true"}, + {"propertyName": "spring.boot.admin.monitor.status-interval", "value": "10000ms"}, + ], + "scale": {"maxReplicas": 1, "minReplicas": 1}, + "serviceBinds": [ + { + "name": "yellowcat", + "serviceId": "/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/yellowcat", + } + ], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/JavaComponents_CreateOrUpdate_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_delete.py new file mode 100644 index 000000000000..c33abcec40c4 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_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 java_components_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.java_components.begin_delete( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/JavaComponents_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get.py new file mode 100644 index 000000000000..45aa7e9eb134 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_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 java_components_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.java_components.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/JavaComponents_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.py new file mode 100644 index 000000000000..e5188648574b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.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 java_components_get_service_bind.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.java_components.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/JavaComponents_Get_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list.py new file mode 100644 index 000000000000..f9cb04f9249c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_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 java_components_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.java_components.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/2024-10-02-preview/examples/JavaComponents_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.py new file mode 100644 index 000000000000..1408c7f01248 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.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 java_components_list_service_bind.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.java_components.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/2024-10-02-preview/examples/JavaComponents_List_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py new file mode 100644 index 000000000000..dd58a34e9100 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py @@ -0,0 +1,53 @@ +# 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 java_components_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="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.java_components.begin_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + java_component_envelope={ + "properties": { + "componentType": "SpringBootAdmin", + "configurations": [ + {"propertyName": "spring.boot.admin.ui.enable-toasts", "value": "true"}, + {"propertyName": "spring.boot.admin.monitor.status-interval", "value": "10000ms"}, + ], + "scale": {"maxReplicas": 1, "minReplicas": 1}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/JavaComponents_Patch.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py new file mode 100644 index 000000000000..c3998f1f1e49 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py @@ -0,0 +1,59 @@ +# 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 java_components_patch_service_bind.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.java_components.begin_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + java_component_envelope={ + "properties": { + "componentType": "SpringBootAdmin", + "configurations": [ + {"propertyName": "spring.boot.admin.ui.enable-toasts", "value": "true"}, + {"propertyName": "spring.boot.admin.monitor.status-interval", "value": "10000ms"}, + ], + "scale": {"maxReplicas": 1, "minReplicas": 1}, + "serviceBinds": [ + { + "name": "yellowcat", + "serviceId": "/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/yellowcat", + } + ], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/JavaComponents_Patch_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py deleted file mode 100644 index f3ddb4bcde78..000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py +++ /dev/null @@ -1,85 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python job_createor_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.jobs.begin_create_or_update( - resource_group_name="rg", - job_name="testcontainerappsjob0", - job_envelope={ - "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/managedEnvironments/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.5, "memory": "1Gi"}, - } - ], - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_CreateorUpdate.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 6b06c167dcf1..c0273423c3e2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py @@ -32,10 +32,10 @@ def main(): client.jobs.begin_delete( resource_group_name="rg", - job_name="testworkercontainerappsjob0", + job_name="testWorkerContainerAppsJob0", ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Job_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py index 2f3c4ab1467c..fc9993234600 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 @@ -32,12 +32,12 @@ def main(): response = client.job_execution( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", job_execution_name="jobExecution1", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Execution_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Job_Execution_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_executions_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_executions_get.py index ef8f87ed75b2..b05f91c36777 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 @@ -32,12 +32,12 @@ def main(): response = client.jobs_executions.list( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", ) for item in response: print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Executions_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Job_Executions_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py index 7e30b8cdc1d2..eb7b37e8e9b5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py @@ -32,11 +32,11 @@ def main(): response = client.jobs.get( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Job_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py index babc393e6e1c..fa9e758e417b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_GetDetector.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Job_GetDetector.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py index ecd35bee287b..c2e3f55bbdc4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_ListDetectors.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Job_ListDetectors.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py index d8e658773abe..646345cc8499 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 @@ -32,11 +32,11 @@ def main(): response = client.jobs.list_secrets( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Job_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py index 2df4d15dc8db..ae832607c215 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py @@ -32,12 +32,12 @@ def main(): response = client.jobs.proxy_get( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", api_name="rootApi", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_ProxyGet.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Job_ProxyGet.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py index 883c1318f5c0..8e32d4f3371d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py @@ -32,11 +32,11 @@ def main(): response = client.jobs.begin_start( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Start.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Job_Start.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_execution.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_execution.py index 09a27e753cf6..08f8d3fee12c 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 @@ -32,11 +32,11 @@ def main(): client.jobs.begin_stop_execution( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", job_execution_name="jobExecution1", ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Stop_Execution.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Job_Stop_Execution.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_multiple.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_multiple.py index e9587c0e5e85..bfd95a86b3ae 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 @@ -32,11 +32,11 @@ def main(): response = client.jobs.begin_stop_multiple_executions( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Stop_Multiple.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Job_Stop_Multiple.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_resource_group.py index 650ce4e217b8..989e3242ebd4 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Jobs_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Jobs_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_subscription.py index 043b2a59bb3a..bffe9762d5d4 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 @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Jobs_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Jobs_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_resume.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_resume.py new file mode 100644 index 000000000000..d6fed123ff2b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_resume.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 jobs_resume.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_resume( + resource_group_name="rg", + job_name="testcontainerAppsJob0", + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Jobs_Resume.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_suspend.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_suspend.py new file mode 100644 index 000000000000..d2608b91a88b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_suspend.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 jobs_suspend.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_suspend( + resource_group_name="rg", + job_name="testcontainerAppsJob0", + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Jobs_Suspend.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/label_history_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/label_history_get.py new file mode 100644 index 000000000000..c2881eb4dd82 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/label_history_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 label_history_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.container_apps_label_history.get_label_history( + resource_group_name="rg", + container_app_name="testContainerApp", + label_name="dev", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/LabelHistory_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/label_history_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/label_history_list.py new file mode 100644 index 000000000000..c32bf99b8f09 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/label_history_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 label_history_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.container_apps_label_history.list_label_history( + resource_group_name="rg", + container_app_name="testContainerApp", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/LabelHistory_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_create.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_create.py new file mode 100644 index 000000000000..2f9f6ad8f11d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_create.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.logic_apps.create_or_update( + resource_group_name="examplerg", + container_app_name="testcontainerApp0", + logic_app_name="testcontainerApp0", + resource={"properties": {}}, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/LogicApps_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete.py new file mode 100644 index 000000000000..ccb5aa1921b1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_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 logic_apps_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.logic_apps.delete( + resource_group_name="examplerg", + container_app_name="testcontainerApp0", + logic_app_name="testcontainerApp0", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/LogicApps_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete_deploy_workflow_artifacts.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete_deploy_workflow_artifacts.py new file mode 100644 index 000000000000..64c12fa093f9 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete_deploy_workflow_artifacts.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 logic_apps_delete_deploy_workflow_artifacts.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + client.logic_apps.deploy_workflow_artifacts( + resource_group_name="testrg123", + container_app_name="testapp2", + logic_app_name="testapp2", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/LogicApps_DeleteDeployWorkflowArtifacts.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get.py new file mode 100644 index 000000000000..b3cfc3f73f3c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_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 logic_apps_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.logic_apps.get( + resource_group_name="examplerg", + container_app_name="testcontainerApp0", + logic_app_name="testcontainerApp0", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/LogicApps_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get_workflow.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get_workflow.py new file mode 100644 index 000000000000..a7f35d006aae --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get_workflow.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_get_workflow.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.logic_apps.get_workflow( + resource_group_name="examplerg", + container_app_name="testcontainerApp0", + logic_app_name="testcontainerApp0", + workflow_name="stateful1", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/LogicApps_GetWorkflow.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_connections.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_connections.py new file mode 100644 index 000000000000..f4ecdbd37dfb --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_connections.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_list_connections.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.logic_apps.list_workflows_connections( + resource_group_name="testrg123", + container_app_name="testapp2", + logic_app_name="testapp2", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/LogicApps_ListConnections.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_workflows.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_workflows.py new file mode 100644 index 000000000000..a38a520f60b2 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_workflows.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_list_workflows.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.logic_apps.list_workflows( + resource_group_name="examplerg", + container_app_name="testcontainerApp0", + logic_app_name="testcontainerApp0", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/LogicApps_ListWorkflows.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_post_deploy_workflow_artifacts.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_post_deploy_workflow_artifacts.py new file mode 100644 index 000000000000..f6fa6ea92b08 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_post_deploy_workflow_artifacts.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 logic_apps_post_deploy_workflow_artifacts.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + client.logic_apps.deploy_workflow_artifacts( + resource_group_name="testrg123", + container_app_name="testapp2", + logic_app_name="testapp2", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/LogicApps_PostDeployWorkflowArtifacts.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py index ddfc5f4f71b9..885fc979e31d 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedCertificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedCertificate_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_delete.py index 7cd14a089046..c69ad3983800 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 @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedCertificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedCertificate_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_get.py index a7ccc42102b2..6b4e0e1b2032 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedCertificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedCertificate_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_list_by_managed_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_list_by_managed_environment.py index 4941f24b8a2f..58891fcd5581 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedCertificates_ListByManagedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedCertificates_ListByManagedEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_patch.py index a1ee2af5d93a..d31d8e902793 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -41,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedCertificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedCertificates_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_get.py index 9c5737f1cd68..a322e73f55b4 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentDiagnostics_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironmentDiagnostics_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_list.py index 60b3bed0ac13..7437f59e597a 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentDiagnostics_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironmentDiagnostics_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_create_or_update.py new file mode 100644 index 000000000000..5a91d254a868 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_create_or_update.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_maintenance_configurations_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="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.maintenance_configurations.create_or_update( + resource_group_name="rg1", + environment_name="managedEnv", + config_name="default", + maintenance_configuration_envelope={ + "properties": {"scheduledEntries": [{"durationHours": 9, "startHourUtc": 12, "weekDay": "Sunday"}]} + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironment_MaintenanceConfigurations_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_delete.py new file mode 100644 index 000000000000..c4e35507178a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_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 managed_environment_maintenance_configurations_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.maintenance_configurations.delete( + resource_group_name="rg1", + environment_name="managedEnv", + config_name="default", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironment_MaintenanceConfigurations_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_get.py new file mode 100644 index 000000000000..58e95720befb --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_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 managed_environment_maintenance_configurations_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.maintenance_configurations.get( + resource_group_name="rg1", + environment_name="managedEnv", + config_name="default", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironment_MaintenanceConfigurations_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_list.py new file mode 100644 index 000000000000..286e553c9c66 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_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 managed_environment_maintenance_configurations_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.maintenance_configurations.list( + resource_group_name="rg1", + environment_name="managedEnv", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironment_MaintenanceConfigurations_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_create_or_update.py new file mode 100644 index 000000000000..7d94cc0668ca --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_create_or_update.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_private_endpoint_connections_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.managed_environment_private_endpoint_connections.begin_create_or_update( + resource_group_name="examplerg", + environment_name="managedEnv", + private_endpoint_connection_name="jlaw-demo1", + private_endpoint_connection_envelope={ + "properties": {"privateLinkServiceConnectionState": {"actionsRequired": "None", "status": "Approved"}} + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironmentPrivateEndpointConnections_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_delete.py new file mode 100644 index 000000000000..4f88a1b93207 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_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 managed_environment_private_endpoint_connections_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.managed_environment_private_endpoint_connections.begin_delete( + resource_group_name="examplerg", + environment_name="managedEnv", + private_endpoint_connection_name="jlaw-demo1", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironmentPrivateEndpointConnections_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_get.py new file mode 100644 index 000000000000..719d2629123d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_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 managed_environment_private_endpoint_connections_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.managed_environment_private_endpoint_connections.get( + resource_group_name="examplerg", + environment_name="managedEnv", + private_endpoint_connection_name="jlaw-demo1", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironmentPrivateEndpointConnections_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_list.py new file mode 100644 index 000000000000..5cc14433c310 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_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 managed_environment_private_endpoint_connections_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.managed_environment_private_endpoint_connections.list( + resource_group_name="examplerg", + environment_name="managedEnv", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironmentPrivateEndpointConnections_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_link_resources_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_link_resources_list.py new file mode 100644 index 000000000000..f1e6eca7ae55 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_link_resources_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 managed_environment_private_link_resources_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.managed_environment_private_link_resources.list( + resource_group_name="examplerg", + environment_name="managedEnv", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironmentPrivateLinkResources_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py index 16677f20f1e6..2ace1f0202a2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentUsages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironmentUsages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_create_or_update.py index 1ceb49120e57..147bc4d15913 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -36,15 +34,47 @@ def main(): resource_group_name="examplerg", environment_name="testcontainerenv", environment_envelope={ + "identity": { + "type": "SystemAssigned, UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": {} + }, + }, "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", + } + }, + "availabilityZones": ["1", "2", "3"], "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"}, + "otlpConfigurations": [ + { + "endpoint": "dashboard.k8s.region.azurecontainerapps.io:80", + "headers": [{"key": "api-key", "value": "xxxxxxxxxxx"}], + "insecure": True, + "name": "dashboard", + } + ], + }, + "logsConfiguration": {"destinations": ["appInsights"]}, + "metricsConfiguration": {"destinations": ["dataDog"], "includeKeda": True}, + "tracesConfiguration": {"destinations": ["appInsights"], "includeDapr": True}, + }, "peerAuthentication": {"mtls": {"enabled": True}}, "peerTrafficConfiguration": {"encryption": {"enabled": True}}, "vnetConfiguration": { @@ -52,6 +82,7 @@ def main(): }, "workloadProfiles": [ { + "enableFips": True, "maximumCount": 12, "minimumCount": 3, "name": "My-GP-01", @@ -78,6 +109,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironments_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_custom_infrastructure_resource_group_create.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_custom_infrastructure_resource_group_create.py index 75aab76e8862..1be10ff061b7 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -39,6 +37,7 @@ def main(): "location": "East US", "properties": { "appLogsConfiguration": {"logAnalyticsConfiguration": {"customerId": "string", "sharedKey": "string"}}, + "availabilityZones": ["1", "2", "3"], "customDomainConfiguration": { "certificatePassword": "1234", "certificateValue": "Y2VydA==", @@ -51,6 +50,7 @@ def main(): }, "workloadProfiles": [ { + "enableFips": True, "maximumCount": 12, "minimumCount": 3, "name": "My-GP-01", @@ -77,6 +77,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_CustomInfrastructureResourceGroup_Create.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironments_CustomInfrastructureResourceGroup_Create.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_delete.py index 69b97651992a..aec96f535548 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 @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironments_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get.py index 21ecd8d3baff..3f58bc667651 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 @@ -33,7 +33,7 @@ def main(): ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironments_Get.json if __name__ == "__main__": main() n__": 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 3a452548c78a..04e706d6ffd6 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_GetAuthToken.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironments_GetAuthToken.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_resource_group.py index 529bada3b593..ae2888163165 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironments_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_subscription.py index 934110969aaf..f031733eea23 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 @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironments_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_workload_profile_states.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_workload_profile_states.py index fad3cedf2a2d..a5848860fc61 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_ListWorkloadProfileStates.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironments_ListWorkloadProfileStates.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_patch.py index 7a89e7285d6f..638ec6fc8441 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironments_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update.py index 85711c657610..24c7e9449fe7 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -50,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py new file mode 100644 index 000000000000..48f17f51871d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environments_storages_create_or_update_nfs_azure_file.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.managed_environments_storages.create_or_update( + resource_group_name="examplerg", + environment_name="managedEnv", + storage_name="jlaw-demo1", + storage_envelope={ + "properties": {"nfsAzureFile": {"accessMode": "ReadOnly", "server": "server1", "shareName": "share1"}} + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate_NfsAzureFile.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py index a942a596aaf2..de76edafee41 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 @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentsStorages_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironmentsStorages_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get.py index 6d47c9f474d1..26df3a05de4b 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentsStorages_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironmentsStorages_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py new file mode 100644 index 000000000000..becf88ace864 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environments_storages_get_nfs_azure_file.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.managed_environments_storages.get( + resource_group_name="examplerg", + environment_name="managedEnv", + storage_name="jlaw-demo1", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironmentsStorages_Get_NfsAzureFile.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py index 3fa7a7d4b11a..ae84c407984c 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentsStorages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/ManagedEnvironmentsStorages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py index 8b3049de3638..602a52d4d609 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Operations_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py index f90a1ec8bc8a..8c45a7a53966 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Replicas_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Replicas_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py index d6bda773f347..d8f2b97cbfe9 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Replicas_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Replicas_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py index 7b0ed29bf13e..0e1d622c5198 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_Activate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Revisions_Activate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py index e26fdd3716c8..faf629d0d885 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_Deactivate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Revisions_Deactivate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py index 732d0564a0d3..4c315b269258 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Revisions_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py index 68f48f1db6de..446bec6c10de 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Revisions_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py index faafa805c696..226c9b901665 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_Restart.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Revisions_Restart.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/session_pools_create_or_update.py similarity index 55% rename from sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py rename to sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_create_or_update.py index 5e948fcbfd82..5b2a4a24b4ab 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -17,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-appcontainers # USAGE - python job_createor_update_event_trigger.py + python session_pools_create_or_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,52 +30,42 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.jobs.begin_create_or_update( + response = client.container_apps_session_pools.begin_create_or_update( resource_group_name="rg", - job_name="testcontainerappsjob0", - job_envelope={ + session_pool_name="testsessionpool", + session_pool_envelope={ + "identity": {"type": "SystemAssigned"}, "location": "East US", "properties": { - "configuration": { - "eventTriggerConfig": { - "parallelism": 4, - "replicaCompletionCount": 1, - "scale": { - "maxExecutions": 5, - "minExecutions": 1, - "pollingInterval": 40, - "rules": [ - { - "metadata": {"topicName": "my-topic"}, - "name": "servicebuscalingrule", - "type": "azure-servicebus", - } - ], - }, - }, - "replicaRetryLimit": 10, - "replicaTimeout": 10, - "triggerType": "Event", - }, - "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", - "template": { - "containers": [{"image": "repo/testcontainerappsjob0:v1", "name": "testcontainerappsjob0"}], - "initContainers": [ + "containerType": "CustomContainer", + "customContainerTemplate": { + "containers": [ { "args": ["-c", "while true; do echo hello; sleep 10;done"], "command": ["/bin/sh"], - "image": "repo/testcontainerappsjob0:v4", - "name": "testinitcontainerAppsJob0", - "resources": {"cpu": 0.5, "memory": "1Gi"}, + "image": "repo/testcontainer:v4", + "name": "testinitcontainer", + "resources": {"cpu": 0.25, "memory": "0.5Gi"}, } ], + "ingress": {"targetPort": 80}, + "registryCredentials": { + "identity": "/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP", + "server": "test.azurecr.io", + }, }, + "dynamicPoolConfiguration": {"cooldownPeriodInSeconds": 600, "executionType": "Timed"}, + "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", + "managedIdentitySettings": [{"identity": "system", "lifecycle": "Main"}], + "poolManagementType": "Dynamic", + "scaleConfiguration": {"maxConcurrentSessions": 500, "readySessionInstances": 100}, + "sessionNetworkConfiguration": {"status": "EgressEnabled"}, }, }, ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_CreateorUpdate_EventTrigger.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/SessionPools_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_delete.py new file mode 100644 index 000000000000..7c4fe22b1fcc --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_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 session_pools_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + 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.container_apps_session_pools.begin_delete( + resource_group_name="rg", + session_pool_name="testsessionpool", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/SessionPools_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_get.py new file mode 100644 index 000000000000..1c710125ca36 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python session_pools_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.container_apps_session_pools.get( + resource_group_name="rg", + session_pool_name="testsessionpool", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/SessionPools_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_resource_group.py new file mode 100644 index 000000000000..a73412ce069b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_resource_group.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python session_pools_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="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.container_apps_session_pools.list_by_resource_group( + resource_group_name="rg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/SessionPools_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_subscription.py new file mode 100644 index 000000000000..666ca35f78e9 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_subscription.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 session_pools_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.container_apps_session_pools.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/SessionPools_ListBySubscription.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/session_pools_patch.py similarity index 51% rename from sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py rename to sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_patch.py index a923c994dd36..0869cb09e702 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_patch.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -17,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-appcontainers # USAGE - python job_patch.py + python session_pools_patch.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,52 +30,32 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.jobs.begin_update( + response = client.container_apps_session_pools.begin_update( resource_group_name="rg", - job_name="testcontainerappsjob0", - job_envelope={ + session_pool_name="testsessionpool", + session_pool_envelope={ "properties": { - "configuration": { - "manualTriggerConfig": {"parallelism": 4, "replicaCompletionCount": 1}, - "replicaRetryLimit": 10, - "replicaTimeout": 10, - "triggerType": "Manual", - }, - "template": { + "customContainerTemplate": { "containers": [ - { - "image": "repo/testcontainerappsjob0:v1", - "name": "testcontainerappsjob0", - "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/testcontainerappsjob0:v4", - "name": "testinitcontainerAppsJob0", - "resources": {"cpu": 0.5, "memory": "1Gi"}, + "image": "repo/testcontainer:v4", + "name": "testinitcontainer", + "resources": {"cpu": 0.25, "memory": "0.5Gi"}, } ], + "ingress": {"targetPort": 80}, }, + "dynamicPoolConfiguration": {"cooldownPeriodInSeconds": 600, "executionType": "Timed"}, + "scaleConfiguration": {"maxConcurrentSessions": 500, "readySessionInstances": 100}, + "sessionNetworkConfiguration": {"status": "EgressEnabled"}, } }, ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/SessionPools_Patch.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 ce791ab93ee0..93435656f227 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -46,7 +44,9 @@ def main(): "kind": "feaderated", "tenantId": "", }, + "buildEnvironmentVariables": [{"name": "foo1", "value": "bar1"}, {"name": "foo2", "value": "bar2"}], "contextPath": "./", + "dockerfilePath": "./Dockerfile", "githubPersonalAccessToken": "test", "image": "image/tag", "registryInfo": { @@ -62,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/SourceControls_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-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 6d0b6b962576..5a05cff8ce41 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 @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/SourceControls_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-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 2b0cc9cb70cd..188bd1deda3f 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/SourceControls_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/SourceControls_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_list_by_container.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_list_by_container.py index 1351c607e646..20dbc36c36d9 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/SourceControls_ListByContainer.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/SourceControls_ListByContainer.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py index 10e891b6f3b8..02c44bb0c588 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Subscriptions_GetCustomDomainVerificationId.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Subscriptions_GetCustomDomainVerificationId.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py index e40fedb4050e..27b3b7bac266 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Usages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-10-02-preview/examples/Usages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api.py index d82f71473a23..40d4267efe99 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api.py @@ -25,7 +25,7 @@ def test_job_execution(self, resource_group): resource_group_name=resource_group.name, job_name="str", job_execution_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -35,7 +35,7 @@ def test_job_execution(self, resource_group): @recorded_by_proxy def test_get_custom_domain_verification_id(self, resource_group): response = self.client.get_custom_domain_verification_id( - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations.py new file mode 100644 index 000000000000..cb16c9119f95 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations.py @@ -0,0 +1,151 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIAppResiliencyOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.app_resiliency.create_or_update( + resource_group_name=resource_group.name, + app_name="str", + name="str", + resiliency_envelope={ + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "maxEjectionPercent": 0}, + "httpConnectionPool": {"http1MaxPendingRequests": 0, "http2MaxRequests": 0}, + "httpRetryPolicy": { + "errors": ["str"], + "headers": [ + { + "exactMatch": "str", + "header": "str", + "prefixMatch": "str", + "regexMatch": "str", + "suffixMatch": "str", + } + ], + "httpStatusCodes": [0], + "initialDelayInMilliseconds": 0, + "maxIntervalInMilliseconds": 0, + "maxRetries": 0, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tcpConnectionPool": {"maxConnections": 0}, + "tcpRetryPolicy": {"maxConnectAttempts": 0}, + "timeoutPolicy": {"connectionTimeoutInSeconds": 0, "responseTimeoutInSeconds": 0}, + "type": "str", + }, + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.app_resiliency.update( + resource_group_name=resource_group.name, + app_name="str", + name="str", + resiliency_envelope={ + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "maxEjectionPercent": 0}, + "httpConnectionPool": {"http1MaxPendingRequests": 0, "http2MaxRequests": 0}, + "httpRetryPolicy": { + "errors": ["str"], + "headers": [ + { + "exactMatch": "str", + "header": "str", + "prefixMatch": "str", + "regexMatch": "str", + "suffixMatch": "str", + } + ], + "httpStatusCodes": [0], + "initialDelayInMilliseconds": 0, + "maxIntervalInMilliseconds": 0, + "maxRetries": 0, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tcpConnectionPool": {"maxConnections": 0}, + "tcpRetryPolicy": {"maxConnectAttempts": 0}, + "timeoutPolicy": {"connectionTimeoutInSeconds": 0, "responseTimeoutInSeconds": 0}, + "type": "str", + }, + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.app_resiliency.delete( + resource_group_name=resource_group.name, + app_name="str", + name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.app_resiliency.get( + resource_group_name=resource_group.name, + app_name="str", + name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.app_resiliency.list( + resource_group_name=resource_group.name, + app_name="str", + api_version="2024-10-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations_async.py new file mode 100644 index 000000000000..defbd6b83dc4 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations_async.py @@ -0,0 +1,152 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIAppResiliencyOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.app_resiliency.create_or_update( + resource_group_name=resource_group.name, + app_name="str", + name="str", + resiliency_envelope={ + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "maxEjectionPercent": 0}, + "httpConnectionPool": {"http1MaxPendingRequests": 0, "http2MaxRequests": 0}, + "httpRetryPolicy": { + "errors": ["str"], + "headers": [ + { + "exactMatch": "str", + "header": "str", + "prefixMatch": "str", + "regexMatch": "str", + "suffixMatch": "str", + } + ], + "httpStatusCodes": [0], + "initialDelayInMilliseconds": 0, + "maxIntervalInMilliseconds": 0, + "maxRetries": 0, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tcpConnectionPool": {"maxConnections": 0}, + "tcpRetryPolicy": {"maxConnectAttempts": 0}, + "timeoutPolicy": {"connectionTimeoutInSeconds": 0, "responseTimeoutInSeconds": 0}, + "type": "str", + }, + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.app_resiliency.update( + resource_group_name=resource_group.name, + app_name="str", + name="str", + resiliency_envelope={ + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "maxEjectionPercent": 0}, + "httpConnectionPool": {"http1MaxPendingRequests": 0, "http2MaxRequests": 0}, + "httpRetryPolicy": { + "errors": ["str"], + "headers": [ + { + "exactMatch": "str", + "header": "str", + "prefixMatch": "str", + "regexMatch": "str", + "suffixMatch": "str", + } + ], + "httpStatusCodes": [0], + "initialDelayInMilliseconds": 0, + "maxIntervalInMilliseconds": 0, + "maxRetries": 0, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tcpConnectionPool": {"maxConnections": 0}, + "tcpRetryPolicy": {"maxConnectAttempts": 0}, + "timeoutPolicy": {"connectionTimeoutInSeconds": 0, "responseTimeoutInSeconds": 0}, + "type": "str", + }, + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.app_resiliency.delete( + resource_group_name=resource_group.name, + app_name="str", + name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.app_resiliency.get( + resource_group_name=resource_group.name, + app_name="str", + name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.app_resiliency.list( + resource_group_name=resource_group.name, + app_name="str", + api_version="2024-10-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_async.py index 716eb1d91235..38e2b5108164 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_async.py @@ -26,7 +26,7 @@ async def test_job_execution(self, resource_group): resource_group_name=resource_group.name, job_name="str", job_execution_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -36,7 +36,7 @@ async def test_job_execution(self, resource_group): @recorded_by_proxy_async async def test_get_custom_domain_verification_id(self, resource_group): response = await self.client.get_custom_domain_verification_id( - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations.py index 6948c249259b..e93c162d89bc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations.py @@ -23,7 +23,7 @@ def setup_method(self, method): def test_get(self, resource_group): response = self.client.available_workload_profiles.get( location="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations_async.py index e6ab51877e5e..5f186c371978 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations_async.py @@ -24,7 +24,7 @@ def setup_method(self, method): async def test_get(self, resource_group): response = self.client.available_workload_profiles.get( location="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations.py index 37180bee78a0..07c958a6f6ab 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations.py @@ -23,7 +23,7 @@ def setup_method(self, method): def test_get(self, resource_group): response = self.client.billing_meters.get( location="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations_async.py index 82c9273ce85e..49c7b4d622f6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations_async.py @@ -24,7 +24,7 @@ def setup_method(self, method): async def test_get(self, resource_group): response = await self.client.billing_meters.get( location="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations.py new file mode 100644 index 000000000000..c723ca272caa --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildAuthTokenOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.build_auth_token.list( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations_async.py new file mode 100644 index 000000000000..544e714615aa --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations_async.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildAuthTokenOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = await self.client.build_auth_token.list( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations.py new file mode 100644 index 000000000000..351477a443d2 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.builders.list_by_subscription( + api_version="2024-10-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.builders.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-10-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.builders.get( + resource_group_name=resource_group.name, + builder_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.builders.begin_create_or_update( + resource_group_name=resource_group.name, + builder_name="str", + builder_envelope={ + "location": "str", + "containerRegistries": [{"containerRegistryServer": "str", "identityResourceId": "str"}], + "environmentId": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.builders.begin_update( + resource_group_name=resource_group.name, + builder_name="str", + builder_envelope={ + "environmentId": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "tags": {"str": "str"}, + }, + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.builders.begin_delete( + resource_group_name=resource_group.name, + builder_name="str", + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations_async.py new file mode 100644 index 000000000000..b7a279e0950c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations_async.py @@ -0,0 +1,129 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.builders.list_by_subscription( + api_version="2024-10-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.builders.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-10-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.builders.get( + resource_group_name=resource_group.name, + builder_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.builders.begin_create_or_update( + resource_group_name=resource_group.name, + builder_name="str", + builder_envelope={ + "location": "str", + "containerRegistries": [{"containerRegistryServer": "str", "identityResourceId": "str"}], + "environmentId": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.builders.begin_update( + resource_group_name=resource_group.name, + builder_name="str", + builder_envelope={ + "environmentId": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "tags": {"str": "str"}, + }, + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.builders.begin_delete( + resource_group_name=resource_group.name, + builder_name="str", + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations.py new file mode 100644 index 000000000000..ee61ed426108 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildsByBuilderResourceOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.builds_by_builder_resource.list( + resource_group_name=resource_group.name, + builder_name="str", + api_version="2024-10-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations_async.py new file mode 100644 index 000000000000..e90c98c2c443 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildsByBuilderResourceOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.builds_by_builder_resource.list( + resource_group_name=resource_group.name, + builder_name="str", + api_version="2024-10-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations.py new file mode 100644 index 000000000000..629c8e385850 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations.py @@ -0,0 +1,90 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.builds.get( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.builds.begin_create_or_update( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + build_envelope={ + "buildStatus": "str", + "configuration": { + "baseOs": "str", + "environmentVariables": [{"name": "str", "value": "str"}], + "platform": "str", + "platformVersion": "str", + "preBuildSteps": [ + { + "description": "str", + "httpGet": {"url": "str", "fileName": "str", "headers": ["str"]}, + "scripts": ["str"], + } + ], + }, + "destinationContainerRegistry": {"server": "str", "image": "str"}, + "id": "str", + "logStreamEndpoint": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tokenEndpoint": "str", + "type": "str", + "uploadEndpoint": "str", + }, + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.builds.begin_delete( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations_async.py new file mode 100644 index 000000000000..cba545e20431 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations_async.py @@ -0,0 +1,95 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.builds.get( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.builds.begin_create_or_update( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + build_envelope={ + "buildStatus": "str", + "configuration": { + "baseOs": "str", + "environmentVariables": [{"name": "str", "value": "str"}], + "platform": "str", + "platformVersion": "str", + "preBuildSteps": [ + { + "description": "str", + "httpGet": {"url": "str", "fileName": "str", "headers": ["str"]}, + "scripts": ["str"], + } + ], + }, + "destinationContainerRegistry": {"server": "str", "image": "str"}, + "id": "str", + "logStreamEndpoint": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tokenEndpoint": "str", + "type": "str", + "uploadEndpoint": "str", + }, + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.builds.begin_delete( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations.py index 4121a6412c41..dec7806cc204 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.certificates.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", certificate_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -50,7 +50,7 @@ def test_create_or_update(self, resource_group): resource_group_name=resource_group.name, environment_name="str", certificate_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -63,7 +63,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", certificate_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -77,7 +77,7 @@ def test_update(self, resource_group): environment_name="str", certificate_name="str", certificate_envelope={"tags": {"str": "str"}}, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations_async.py index 6d55ddc67e4b..1ed3a7e8fb3c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = self.client.certificates.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", certificate_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -51,7 +51,7 @@ async def test_create_or_update(self, resource_group): resource_group_name=resource_group.name, environment_name="str", certificate_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -64,7 +64,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", certificate_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -78,7 +78,7 @@ async def test_update(self, resource_group): environment_name="str", certificate_name="str", certificate_envelope={"tags": {"str": "str"}}, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations.py index ae2bdb1f1c8f..f5e03af5259d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.connected_environments_certificates.list( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", certificate_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -45,40 +45,40 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): - response = self.client.connected_environments_certificates.create_or_update( + def test_begin_create_or_update(self, resource_group): + response = self.client.connected_environments_certificates.begin_create_or_update( resource_group_name=resource_group.name, connected_environment_name="str", certificate_name="str", - api_version="2024-03-01", - ) + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): - response = self.client.connected_environments_certificates.delete( + def test_begin_delete(self, resource_group): + response = self.client.connected_environments_certificates.begin_delete( resource_group_name=resource_group.name, connected_environment_name="str", certificate_name="str", - api_version="2024-03-01", - ) + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): - response = self.client.connected_environments_certificates.update( + def test_begin_update(self, resource_group): + response = self.client.connected_environments_certificates.begin_update( resource_group_name=resource_group.name, connected_environment_name="str", certificate_name="str", certificate_envelope={"tags": {"str": "str"}}, - api_version="2024-03-01", - ) + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations_async.py index fdb2391bf174..8ae4dab8706c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = self.client.connected_environments_certificates.list( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", certificate_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -46,40 +46,46 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): - response = await self.client.connected_environments_certificates.create_or_update( - resource_group_name=resource_group.name, - connected_environment_name="str", - certificate_name="str", - api_version="2024-03-01", - ) + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.connected_environments_certificates.begin_create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): - response = await self.client.connected_environments_certificates.delete( - resource_group_name=resource_group.name, - connected_environment_name="str", - certificate_name="str", - api_version="2024-03-01", - ) + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.connected_environments_certificates.begin_delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): - response = await self.client.connected_environments_certificates.update( - resource_group_name=resource_group.name, - connected_environment_name="str", - certificate_name="str", - certificate_envelope={"tags": {"str": "str"}}, - api_version="2024-03-01", - ) + async def test_begin_update(self, resource_group): + response = await ( + await self.client.connected_environments_certificates.begin_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + certificate_envelope={"tags": {"str": "str"}}, + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations.py index fb3d650fb0ac..1fd00ef52211 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.connected_environments_dapr_components.list( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -45,21 +45,29 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): - response = self.client.connected_environments_dapr_components.create_or_update( + def test_begin_create_or_update(self, resource_group): + response = self.client.connected_environments_dapr_components.begin_create_or_update( resource_group_name=resource_group.name, connected_environment_name="str", component_name="str", dapr_component_envelope={ - "componentType": "str", "id": "str", - "ignoreErrors": False, - "initTimeout": "str", - "metadata": [{"name": "str", "secretRef": "str", "value": "str"}], "name": "str", - "scopes": ["str"], - "secretStoreComponent": "str", - "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "properties": { + "componentType": "str", + "deploymentErrors": "str", + "ignoreErrors": False, + "initTimeout": "str", + "metadata": [{"name": "str", "secretRef": "str", "value": "str"}], + "provisioningState": "str", + "scopes": ["str"], + "secretStoreComponent": "str", + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "serviceComponentBind": [ + {"metadata": {"name": "str", "value": "str"}, "name": "str", "serviceId": "str"} + ], + "version": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -69,23 +77,22 @@ def test_create_or_update(self, resource_group): "lastModifiedByType": "str", }, "type": "str", - "version": "str", }, - api_version="2024-03-01", - ) + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): - response = self.client.connected_environments_dapr_components.delete( + def test_begin_delete(self, resource_group): + response = self.client.connected_environments_dapr_components.begin_delete( resource_group_name=resource_group.name, connected_environment_name="str", component_name="str", - api_version="2024-03-01", - ) + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @@ -97,7 +104,7 @@ def test_list_secrets(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations_async.py index 988b44a31192..5c2d09856b0a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = self.client.connected_environments_dapr_components.list( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -46,47 +46,58 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): - response = await self.client.connected_environments_dapr_components.create_or_update( - resource_group_name=resource_group.name, - connected_environment_name="str", - component_name="str", - dapr_component_envelope={ - "componentType": "str", - "id": "str", - "ignoreErrors": False, - "initTimeout": "str", - "metadata": [{"name": "str", "secretRef": "str", "value": "str"}], - "name": "str", - "scopes": ["str"], - "secretStoreComponent": "str", - "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.connected_environments_dapr_components.begin_create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + component_name="str", + dapr_component_envelope={ + "id": "str", + "name": "str", + "properties": { + "componentType": "str", + "deploymentErrors": "str", + "ignoreErrors": False, + "initTimeout": "str", + "metadata": [{"name": "str", "secretRef": "str", "value": "str"}], + "provisioningState": "str", + "scopes": ["str"], + "secretStoreComponent": "str", + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "serviceComponentBind": [ + {"metadata": {"name": "str", "value": "str"}, "name": "str", "serviceId": "str"} + ], + "version": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", }, - "type": "str", - "version": "str", - }, - api_version="2024-03-01", - ) + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): - response = await self.client.connected_environments_dapr_components.delete( - resource_group_name=resource_group.name, - connected_environment_name="str", - component_name="str", - api_version="2024-03-01", - ) + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.connected_environments_dapr_components.begin_delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + component_name="str", + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @@ -98,7 +109,7 @@ async def test_list_secrets(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations.py index ae8eb9f64b0e..8a1bd704f93e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_list_by_subscription(self, resource_group): response = self.client.connected_environments.list_by_subscription( - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -33,7 +33,7 @@ def test_list_by_subscription(self, resource_group): def test_list_by_resource_group(self, resource_group): response = self.client.connected_environments.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): response = self.client.connected_environments.get( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -60,6 +60,7 @@ def test_begin_create_or_update(self, resource_group): environment_envelope={ "location": "str", "customDomainConfiguration": { + "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, "certificatePassword": "str", "certificateValue": bytes("bytes", encoding="utf-8"), "customDomainVerificationId": "str", @@ -87,7 +88,7 @@ def test_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -99,7 +100,7 @@ def test_begin_delete(self, resource_group): response = self.client.connected_environments.begin_delete( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -111,7 +112,7 @@ def test_update(self, resource_group): response = self.client.connected_environments.update( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -124,7 +125,7 @@ def test_check_name_availability(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", check_name_availability_request={"name": "str", "type": "str"}, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations_async.py index 17f6e480b79d..a5ff68392a27 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_list_by_subscription(self, resource_group): response = self.client.connected_environments.list_by_subscription( - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -34,7 +34,7 @@ async def test_list_by_subscription(self, resource_group): async def test_list_by_resource_group(self, resource_group): response = self.client.connected_environments.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): response = await self.client.connected_environments.get( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -62,6 +62,7 @@ async def test_begin_create_or_update(self, resource_group): environment_envelope={ "location": "str", "customDomainConfiguration": { + "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, "certificatePassword": "str", "certificateValue": bytes("bytes", encoding="utf-8"), "customDomainVerificationId": "str", @@ -89,7 +90,7 @@ async def test_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -103,7 +104,7 @@ async def test_begin_delete(self, resource_group): await self.client.connected_environments.begin_delete( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -116,7 +117,7 @@ async def test_update(self, resource_group): response = await self.client.connected_environments.update( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -129,7 +130,7 @@ async def test_check_name_availability(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", check_name_availability_request={"name": "str", "type": "str"}, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations.py index 49e6968e87c3..6f3da40fc0f3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.connected_environments_storages.list( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", storage_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -45,8 +45,8 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): - response = self.client.connected_environments_storages.create_or_update( + def test_begin_create_or_update(self, resource_group): + response = self.client.connected_environments_storages.begin_create_or_update( resource_group_name=resource_group.name, connected_environment_name="str", storage_name="str", @@ -54,7 +54,17 @@ def test_create_or_update(self, resource_group): "id": "str", "name": "str", "properties": { - "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"} + "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"}, + "deploymentErrors": "str", + "provisioningState": "str", + "smb": { + "accessMode": "str", + "domain": "str", + "host": "str", + "password": "str", + "shareName": "str", + "username": "str", + }, }, "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -66,21 +76,21 @@ def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-03-01", - ) + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): - response = self.client.connected_environments_storages.delete( + def test_begin_delete(self, resource_group): + response = self.client.connected_environments_storages.begin_delete( resource_group_name=resource_group.name, connected_environment_name="str", storage_name="str", - api_version="2024-03-01", - ) + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations_async.py index e0735233e1c3..0309670a919d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = await self.client.connected_environments_storages.list( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", storage_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -46,42 +46,61 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): - response = await self.client.connected_environments_storages.create_or_update( - resource_group_name=resource_group.name, - connected_environment_name="str", - storage_name="str", - storage_envelope={ - "id": "str", - "name": "str", - "properties": { - "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"} + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.connected_environments_storages.begin_create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + storage_name="str", + storage_envelope={ + "id": "str", + "name": "str", + "properties": { + "azureFile": { + "accessMode": "str", + "accountKey": "str", + "accountName": "str", + "shareName": "str", + }, + "deploymentErrors": "str", + "provisioningState": "str", + "smb": { + "accessMode": "str", + "domain": "str", + "host": "str", + "password": "str", + "shareName": "str", + "username": "str", + }, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - }, - api_version="2024-03-01", - ) + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): - response = await self.client.connected_environments_storages.delete( - resource_group_name=resource_group.name, - connected_environment_name="str", - storage_name="str", - api_version="2024-03-01", - ) + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.connected_environments_storages.begin_delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + storage_name="str", + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations.py index 72c31728e087..d1d11cc06b56 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations.py @@ -24,7 +24,7 @@ def test_list_by_container_app(self, resource_group): response = self.client.container_apps_auth_configs.list_by_container_app( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", auth_config_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -144,7 +144,12 @@ def test_create_or_update(self, resource_group): "preserveUrlFragmentsForLogins": bool, "routes": {"logoutEndpoint": "str"}, "tokenStore": { - "azureBlobStorage": {"sasUrlSettingName": "str"}, + "azureBlobStorage": { + "blobContainerUri": "str", + "clientId": "str", + "managedIdentityResourceId": "str", + "sasUrlSettingName": "str", + }, "enabled": bool, "tokenRefreshExtensionHours": 0.0, }, @@ -161,7 +166,7 @@ def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -174,7 +179,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", auth_config_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations_async.py index 86a7203c755f..bfc68aa99364 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations_async.py @@ -25,7 +25,7 @@ async def test_list_by_container_app(self, resource_group): response = self.client.container_apps_auth_configs.list_by_container_app( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", auth_config_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -145,7 +145,12 @@ async def test_create_or_update(self, resource_group): "preserveUrlFragmentsForLogins": bool, "routes": {"logoutEndpoint": "str"}, "tokenStore": { - "azureBlobStorage": {"sasUrlSettingName": "str"}, + "azureBlobStorage": { + "blobContainerUri": "str", + "clientId": "str", + "managedIdentityResourceId": "str", + "sasUrlSettingName": "str", + }, "enabled": bool, "tokenRefreshExtensionHours": 0.0, }, @@ -162,7 +167,7 @@ async def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -175,7 +180,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", auth_config_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations.py new file mode 100644 index 000000000000..bc831dc7973a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsBuildsByContainerAppOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.container_apps_builds_by_container_app.list( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-10-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations_async.py new file mode 100644 index 000000000000..c1bcffa29933 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsBuildsByContainerAppOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.container_apps_builds_by_container_app.list( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-10-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations.py new file mode 100644 index 000000000000..9aa068f7bfcf --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsBuildsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.container_apps_builds.get( + resource_group_name=resource_group.name, + container_app_name="str", + build_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.container_apps_builds.begin_delete( + resource_group_name=resource_group.name, + container_app_name="str", + build_name="str", + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations_async.py new file mode 100644 index 000000000000..d40aadcd5bca --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations_async.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsBuildsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.container_apps_builds.get( + resource_group_name=resource_group.name, + container_app_name="str", + build_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.container_apps_builds.begin_delete( + resource_group_name=resource_group.name, + container_app_name="str", + build_name="str", + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations.py index 6a8d78112bc9..c5c26d840f50 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations.py @@ -24,7 +24,7 @@ def test_list_detectors(self, resource_group): response = self.client.container_apps_diagnostics.list_detectors( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get_detector(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", detector_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -49,7 +49,7 @@ def test_list_revisions(self, resource_group): response = self.client.container_apps_diagnostics.list_revisions( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -62,7 +62,7 @@ def test_get_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -74,7 +74,7 @@ def test_get_root(self, resource_group): response = self.client.container_apps_diagnostics.get_root( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations_async.py index 4531aa56ad90..19665bb4d04c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations_async.py @@ -25,7 +25,7 @@ async def test_list_detectors(self, resource_group): response = self.client.container_apps_diagnostics.list_detectors( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get_detector(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", detector_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -50,7 +50,7 @@ async def test_list_revisions(self, resource_group): response = self.client.container_apps_diagnostics.list_revisions( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -63,7 +63,7 @@ async def test_get_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -75,7 +75,7 @@ async def test_get_root(self, resource_group): response = await self.client.container_apps_diagnostics.get_root( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_label_history_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_label_history_operations.py new file mode 100644 index 000000000000..1321e468248e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_label_history_operations.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsLabelHistoryOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_label_history(self, resource_group): + response = self.client.container_apps_label_history.list_label_history( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-10-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_label_history(self, resource_group): + response = self.client.container_apps_label_history.get_label_history( + resource_group_name=resource_group.name, + container_app_name="str", + label_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_label_history_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_label_history_operations_async.py new file mode 100644 index 000000000000..0f0807472ba8 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_label_history_operations_async.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsLabelHistoryOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_label_history(self, resource_group): + response = self.client.container_apps_label_history.list_label_history( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-10-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_label_history(self, resource_group): + response = await self.client.container_apps_label_history.get_label_history( + resource_group_name=resource_group.name, + container_app_name="str", + label_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations.py index 6c517f7440be..ec34e004e8c8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_list_by_subscription(self, resource_group): response = self.client.container_apps.list_by_subscription( - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -33,7 +33,7 @@ def test_list_by_subscription(self, resource_group): def test_list_by_resource_group(self, resource_group): response = self.client.container_apps.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): response = self.client.container_apps.get( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -71,6 +71,7 @@ def test_begin_create_or_update(self, resource_group): "httpReadBufferSize": 0, "logLevel": "str", }, + "identitySettings": [{"identity": "str", "lifecycle": "str"}], "ingress": { "additionalPortMappings": [{"external": bool, "targetPort": 0, "exposedPort": 0}], "allowInsecure": False, @@ -92,15 +93,29 @@ def test_begin_create_or_update(self, resource_group): ], "stickySessions": {"affinity": "str"}, "targetPort": 0, + "targetPortHttpScheme": "str", "traffic": [{"label": "str", "latestRevision": False, "revisionName": "str", "weight": 0}], "transport": "auto", }, "maxInactiveRevisions": 0, "registries": [{"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"}], + "revisionTransitionThreshold": 0, + "runtime": { + "dotnet": {"autoConfigureDataProtection": bool}, + "java": { + "enableMetrics": bool, + "javaAgent": { + "enabled": bool, + "logging": {"loggerSettings": [{"level": "str", "logger": "str"}]}, + }, + }, + }, "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], "service": {"type": "str"}, + "targetLabel": "str", }, "customDomainVerificationId": "str", + "deploymentErrors": "str", "environmentId": "str", "eventStreamEndpoint": "str", "extendedLocation": {"name": "str", "type": "str"}, @@ -111,6 +126,7 @@ def test_begin_create_or_update(self, resource_group): "tenantId": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, + "kind": "str", "latestReadyRevisionName": "str", "latestRevisionFqdn": "str", "latestRevisionName": "str", @@ -118,7 +134,9 @@ def test_begin_create_or_update(self, resource_group): "managedEnvironmentId": "str", "name": "str", "outboundIpAddresses": ["str"], + "patchingConfiguration": {"patchingMode": "str"}, "provisioningState": "str", + "runningStatus": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -135,6 +153,7 @@ def test_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -155,7 +174,7 @@ def test_begin_create_or_update(self, resource_group): "type": "str", } ], - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -165,40 +184,50 @@ def test_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], "revisionSuffix": "str", "scale": { + "cooldownPeriod": 0, "maxReplicas": 10, "minReplicas": 0, + "pollingInterval": 0, "rules": [ { "azureQueue": { + "accountName": "str", "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "queueLength": 0, "queueName": "str", }, "custom": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, "type": "str", }, "http": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, }, "name": "str", "tcp": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, }, } ], }, - "serviceBinds": [{"name": "str", "serviceId": "str"}], + "serviceBinds": [ + {"clientType": "str", "customizedKeys": {"str": "str"}, "name": "str", "serviceId": "str"} + ], "terminationGracePeriodSeconds": 0, "volumes": [ { @@ -213,7 +242,7 @@ def test_begin_create_or_update(self, resource_group): "type": "str", "workloadProfileName": "str", }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -225,7 +254,7 @@ def test_begin_delete(self, resource_group): response = self.client.container_apps.begin_delete( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -251,6 +280,7 @@ def test_begin_update(self, resource_group): "httpReadBufferSize": 0, "logLevel": "str", }, + "identitySettings": [{"identity": "str", "lifecycle": "str"}], "ingress": { "additionalPortMappings": [{"external": bool, "targetPort": 0, "exposedPort": 0}], "allowInsecure": False, @@ -272,15 +302,29 @@ def test_begin_update(self, resource_group): ], "stickySessions": {"affinity": "str"}, "targetPort": 0, + "targetPortHttpScheme": "str", "traffic": [{"label": "str", "latestRevision": False, "revisionName": "str", "weight": 0}], "transport": "auto", }, "maxInactiveRevisions": 0, "registries": [{"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"}], + "revisionTransitionThreshold": 0, + "runtime": { + "dotnet": {"autoConfigureDataProtection": bool}, + "java": { + "enableMetrics": bool, + "javaAgent": { + "enabled": bool, + "logging": {"loggerSettings": [{"level": "str", "logger": "str"}]}, + }, + }, + }, "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], "service": {"type": "str"}, + "targetLabel": "str", }, "customDomainVerificationId": "str", + "deploymentErrors": "str", "environmentId": "str", "eventStreamEndpoint": "str", "extendedLocation": {"name": "str", "type": "str"}, @@ -291,6 +335,7 @@ def test_begin_update(self, resource_group): "tenantId": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, + "kind": "str", "latestReadyRevisionName": "str", "latestRevisionFqdn": "str", "latestRevisionName": "str", @@ -298,7 +343,9 @@ def test_begin_update(self, resource_group): "managedEnvironmentId": "str", "name": "str", "outboundIpAddresses": ["str"], + "patchingConfiguration": {"patchingMode": "str"}, "provisioningState": "str", + "runningStatus": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -315,6 +362,7 @@ def test_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -335,7 +383,7 @@ def test_begin_update(self, resource_group): "type": "str", } ], - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -345,40 +393,50 @@ def test_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], "revisionSuffix": "str", "scale": { + "cooldownPeriod": 0, "maxReplicas": 10, "minReplicas": 0, + "pollingInterval": 0, "rules": [ { "azureQueue": { + "accountName": "str", "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "queueLength": 0, "queueName": "str", }, "custom": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, "type": "str", }, "http": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, }, "name": "str", "tcp": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, }, } ], }, - "serviceBinds": [{"name": "str", "serviceId": "str"}], + "serviceBinds": [ + {"clientType": "str", "customizedKeys": {"str": "str"}, "name": "str", "serviceId": "str"} + ], "terminationGracePeriodSeconds": 0, "volumes": [ { @@ -393,7 +451,7 @@ def test_begin_update(self, resource_group): "type": "str", "workloadProfileName": "str", }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -405,7 +463,7 @@ def test_list_custom_host_name_analysis(self, resource_group): response = self.client.container_apps.list_custom_host_name_analysis( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -417,7 +475,7 @@ def test_list_secrets(self, resource_group): response = self.client.container_apps.list_secrets( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -429,7 +487,7 @@ def test_get_auth_token(self, resource_group): response = self.client.container_apps.get_auth_token( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -441,7 +499,7 @@ def test_begin_start(self, resource_group): response = self.client.container_apps.begin_start( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -453,7 +511,7 @@ def test_begin_stop(self, resource_group): response = self.client.container_apps.begin_stop( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations_async.py index 1a16c76a581c..f743f42f45bd 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_list_by_subscription(self, resource_group): response = self.client.container_apps.list_by_subscription( - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -34,7 +34,7 @@ async def test_list_by_subscription(self, resource_group): async def test_list_by_resource_group(self, resource_group): response = self.client.container_apps.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): response = await self.client.container_apps.get( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -73,6 +73,7 @@ async def test_begin_create_or_update(self, resource_group): "httpReadBufferSize": 0, "logLevel": "str", }, + "identitySettings": [{"identity": "str", "lifecycle": "str"}], "ingress": { "additionalPortMappings": [{"external": bool, "targetPort": 0, "exposedPort": 0}], "allowInsecure": False, @@ -94,6 +95,7 @@ async def test_begin_create_or_update(self, resource_group): ], "stickySessions": {"affinity": "str"}, "targetPort": 0, + "targetPortHttpScheme": "str", "traffic": [{"label": "str", "latestRevision": False, "revisionName": "str", "weight": 0}], "transport": "auto", }, @@ -101,10 +103,23 @@ async def test_begin_create_or_update(self, resource_group): "registries": [ {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} ], + "revisionTransitionThreshold": 0, + "runtime": { + "dotnet": {"autoConfigureDataProtection": bool}, + "java": { + "enableMetrics": bool, + "javaAgent": { + "enabled": bool, + "logging": {"loggerSettings": [{"level": "str", "logger": "str"}]}, + }, + }, + }, "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], "service": {"type": "str"}, + "targetLabel": "str", }, "customDomainVerificationId": "str", + "deploymentErrors": "str", "environmentId": "str", "eventStreamEndpoint": "str", "extendedLocation": {"name": "str", "type": "str"}, @@ -115,6 +130,7 @@ async def test_begin_create_or_update(self, resource_group): "tenantId": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, + "kind": "str", "latestReadyRevisionName": "str", "latestRevisionFqdn": "str", "latestRevisionName": "str", @@ -122,7 +138,9 @@ async def test_begin_create_or_update(self, resource_group): "managedEnvironmentId": "str", "name": "str", "outboundIpAddresses": ["str"], + "patchingConfiguration": {"patchingMode": "str"}, "provisioningState": "str", + "runningStatus": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -139,6 +157,7 @@ async def test_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -159,7 +178,7 @@ async def test_begin_create_or_update(self, resource_group): "type": "str", } ], - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -169,40 +188,50 @@ async def test_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], "revisionSuffix": "str", "scale": { + "cooldownPeriod": 0, "maxReplicas": 10, "minReplicas": 0, + "pollingInterval": 0, "rules": [ { "azureQueue": { + "accountName": "str", "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "queueLength": 0, "queueName": "str", }, "custom": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, "type": "str", }, "http": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, }, "name": "str", "tcp": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, }, } ], }, - "serviceBinds": [{"name": "str", "serviceId": "str"}], + "serviceBinds": [ + {"clientType": "str", "customizedKeys": {"str": "str"}, "name": "str", "serviceId": "str"} + ], "terminationGracePeriodSeconds": 0, "volumes": [ { @@ -217,7 +246,7 @@ async def test_begin_create_or_update(self, resource_group): "type": "str", "workloadProfileName": "str", }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -231,7 +260,7 @@ async def test_begin_delete(self, resource_group): await self.client.container_apps.begin_delete( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -259,6 +288,7 @@ async def test_begin_update(self, resource_group): "httpReadBufferSize": 0, "logLevel": "str", }, + "identitySettings": [{"identity": "str", "lifecycle": "str"}], "ingress": { "additionalPortMappings": [{"external": bool, "targetPort": 0, "exposedPort": 0}], "allowInsecure": False, @@ -280,6 +310,7 @@ async def test_begin_update(self, resource_group): ], "stickySessions": {"affinity": "str"}, "targetPort": 0, + "targetPortHttpScheme": "str", "traffic": [{"label": "str", "latestRevision": False, "revisionName": "str", "weight": 0}], "transport": "auto", }, @@ -287,10 +318,23 @@ async def test_begin_update(self, resource_group): "registries": [ {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} ], + "revisionTransitionThreshold": 0, + "runtime": { + "dotnet": {"autoConfigureDataProtection": bool}, + "java": { + "enableMetrics": bool, + "javaAgent": { + "enabled": bool, + "logging": {"loggerSettings": [{"level": "str", "logger": "str"}]}, + }, + }, + }, "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], "service": {"type": "str"}, + "targetLabel": "str", }, "customDomainVerificationId": "str", + "deploymentErrors": "str", "environmentId": "str", "eventStreamEndpoint": "str", "extendedLocation": {"name": "str", "type": "str"}, @@ -301,6 +345,7 @@ async def test_begin_update(self, resource_group): "tenantId": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, + "kind": "str", "latestReadyRevisionName": "str", "latestRevisionFqdn": "str", "latestRevisionName": "str", @@ -308,7 +353,9 @@ async def test_begin_update(self, resource_group): "managedEnvironmentId": "str", "name": "str", "outboundIpAddresses": ["str"], + "patchingConfiguration": {"patchingMode": "str"}, "provisioningState": "str", + "runningStatus": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -325,6 +372,7 @@ async def test_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -345,7 +393,7 @@ async def test_begin_update(self, resource_group): "type": "str", } ], - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -355,40 +403,50 @@ async def test_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], "revisionSuffix": "str", "scale": { + "cooldownPeriod": 0, "maxReplicas": 10, "minReplicas": 0, + "pollingInterval": 0, "rules": [ { "azureQueue": { + "accountName": "str", "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "queueLength": 0, "queueName": "str", }, "custom": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, "type": "str", }, "http": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, }, "name": "str", "tcp": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, }, } ], }, - "serviceBinds": [{"name": "str", "serviceId": "str"}], + "serviceBinds": [ + {"clientType": "str", "customizedKeys": {"str": "str"}, "name": "str", "serviceId": "str"} + ], "terminationGracePeriodSeconds": 0, "volumes": [ { @@ -403,7 +461,7 @@ async def test_begin_update(self, resource_group): "type": "str", "workloadProfileName": "str", }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -416,7 +474,7 @@ async def test_list_custom_host_name_analysis(self, resource_group): response = await self.client.container_apps.list_custom_host_name_analysis( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -428,7 +486,7 @@ async def test_list_secrets(self, resource_group): response = await self.client.container_apps.list_secrets( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -440,7 +498,7 @@ async def test_get_auth_token(self, resource_group): response = await self.client.container_apps.get_auth_token( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -453,7 +511,7 @@ async def test_begin_start(self, resource_group): await self.client.container_apps.begin_start( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -467,7 +525,7 @@ async def test_begin_stop(self, resource_group): await self.client.container_apps.begin_stop( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations.py new file mode 100644 index 000000000000..82861c237a88 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations.py @@ -0,0 +1,84 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsPatchesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_container_app(self, resource_group): + response = self.client.container_apps_patches.list_by_container_app( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-10-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.container_apps_patches.get( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.container_apps_patches.begin_delete( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_skip_configure(self, resource_group): + response = self.client.container_apps_patches.begin_skip_configure( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + patch_skip_config={"skip": bool}, + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_apply(self, resource_group): + response = self.client.container_apps_patches.begin_apply( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations_async.py new file mode 100644 index 000000000000..46da52eabc88 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations_async.py @@ -0,0 +1,91 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsPatchesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_container_app(self, resource_group): + response = self.client.container_apps_patches.list_by_container_app( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-10-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.container_apps_patches.get( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.container_apps_patches.begin_delete( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_skip_configure(self, resource_group): + response = await ( + await self.client.container_apps_patches.begin_skip_configure( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + patch_skip_config={"skip": bool}, + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_apply(self, resource_group): + response = await ( + await self.client.container_apps_patches.begin_apply( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations.py index 68a3485ac903..d8cb13a24677 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations.py @@ -26,7 +26,7 @@ def test_get_replica(self, resource_group): container_app_name="str", revision_name="str", replica_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -39,7 +39,7 @@ def test_list_replicas(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations_async.py index d0b7c534e654..a0860cd3518a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations_async.py @@ -27,7 +27,7 @@ async def test_get_replica(self, resource_group): container_app_name="str", revision_name="str", replica_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -40,7 +40,7 @@ async def test_list_replicas(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations.py index 4223cedc2daa..d2ab3e963b45 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations.py @@ -24,7 +24,7 @@ def test_list_revisions(self, resource_group): response = self.client.container_apps_revisions.list_revisions( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -50,7 +50,7 @@ def test_activate_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -63,7 +63,7 @@ def test_deactivate_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -76,7 +76,7 @@ def test_restart_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations_async.py index 9de3f96e46c0..fd792fd702b9 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations_async.py @@ -25,7 +25,7 @@ async def test_list_revisions(self, resource_group): response = self.client.container_apps_revisions.list_revisions( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -51,7 +51,7 @@ async def test_activate_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -64,7 +64,7 @@ async def test_deactivate_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -77,7 +77,7 @@ async def test_restart_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations.py new file mode 100644 index 000000000000..854c108419d1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations.py @@ -0,0 +1,170 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsSessionPoolsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.container_apps_session_pools.list_by_subscription( + api_version="2024-10-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.container_apps_session_pools.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-10-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.container_apps_session_pools.get( + resource_group_name=resource_group.name, + session_pool_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.container_apps_session_pools.begin_create_or_update( + resource_group_name=resource_group.name, + session_pool_name="str", + session_pool_envelope={ + "location": "str", + "containerType": "str", + "customContainerTemplate": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "memory": "str"}, + } + ], + "ingress": {"targetPort": 0}, + "registryCredentials": { + "identity": "str", + "passwordSecretRef": "str", + "server": "str", + "username": "str", + }, + }, + "dynamicPoolConfiguration": {"cooldownPeriodInSeconds": 0, "executionType": "str"}, + "environmentId": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "managedIdentitySettings": [{"identity": "str", "lifecycle": "str"}], + "name": "str", + "nodeCount": 0, + "poolManagementEndpoint": "str", + "poolManagementType": "str", + "provisioningState": "str", + "scaleConfiguration": {"maxConcurrentSessions": 0, "readySessionInstances": 0}, + "secrets": [{"name": "str", "value": "str"}], + "sessionNetworkConfiguration": {"status": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.container_apps_session_pools.begin_update( + resource_group_name=resource_group.name, + session_pool_name="str", + session_pool_envelope={ + "customContainerTemplate": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "memory": "str"}, + } + ], + "ingress": {"targetPort": 0}, + "registryCredentials": { + "identity": "str", + "passwordSecretRef": "str", + "server": "str", + "username": "str", + }, + }, + "dynamicPoolConfiguration": {"cooldownPeriodInSeconds": 0, "executionType": "str"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "scaleConfiguration": {"maxConcurrentSessions": 0, "readySessionInstances": 0}, + "secrets": [{"name": "str", "value": "str"}], + "sessionNetworkConfiguration": {"status": "str"}, + }, + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.container_apps_session_pools.begin_delete( + resource_group_name=resource_group.name, + session_pool_name="str", + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations_async.py new file mode 100644 index 000000000000..b8de671d1a27 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations_async.py @@ -0,0 +1,177 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsSessionPoolsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.container_apps_session_pools.list_by_subscription( + api_version="2024-10-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.container_apps_session_pools.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-10-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.container_apps_session_pools.get( + resource_group_name=resource_group.name, + session_pool_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.container_apps_session_pools.begin_create_or_update( + resource_group_name=resource_group.name, + session_pool_name="str", + session_pool_envelope={ + "location": "str", + "containerType": "str", + "customContainerTemplate": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "memory": "str"}, + } + ], + "ingress": {"targetPort": 0}, + "registryCredentials": { + "identity": "str", + "passwordSecretRef": "str", + "server": "str", + "username": "str", + }, + }, + "dynamicPoolConfiguration": {"cooldownPeriodInSeconds": 0, "executionType": "str"}, + "environmentId": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "managedIdentitySettings": [{"identity": "str", "lifecycle": "str"}], + "name": "str", + "nodeCount": 0, + "poolManagementEndpoint": "str", + "poolManagementType": "str", + "provisioningState": "str", + "scaleConfiguration": {"maxConcurrentSessions": 0, "readySessionInstances": 0}, + "secrets": [{"name": "str", "value": "str"}], + "sessionNetworkConfiguration": {"status": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.container_apps_session_pools.begin_update( + resource_group_name=resource_group.name, + session_pool_name="str", + session_pool_envelope={ + "customContainerTemplate": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "memory": "str"}, + } + ], + "ingress": {"targetPort": 0}, + "registryCredentials": { + "identity": "str", + "passwordSecretRef": "str", + "server": "str", + "username": "str", + }, + }, + "dynamicPoolConfiguration": {"cooldownPeriodInSeconds": 0, "executionType": "str"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "scaleConfiguration": {"maxConcurrentSessions": 0, "readySessionInstances": 0}, + "secrets": [{"name": "str", "value": "str"}], + "sessionNetworkConfiguration": {"status": "str"}, + }, + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.container_apps_session_pools.begin_delete( + resource_group_name=resource_group.name, + session_pool_name="str", + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations.py index fdce9d3156fa..39ccfb331e58 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations.py @@ -24,7 +24,7 @@ def test_list_by_container_app(self, resource_group): response = self.client.container_apps_source_controls.list_by_container_app( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", source_control_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -60,7 +60,9 @@ def test_begin_create_or_update(self, resource_group): "subscriptionId": "str", "tenantId": "str", }, + "buildEnvironmentVariables": [{"name": "str", "value": "str"}], "contextPath": "str", + "dockerfilePath": "str", "githubPersonalAccessToken": "str", "image": "str", "os": "str", @@ -83,7 +85,7 @@ def test_begin_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -96,7 +98,7 @@ def test_begin_delete(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", source_control_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations_async.py index 08788e157cf6..2878be58bbc9 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations_async.py @@ -25,7 +25,7 @@ async def test_list_by_container_app(self, resource_group): response = self.client.container_apps_source_controls.list_by_container_app( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", source_control_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -62,7 +62,9 @@ async def test_begin_create_or_update(self, resource_group): "subscriptionId": "str", "tenantId": "str", }, + "buildEnvironmentVariables": [{"name": "str", "value": "str"}], "contextPath": "str", + "dockerfilePath": "str", "githubPersonalAccessToken": "str", "image": "str", "os": "str", @@ -85,7 +87,7 @@ async def test_begin_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -100,7 +102,7 @@ async def test_begin_delete(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", source_control_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations.py new file mode 100644 index 000000000000..6185f12c75ff --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations.py @@ -0,0 +1,103 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDaprComponentResiliencyPoliciesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.dapr_component_resiliency_policies.list( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + api_version="2024-10-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.dapr_component_resiliency_policies.get( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.dapr_component_resiliency_policies.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + name="str", + dapr_component_resiliency_policy_envelope={ + "id": "str", + "inboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "timeoutInSeconds": 0}, + "httpRetryPolicy": { + "maxRetries": 0, + "retryBackOff": {"initialDelayInMilliseconds": 0, "maxIntervalInMilliseconds": 0}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 0}, + }, + "name": "str", + "outboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "timeoutInSeconds": 0}, + "httpRetryPolicy": { + "maxRetries": 0, + "retryBackOff": {"initialDelayInMilliseconds": 0, "maxIntervalInMilliseconds": 0}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 0}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.dapr_component_resiliency_policies.delete( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations_async.py new file mode 100644 index 000000000000..e6b62f5c7812 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations_async.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDaprComponentResiliencyPoliciesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.dapr_component_resiliency_policies.list( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + api_version="2024-10-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.dapr_component_resiliency_policies.get( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.dapr_component_resiliency_policies.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + name="str", + dapr_component_resiliency_policy_envelope={ + "id": "str", + "inboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "timeoutInSeconds": 0}, + "httpRetryPolicy": { + "maxRetries": 0, + "retryBackOff": {"initialDelayInMilliseconds": 0, "maxIntervalInMilliseconds": 0}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 0}, + }, + "name": "str", + "outboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "timeoutInSeconds": 0}, + "httpRetryPolicy": { + "maxRetries": 0, + "retryBackOff": {"initialDelayInMilliseconds": 0, "maxIntervalInMilliseconds": 0}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 0}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.dapr_component_resiliency_policies.delete( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations.py index 8d774741aa16..efc218e9d537 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.dapr_components.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -60,6 +60,9 @@ def test_create_or_update(self, resource_group): "scopes": ["str"], "secretStoreComponent": "str", "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "serviceComponentBind": [ + {"metadata": {"name": "str", "value": "str"}, "name": "str", "serviceId": "str"} + ], "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -71,7 +74,7 @@ def test_create_or_update(self, resource_group): "type": "str", "version": "str", }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -84,7 +87,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -97,7 +100,7 @@ def test_list_secrets(self, resource_group): resource_group_name=resource_group.name, environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations_async.py index fa5ed26ad6c2..78e71aa0ae77 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = self.client.dapr_components.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -61,6 +61,9 @@ async def test_create_or_update(self, resource_group): "scopes": ["str"], "secretStoreComponent": "str", "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "serviceComponentBind": [ + {"metadata": {"name": "str", "value": "str"}, "name": "str", "serviceId": "str"} + ], "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -72,7 +75,7 @@ async def test_create_or_update(self, resource_group): "type": "str", "version": "str", }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -85,7 +88,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -98,7 +101,7 @@ async def test_list_secrets(self, resource_group): resource_group_name=resource_group.name, environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations.py new file mode 100644 index 000000000000..6e26963ea279 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations.py @@ -0,0 +1,90 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDaprSubscriptionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.dapr_subscriptions.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-10-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.dapr_subscriptions.get( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.dapr_subscriptions.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + dapr_subscription_envelope={ + "bulkSubscribe": {"enabled": False, "maxAwaitDurationMs": 0, "maxMessagesCount": 0}, + "deadLetterTopic": "str", + "id": "str", + "metadata": {"str": "str"}, + "name": "str", + "pubsubName": "str", + "routes": {"default": "str", "rules": [{"match": "str", "path": "str"}]}, + "scopes": ["str"], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topic": "str", + "type": "str", + }, + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.dapr_subscriptions.delete( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations_async.py new file mode 100644 index 000000000000..bf13d4f59ead --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations_async.py @@ -0,0 +1,91 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDaprSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.dapr_subscriptions.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-10-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.dapr_subscriptions.get( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.dapr_subscriptions.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + dapr_subscription_envelope={ + "bulkSubscribe": {"enabled": False, "maxAwaitDurationMs": 0, "maxMessagesCount": 0}, + "deadLetterTopic": "str", + "id": "str", + "metadata": {"str": "str"}, + "name": "str", + "pubsubName": "str", + "routes": {"default": "str", "rules": [{"match": "str", "path": "str"}]}, + "scopes": ["str"], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topic": "str", + "type": "str", + }, + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.dapr_subscriptions.delete( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations.py new file mode 100644 index 000000000000..ccb8897f4c77 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations.py @@ -0,0 +1,117 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDotNetComponentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.dot_net_components.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-10-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.dot_net_components.get( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.dot_net_components.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + dot_net_component_envelope={ + "componentType": "str", + "configurations": [{"propertyName": "str", "value": "str"}], + "id": "str", + "name": "str", + "provisioningState": "str", + "serviceBinds": [{"name": "str", "serviceId": "str"}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.dot_net_components.begin_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + dot_net_component_envelope={ + "componentType": "str", + "configurations": [{"propertyName": "str", "value": "str"}], + "id": "str", + "name": "str", + "provisioningState": "str", + "serviceBinds": [{"name": "str", "serviceId": "str"}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.dot_net_components.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations_async.py new file mode 100644 index 000000000000..11c06d729957 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations_async.py @@ -0,0 +1,124 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDotNetComponentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.dot_net_components.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-10-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.dot_net_components.get( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.dot_net_components.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + dot_net_component_envelope={ + "componentType": "str", + "configurations": [{"propertyName": "str", "value": "str"}], + "id": "str", + "name": "str", + "provisioningState": "str", + "serviceBinds": [{"name": "str", "serviceId": "str"}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.dot_net_components.begin_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + dot_net_component_envelope={ + "componentType": "str", + "configurations": [{"propertyName": "str", "value": "str"}], + "id": "str", + "name": "str", + "provisioningState": "str", + "serviceBinds": [{"name": "str", "serviceId": "str"}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.dot_net_components.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations.py new file mode 100644 index 000000000000..eea8f279ef88 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIFunctionsExtensionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_invoke_functions_host(self, resource_group): + response = self.client.functions_extension.invoke_functions_host( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + function_app_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations_async.py new file mode 100644 index 000000000000..f24ef8962b8a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations_async.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIFunctionsExtensionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_invoke_functions_host(self, resource_group): + response = await self.client.functions_extension.invoke_functions_host( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + function_app_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_http_route_config_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_http_route_config_operations.py new file mode 100644 index 000000000000..395bac9fca63 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_http_route_config_operations.py @@ -0,0 +1,119 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIHttpRouteConfigOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.http_route_config.get( + resource_group_name=resource_group.name, + environment_name="str", + http_route_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.http_route_config.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + http_route_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.http_route_config.update( + resource_group_name=resource_group.name, + environment_name="str", + http_route_name="str", + http_route_config_envelope={ + "id": "str", + "name": "str", + "properties": { + "customDomains": [{"name": "str", "bindingType": "str", "certificateId": "str"}], + "fqdn": "str", + "provisioningErrors": [{"message": "str", "timestamp": "2020-02-20 00:00:00"}], + "provisioningState": "str", + "rules": [ + { + "description": "str", + "routes": [ + { + "action": {"prefixRewrite": "str"}, + "match": { + "caseSensitive": bool, + "path": "str", + "pathSeparatedPrefix": "str", + "prefix": "str", + }, + } + ], + "targets": [{"containerApp": "str", "label": "str", "revision": "str", "weight": 0}], + } + ], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.http_route_config.delete( + resource_group_name=resource_group.name, + environment_name="str", + http_route_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.http_route_config.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-10-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_http_route_config_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_http_route_config_operations_async.py new file mode 100644 index 000000000000..23cb88d29886 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_http_route_config_operations_async.py @@ -0,0 +1,120 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIHttpRouteConfigOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.http_route_config.get( + resource_group_name=resource_group.name, + environment_name="str", + http_route_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.http_route_config.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + http_route_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.http_route_config.update( + resource_group_name=resource_group.name, + environment_name="str", + http_route_name="str", + http_route_config_envelope={ + "id": "str", + "name": "str", + "properties": { + "customDomains": [{"name": "str", "bindingType": "str", "certificateId": "str"}], + "fqdn": "str", + "provisioningErrors": [{"message": "str", "timestamp": "2020-02-20 00:00:00"}], + "provisioningState": "str", + "rules": [ + { + "description": "str", + "routes": [ + { + "action": {"prefixRewrite": "str"}, + "match": { + "caseSensitive": bool, + "path": "str", + "pathSeparatedPrefix": "str", + "prefix": "str", + }, + } + ], + "targets": [{"containerApp": "str", "label": "str", "revision": "str", "weight": 0}], + } + ], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.http_route_config.delete( + resource_group_name=resource_group.name, + environment_name="str", + http_route_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.http_route_config.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-10-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations.py new file mode 100644 index 000000000000..a550679e51e5 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations.py @@ -0,0 +1,111 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIJavaComponentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.java_components.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-10-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.java_components.get( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.java_components.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + java_component_envelope={ + "id": "str", + "name": "str", + "properties": "java_component_properties", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.java_components.begin_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + java_component_envelope={ + "id": "str", + "name": "str", + "properties": "java_component_properties", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.java_components.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations_async.py new file mode 100644 index 000000000000..edb26bc78b8a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations_async.py @@ -0,0 +1,118 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIJavaComponentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.java_components.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-10-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.java_components.get( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.java_components.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + java_component_envelope={ + "id": "str", + "name": "str", + "properties": "java_component_properties", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.java_components.begin_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + java_component_envelope={ + "id": "str", + "name": "str", + "properties": "java_component_properties", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.java_components.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations.py index b5e07d699dce..42697798cf4f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.jobs_executions.list( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations_async.py index 0ef51f590a96..f50754cd5915 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = self.client.jobs_executions.list( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations.py index 18f739347349..c88b2789d61e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations.py @@ -24,7 +24,7 @@ def test_list_detectors(self, resource_group): response = self.client.jobs.list_detectors( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get_detector(self, resource_group): resource_group_name=resource_group.name, job_name="str", detector_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -50,7 +50,7 @@ def test_proxy_get(self, resource_group): resource_group_name=resource_group.name, job_name="str", api_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -60,7 +60,7 @@ def test_proxy_get(self, resource_group): @recorded_by_proxy def test_list_by_subscription(self, resource_group): response = self.client.jobs.list_by_subscription( - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -71,7 +71,7 @@ def test_list_by_subscription(self, resource_group): def test_list_by_resource_group(self, resource_group): response = self.client.jobs.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -83,7 +83,7 @@ def test_get(self, resource_group): response = self.client.jobs.get( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -110,6 +110,7 @@ def test_begin_create_or_update(self, resource_group): "rules": [ { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {}, "name": "str", "type": "str", @@ -117,6 +118,7 @@ def test_begin_create_or_update(self, resource_group): ], }, }, + "identitySettings": [{"identity": "str", "lifecycle": "str"}], "manualTriggerConfig": {"parallelism": 0, "replicaCompletionCount": 0}, "registries": [{"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"}], "replicaRetryLimit": 0, @@ -125,6 +127,7 @@ def test_begin_create_or_update(self, resource_group): }, "environmentId": "str", "eventStreamEndpoint": "str", + "extendedLocation": {"name": "str", "type": "str"}, "id": "str", "identity": { "type": "str", @@ -135,6 +138,7 @@ def test_begin_create_or_update(self, resource_group): "name": "str", "outboundIpAddresses": ["str"], "provisioningState": "str", + "runningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -151,6 +155,7 @@ def test_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -171,7 +176,7 @@ def test_begin_create_or_update(self, resource_group): "type": "str", } ], - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -181,8 +186,9 @@ def test_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -199,7 +205,7 @@ def test_begin_create_or_update(self, resource_group): "type": "str", "workloadProfileName": "str", }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -211,7 +217,7 @@ def test_begin_delete(self, resource_group): response = self.client.jobs.begin_delete( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -224,6 +230,7 @@ def test_begin_update(self, resource_group): resource_group_name=resource_group.name, job_name="str", job_envelope={ + "extendedLocation": {"name": "str", "type": "str"}, "identity": { "type": "str", "principalId": "str", @@ -244,6 +251,7 @@ def test_begin_update(self, resource_group): "rules": [ { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {}, "name": "str", "type": "str", @@ -251,6 +259,7 @@ def test_begin_update(self, resource_group): ], }, }, + "identitySettings": [{"identity": "str", "lifecycle": "str"}], "manualTriggerConfig": {"parallelism": 0, "replicaCompletionCount": 0}, "registries": [ {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} @@ -273,6 +282,7 @@ def test_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -293,7 +303,7 @@ def test_begin_update(self, resource_group): "type": "str", } ], - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -303,8 +313,9 @@ def test_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -321,7 +332,7 @@ def test_begin_update(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -333,7 +344,7 @@ def test_begin_start(self, resource_group): response = self.client.jobs.begin_start( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -346,7 +357,7 @@ def test_begin_stop_execution(self, resource_group): resource_group_name=resource_group.name, job_name="str", job_execution_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -358,7 +369,7 @@ def test_begin_stop_multiple_executions(self, resource_group): response = self.client.jobs.begin_stop_multiple_executions( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -370,8 +381,32 @@ def test_list_secrets(self, resource_group): response = self.client.jobs.list_secrets( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_resume(self, resource_group): + response = self.client.jobs.begin_resume( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_suspend(self, resource_group): + response = self.client.jobs.begin_suspend( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations_async.py index 07737e683da4..c320bafd02d3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations_async.py @@ -25,7 +25,7 @@ async def test_list_detectors(self, resource_group): response = self.client.jobs.list_detectors( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get_detector(self, resource_group): resource_group_name=resource_group.name, job_name="str", detector_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -51,7 +51,7 @@ async def test_proxy_get(self, resource_group): resource_group_name=resource_group.name, job_name="str", api_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -61,7 +61,7 @@ async def test_proxy_get(self, resource_group): @recorded_by_proxy_async async def test_list_by_subscription(self, resource_group): response = self.client.jobs.list_by_subscription( - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -72,7 +72,7 @@ async def test_list_by_subscription(self, resource_group): async def test_list_by_resource_group(self, resource_group): response = self.client.jobs.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -84,7 +84,7 @@ async def test_get(self, resource_group): response = await self.client.jobs.get( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -112,6 +112,7 @@ async def test_begin_create_or_update(self, resource_group): "rules": [ { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {}, "name": "str", "type": "str", @@ -119,6 +120,7 @@ async def test_begin_create_or_update(self, resource_group): ], }, }, + "identitySettings": [{"identity": "str", "lifecycle": "str"}], "manualTriggerConfig": {"parallelism": 0, "replicaCompletionCount": 0}, "registries": [ {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} @@ -133,6 +135,7 @@ async def test_begin_create_or_update(self, resource_group): }, "environmentId": "str", "eventStreamEndpoint": "str", + "extendedLocation": {"name": "str", "type": "str"}, "id": "str", "identity": { "type": "str", @@ -143,6 +146,7 @@ async def test_begin_create_or_update(self, resource_group): "name": "str", "outboundIpAddresses": ["str"], "provisioningState": "str", + "runningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -159,6 +163,7 @@ async def test_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -179,7 +184,7 @@ async def test_begin_create_or_update(self, resource_group): "type": "str", } ], - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -189,8 +194,9 @@ async def test_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -207,7 +213,7 @@ async def test_begin_create_or_update(self, resource_group): "type": "str", "workloadProfileName": "str", }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -221,7 +227,7 @@ async def test_begin_delete(self, resource_group): await self.client.jobs.begin_delete( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -236,6 +242,7 @@ async def test_begin_update(self, resource_group): resource_group_name=resource_group.name, job_name="str", job_envelope={ + "extendedLocation": {"name": "str", "type": "str"}, "identity": { "type": "str", "principalId": "str", @@ -256,6 +263,7 @@ async def test_begin_update(self, resource_group): "rules": [ { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {}, "name": "str", "type": "str", @@ -263,6 +271,7 @@ async def test_begin_update(self, resource_group): ], }, }, + "identitySettings": [{"identity": "str", "lifecycle": "str"}], "manualTriggerConfig": {"parallelism": 0, "replicaCompletionCount": 0}, "registries": [ {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} @@ -285,6 +294,7 @@ async def test_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -305,7 +315,7 @@ async def test_begin_update(self, resource_group): "type": "str", } ], - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -315,8 +325,9 @@ async def test_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -333,7 +344,7 @@ async def test_begin_update(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -347,7 +358,7 @@ async def test_begin_start(self, resource_group): await self.client.jobs.begin_start( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -362,7 +373,7 @@ async def test_begin_stop_execution(self, resource_group): resource_group_name=resource_group.name, job_name="str", job_execution_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -376,7 +387,7 @@ async def test_begin_stop_multiple_executions(self, resource_group): await self.client.jobs.begin_stop_multiple_executions( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -389,8 +400,36 @@ async def test_list_secrets(self, resource_group): response = await self.client.jobs.list_secrets( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_resume(self, resource_group): + response = await ( + await self.client.jobs.begin_resume( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_suspend(self, resource_group): + response = await ( + await self.client.jobs.begin_suspend( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations.py new file mode 100644 index 000000000000..af3051e287f3 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations.py @@ -0,0 +1,140 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPILogicAppsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.logic_apps.get( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.logic_apps.create_or_update( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + resource={ + "id": "str", + "name": "str", + "properties": {}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.logic_apps.delete( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_workflows(self, resource_group): + response = self.client.logic_apps.list_workflows( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-10-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_workflow(self, resource_group): + response = self.client.logic_apps.get_workflow( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + workflow_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_deploy_workflow_artifacts(self, resource_group): + response = self.client.logic_apps.deploy_workflow_artifacts( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_workflows_connections(self, resource_group): + response = self.client.logic_apps.list_workflows_connections( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_invoke(self, resource_group): + response = self.client.logic_apps.invoke( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + x_ms_logic_apps_proxy_path="str", + x_ms_logic_apps_proxy_method="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations_async.py new file mode 100644 index 000000000000..f4bb3513ca1b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations_async.py @@ -0,0 +1,141 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPILogicAppsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.logic_apps.get( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.logic_apps.create_or_update( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + resource={ + "id": "str", + "name": "str", + "properties": {}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.logic_apps.delete( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_workflows(self, resource_group): + response = self.client.logic_apps.list_workflows( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-10-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_workflow(self, resource_group): + response = await self.client.logic_apps.get_workflow( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + workflow_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_deploy_workflow_artifacts(self, resource_group): + response = await self.client.logic_apps.deploy_workflow_artifacts( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_workflows_connections(self, resource_group): + response = await self.client.logic_apps.list_workflows_connections( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_invoke(self, resource_group): + response = await self.client.logic_apps.invoke( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + x_ms_logic_apps_proxy_path="str", + x_ms_logic_apps_proxy_method="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_maintenance_configurations_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_maintenance_configurations_operations.py new file mode 100644 index 000000000000..93675b87f451 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_maintenance_configurations_operations.py @@ -0,0 +1,84 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIMaintenanceConfigurationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.maintenance_configurations.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-10-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.maintenance_configurations.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + config_name="str", + maintenance_configuration_envelope={ + "id": "str", + "name": "str", + "scheduledEntries": [{"startHourUtc": 0, "weekDay": "str", "durationHours": 0}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.maintenance_configurations.delete( + resource_group_name=resource_group.name, + environment_name="str", + config_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.maintenance_configurations.get( + resource_group_name=resource_group.name, + environment_name="str", + config_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_maintenance_configurations_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_maintenance_configurations_operations_async.py new file mode 100644 index 000000000000..cb23871046ed --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_maintenance_configurations_operations_async.py @@ -0,0 +1,85 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIMaintenanceConfigurationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.maintenance_configurations.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-10-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.maintenance_configurations.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + config_name="str", + maintenance_configuration_envelope={ + "id": "str", + "name": "str", + "scheduledEntries": [{"startHourUtc": 0, "weekDay": "str", "durationHours": 0}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.maintenance_configurations.delete( + resource_group_name=resource_group.name, + environment_name="str", + config_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.maintenance_configurations.get( + resource_group_name=resource_group.name, + environment_name="str", + config_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations.py index c7067137fd90..d4f6732b0d5a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations.py @@ -25,7 +25,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", managed_certificate_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ def test_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, environment_name="str", managed_certificate_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -51,7 +51,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", managed_certificate_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -65,7 +65,7 @@ def test_update(self, resource_group): environment_name="str", managed_certificate_name="str", managed_certificate_envelope={"tags": {"str": "str"}}, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -77,7 +77,7 @@ def test_list(self, resource_group): response = self.client.managed_certificates.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations_async.py index 5f1ba6b1f5d8..8bef5ce07c5d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations_async.py @@ -26,7 +26,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", managed_certificate_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -40,7 +40,7 @@ async def test_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, environment_name="str", managed_certificate_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -54,7 +54,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", managed_certificate_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -68,7 +68,7 @@ async def test_update(self, resource_group): environment_name="str", managed_certificate_name="str", managed_certificate_envelope={"tags": {"str": "str"}}, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -80,7 +80,7 @@ async def test_list(self, resource_group): response = self.client.managed_certificates.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations.py index 642873ae7bfe..f97b7ecdc58c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations.py @@ -24,7 +24,7 @@ def test_list_detectors(self, resource_group): response = self.client.managed_environment_diagnostics.list_detectors( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get_detector(self, resource_group): resource_group_name=resource_group.name, environment_name="str", detector_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations_async.py index d8bee226eb4f..3a5b96353f45 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations_async.py @@ -25,7 +25,7 @@ async def test_list_detectors(self, resource_group): response = await self.client.managed_environment_diagnostics.list_detectors( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get_detector(self, resource_group): resource_group_name=resource_group.name, environment_name="str", detector_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..785d97460551 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations.py @@ -0,0 +1,87 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.managed_environment_private_endpoint_connections.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-10-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.managed_environment_private_endpoint_connections.get( + resource_group_name=resource_group.name, + environment_name="str", + private_endpoint_connection_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.managed_environment_private_endpoint_connections.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + private_endpoint_connection_name="str", + private_endpoint_connection_envelope={ + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.managed_environment_private_endpoint_connections.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + private_endpoint_connection_name="str", + api_version="2024-10-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations_async.py new file mode 100644 index 000000000000..a34999252945 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations_async.py @@ -0,0 +1,96 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentPrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.managed_environment_private_endpoint_connections.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-10-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.managed_environment_private_endpoint_connections.get( + resource_group_name=resource_group.name, + environment_name="str", + private_endpoint_connection_name="str", + api_version="2024-10-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.managed_environment_private_endpoint_connections.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + private_endpoint_connection_name="str", + private_endpoint_connection_envelope={ + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.managed_environment_private_endpoint_connections.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + private_endpoint_connection_name="str", + api_version="2024-10-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations.py new file mode 100644 index 000000000000..ecffde523b64 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentPrivateLinkResourcesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.managed_environment_private_link_resources.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-10-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations_async.py new file mode 100644 index 000000000000..8f44fa35f660 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentPrivateLinkResourcesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.managed_environment_private_link_resources.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-10-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations.py index 89a46c6bdae7..06831a5535c9 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.managed_environment_usages.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations_async.py index 66b6e816f9c9..6d21f7d68e79 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = self.client.managed_environment_usages.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations.py index f8935803c0df..24bcd49a0a27 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations.py @@ -24,7 +24,7 @@ def test_get_root(self, resource_group): response = self.client.managed_environments_diagnostics.get_root( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations_async.py index 45c096f994d8..512a8cf555ba 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations_async.py @@ -25,7 +25,7 @@ async def test_get_root(self, resource_group): response = await self.client.managed_environments_diagnostics.get_root( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations.py index c3693ddfef44..6aef9b9c96e0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_list_by_subscription(self, resource_group): response = self.client.managed_environments.list_by_subscription( - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -33,7 +33,7 @@ def test_list_by_subscription(self, resource_group): def test_list_by_resource_group(self, resource_group): response = self.client.managed_environments.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): response = self.client.managed_environments.get( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -59,11 +59,14 @@ def test_begin_create_or_update(self, resource_group): environment_name="str", environment_envelope={ "location": "str", + "appInsightsConfiguration": {"connectionString": "str"}, "appLogsConfiguration": { "destination": "str", - "logAnalyticsConfiguration": {"customerId": "str", "sharedKey": "str"}, + "logAnalyticsConfiguration": {"customerId": "str", "dynamicJsonColumns": bool, "sharedKey": "str"}, }, + "availabilityZones": ["str"], "customDomainConfiguration": { + "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, "certificatePassword": "str", "certificateValue": bytes("bytes", encoding="utf-8"), "customDomainVerificationId": "str", @@ -79,13 +82,59 @@ def test_begin_create_or_update(self, resource_group): "deploymentErrors": "str", "eventStreamEndpoint": "str", "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "infrastructureResourceGroup": "str", "kedaConfiguration": {"version": "str"}, "kind": "str", "name": "str", + "openTelemetryConfiguration": { + "destinationsConfiguration": { + "dataDogConfiguration": {"key": "str", "site": "str"}, + "otlpConfigurations": [ + { + "endpoint": "str", + "headers": [{"key": "str", "value": "str"}], + "insecure": bool, + "name": "str", + } + ], + }, + "logsConfiguration": {"destinations": ["str"]}, + "metricsConfiguration": {"destinations": ["str"], "includeKeda": bool}, + "tracesConfiguration": {"destinations": ["str"], "includeDapr": bool}, + }, "peerAuthentication": {"mtls": {"enabled": bool}}, "peerTrafficConfiguration": {"encryption": {"enabled": bool}}, + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], "provisioningState": "str", + "publicNetworkAccess": "str", "staticIp": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -105,11 +154,17 @@ def test_begin_create_or_update(self, resource_group): "platformReservedDnsIP": "str", }, "workloadProfiles": [ - {"name": "str", "workloadProfileType": "str", "maximumCount": 0, "minimumCount": 0} + { + "name": "str", + "workloadProfileType": "str", + "enableFips": False, + "maximumCount": 0, + "minimumCount": 0, + } ], "zoneRedundant": bool, }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -121,7 +176,7 @@ def test_begin_delete(self, resource_group): response = self.client.managed_environments.begin_delete( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -135,11 +190,14 @@ def test_begin_update(self, resource_group): environment_name="str", environment_envelope={ "location": "str", + "appInsightsConfiguration": {"connectionString": "str"}, "appLogsConfiguration": { "destination": "str", - "logAnalyticsConfiguration": {"customerId": "str", "sharedKey": "str"}, + "logAnalyticsConfiguration": {"customerId": "str", "dynamicJsonColumns": bool, "sharedKey": "str"}, }, + "availabilityZones": ["str"], "customDomainConfiguration": { + "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, "certificatePassword": "str", "certificateValue": bytes("bytes", encoding="utf-8"), "customDomainVerificationId": "str", @@ -155,13 +213,59 @@ def test_begin_update(self, resource_group): "deploymentErrors": "str", "eventStreamEndpoint": "str", "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "infrastructureResourceGroup": "str", "kedaConfiguration": {"version": "str"}, "kind": "str", "name": "str", + "openTelemetryConfiguration": { + "destinationsConfiguration": { + "dataDogConfiguration": {"key": "str", "site": "str"}, + "otlpConfigurations": [ + { + "endpoint": "str", + "headers": [{"key": "str", "value": "str"}], + "insecure": bool, + "name": "str", + } + ], + }, + "logsConfiguration": {"destinations": ["str"]}, + "metricsConfiguration": {"destinations": ["str"], "includeKeda": bool}, + "tracesConfiguration": {"destinations": ["str"], "includeDapr": bool}, + }, "peerAuthentication": {"mtls": {"enabled": bool}}, "peerTrafficConfiguration": {"encryption": {"enabled": bool}}, + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], "provisioningState": "str", + "publicNetworkAccess": "str", "staticIp": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -181,11 +285,17 @@ def test_begin_update(self, resource_group): "platformReservedDnsIP": "str", }, "workloadProfiles": [ - {"name": "str", "workloadProfileType": "str", "maximumCount": 0, "minimumCount": 0} + { + "name": "str", + "workloadProfileType": "str", + "enableFips": False, + "maximumCount": 0, + "minimumCount": 0, + } ], "zoneRedundant": bool, }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -197,7 +307,7 @@ def test_get_auth_token(self, resource_group): response = self.client.managed_environments.get_auth_token( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -209,7 +319,7 @@ def test_list_workload_profile_states(self, resource_group): response = self.client.managed_environments.list_workload_profile_states( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations_async.py index a82a4daec142..ba77ceba044b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_list_by_subscription(self, resource_group): response = self.client.managed_environments.list_by_subscription( - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -34,7 +34,7 @@ async def test_list_by_subscription(self, resource_group): async def test_list_by_resource_group(self, resource_group): response = self.client.managed_environments.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): response = await self.client.managed_environments.get( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -61,11 +61,18 @@ async def test_begin_create_or_update(self, resource_group): environment_name="str", environment_envelope={ "location": "str", + "appInsightsConfiguration": {"connectionString": "str"}, "appLogsConfiguration": { "destination": "str", - "logAnalyticsConfiguration": {"customerId": "str", "sharedKey": "str"}, + "logAnalyticsConfiguration": { + "customerId": "str", + "dynamicJsonColumns": bool, + "sharedKey": "str", + }, }, + "availabilityZones": ["str"], "customDomainConfiguration": { + "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, "certificatePassword": "str", "certificateValue": bytes("bytes", encoding="utf-8"), "customDomainVerificationId": "str", @@ -81,13 +88,59 @@ async def test_begin_create_or_update(self, resource_group): "deploymentErrors": "str", "eventStreamEndpoint": "str", "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "infrastructureResourceGroup": "str", "kedaConfiguration": {"version": "str"}, "kind": "str", "name": "str", + "openTelemetryConfiguration": { + "destinationsConfiguration": { + "dataDogConfiguration": {"key": "str", "site": "str"}, + "otlpConfigurations": [ + { + "endpoint": "str", + "headers": [{"key": "str", "value": "str"}], + "insecure": bool, + "name": "str", + } + ], + }, + "logsConfiguration": {"destinations": ["str"]}, + "metricsConfiguration": {"destinations": ["str"], "includeKeda": bool}, + "tracesConfiguration": {"destinations": ["str"], "includeDapr": bool}, + }, "peerAuthentication": {"mtls": {"enabled": bool}}, "peerTrafficConfiguration": {"encryption": {"enabled": bool}}, + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], "provisioningState": "str", + "publicNetworkAccess": "str", "staticIp": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -107,11 +160,17 @@ async def test_begin_create_or_update(self, resource_group): "platformReservedDnsIP": "str", }, "workloadProfiles": [ - {"name": "str", "workloadProfileType": "str", "maximumCount": 0, "minimumCount": 0} + { + "name": "str", + "workloadProfileType": "str", + "enableFips": False, + "maximumCount": 0, + "minimumCount": 0, + } ], "zoneRedundant": bool, }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -125,7 +184,7 @@ async def test_begin_delete(self, resource_group): await self.client.managed_environments.begin_delete( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -141,11 +200,18 @@ async def test_begin_update(self, resource_group): environment_name="str", environment_envelope={ "location": "str", + "appInsightsConfiguration": {"connectionString": "str"}, "appLogsConfiguration": { "destination": "str", - "logAnalyticsConfiguration": {"customerId": "str", "sharedKey": "str"}, + "logAnalyticsConfiguration": { + "customerId": "str", + "dynamicJsonColumns": bool, + "sharedKey": "str", + }, }, + "availabilityZones": ["str"], "customDomainConfiguration": { + "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, "certificatePassword": "str", "certificateValue": bytes("bytes", encoding="utf-8"), "customDomainVerificationId": "str", @@ -161,13 +227,59 @@ async def test_begin_update(self, resource_group): "deploymentErrors": "str", "eventStreamEndpoint": "str", "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "infrastructureResourceGroup": "str", "kedaConfiguration": {"version": "str"}, "kind": "str", "name": "str", + "openTelemetryConfiguration": { + "destinationsConfiguration": { + "dataDogConfiguration": {"key": "str", "site": "str"}, + "otlpConfigurations": [ + { + "endpoint": "str", + "headers": [{"key": "str", "value": "str"}], + "insecure": bool, + "name": "str", + } + ], + }, + "logsConfiguration": {"destinations": ["str"]}, + "metricsConfiguration": {"destinations": ["str"], "includeKeda": bool}, + "tracesConfiguration": {"destinations": ["str"], "includeDapr": bool}, + }, "peerAuthentication": {"mtls": {"enabled": bool}}, "peerTrafficConfiguration": {"encryption": {"enabled": bool}}, + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], "provisioningState": "str", + "publicNetworkAccess": "str", "staticIp": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -187,11 +299,17 @@ async def test_begin_update(self, resource_group): "platformReservedDnsIP": "str", }, "workloadProfiles": [ - {"name": "str", "workloadProfileType": "str", "maximumCount": 0, "minimumCount": 0} + { + "name": "str", + "workloadProfileType": "str", + "enableFips": False, + "maximumCount": 0, + "minimumCount": 0, + } ], "zoneRedundant": bool, }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -204,7 +322,7 @@ async def test_get_auth_token(self, resource_group): response = await self.client.managed_environments.get_auth_token( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -216,7 +334,7 @@ async def test_list_workload_profile_states(self, resource_group): response = self.client.managed_environments.list_workload_profile_states( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations.py index b644b17854cf..b91874603b85 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.managed_environments_storages.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", storage_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -54,7 +54,8 @@ def test_create_or_update(self, resource_group): "id": "str", "name": "str", "properties": { - "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"} + "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"}, + "nfsAzureFile": {"accessMode": "str", "server": "str", "shareName": "str"}, }, "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -66,7 +67,7 @@ def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -79,7 +80,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", storage_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations_async.py index f44a5e0b4304..04e2b608a3ae 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = await self.client.managed_environments_storages.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", storage_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -55,7 +55,8 @@ async def test_create_or_update(self, resource_group): "id": "str", "name": "str", "properties": { - "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"} + "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"}, + "nfsAzureFile": {"accessMode": "str", "server": "str", "shareName": "str"}, }, "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -67,7 +68,7 @@ async def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself @@ -80,7 +81,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", storage_name="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations.py index e2b8fb59bc41..974f31dc4cfd 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations.py @@ -25,7 +25,7 @@ def test_check_name_availability(self, resource_group): resource_group_name=resource_group.name, environment_name="str", check_name_availability_request={"name": "str", "type": "str"}, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations_async.py index daeee7c5da1c..8ab7aa5fe3cc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations_async.py @@ -26,7 +26,7 @@ async def test_check_name_availability(self, resource_group): resource_group_name=resource_group.name, environment_name="str", check_name_availability_request={"name": "str", "type": "str"}, - api_version="2024-03-01", + api_version="2024-10-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations.py index e80fa5ba763c..5e8763696321 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_list(self, resource_group): response = self.client.operations.list( - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations_async.py index 7dfd8600db2b..27e796e1532a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_list(self, resource_group): response = self.client.operations.list( - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations.py index 4572a67a7083..532e11146954 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations.py @@ -23,7 +23,7 @@ def setup_method(self, method): def test_list(self, resource_group): response = self.client.usages.list( location="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations_async.py index 4e439a0bc453..05bfc53527de 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations_async.py @@ -24,7 +24,7 @@ def setup_method(self, method): async def test_list(self, resource_group): response = self.client.usages.list( location="str", - api_version="2024-03-01", + api_version="2024-10-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself