From c3dea50086dd976a22223719e623c765eab35cbf Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 25 Jul 2023 23:35:15 +0000 Subject: [PATCH] CodeGen from PR 24874 in Azure/azure-rest-api-specs Merge 05215be06f5da75d9827edb90c0c5f512fae4b56 into b2a86110a7fb57fb44e2aacea231bf43b328b623 --- .../azure-mgmt-appcontainers/_meta.json | 10 +- .../mgmt/appcontainers/_configuration.py | 4 +- .../_container_apps_api_client.py | 27 +- .../azure/mgmt/appcontainers/_vendor.py | 20 +- .../azure/mgmt/appcontainers/_version.py | 2 +- .../mgmt/appcontainers/aio/_configuration.py | 4 +- .../aio/_container_apps_api_client.py | 27 +- .../azure/mgmt/appcontainers/aio/_vendor.py | 28 + .../appcontainers/aio/operations/__init__.py | 14 +- ..._available_workload_profiles_operations.py | 1 + .../operations/_billing_meters_operations.py | 1 + .../aio/operations/_builders_operations.py | 882 +++++++++++++ .../aio/operations/_builds_operations.py | 593 +++++++++ .../operations/_certificates_operations.py | 6 +- ...ed_environments_certificates_operations.py | 6 +- ...environments_dapr_components_operations.py | 4 +- .../_connected_environments_operations.py | 6 +- ...nected_environments_storages_operations.py | 4 +- .../_container_apps_api_client_operations.py | 163 +++ ..._container_apps_auth_configs_operations.py | 4 +- .../_container_apps_diagnostics_operations.py | 1 + .../operations/_container_apps_operations.py | 270 +++- ...ainer_apps_revision_replicas_operations.py | 1 + .../_container_apps_revisions_operations.py | 1 + ...ntainer_apps_source_controls_operations.py | 4 +- .../operations/_dapr_components_operations.py | 4 +- .../operations/_jobs_executions_operations.py | 3 +- .../aio/operations/_jobs_operations.py | 151 +-- .../_managed_certificates_operations.py | 6 +- ...aged_environment_diagnostics_operations.py | 1 + ...ged_environments_diagnostics_operations.py | 1 + .../_managed_environments_operations.py | 6 +- ...anaged_environments_storages_operations.py | 4 +- .../aio/operations/_namespaces_operations.py | 4 +- .../aio/operations/_operations.py | 1 + .../mgmt/appcontainers/models/__init__.py | 54 + .../_container_apps_api_client_enums.py | 50 +- .../mgmt/appcontainers/models/_models_py3.py | 1126 ++++++++++++++++- .../mgmt/appcontainers/operations/__init__.py | 14 +- ..._available_workload_profiles_operations.py | 4 +- .../operations/_billing_meters_operations.py | 4 +- .../operations/_builders_operations.py | 1069 ++++++++++++++++ .../operations/_builds_operations.py | 738 +++++++++++ .../operations/_certificates_operations.py | 17 +- ...ed_environments_certificates_operations.py | 17 +- ...environments_dapr_components_operations.py | 15 +- .../_connected_environments_operations.py | 21 +- ...nected_environments_storages_operations.py | 13 +- .../_container_apps_api_client_operations.py | 224 ++++ ..._container_apps_auth_configs_operations.py | 13 +- .../_container_apps_diagnostics_operations.py | 12 +- .../operations/_container_apps_operations.py | 359 +++++- ...ainer_apps_revision_replicas_operations.py | 6 +- .../_container_apps_revisions_operations.py | 12 +- ...ntainer_apps_source_controls_operations.py | 13 +- .../operations/_dapr_components_operations.py | 15 +- .../operations/_jobs_executions_operations.py | 6 +- .../operations/_jobs_operations.py | 181 +-- .../_managed_certificates_operations.py | 17 +- ...aged_environment_diagnostics_operations.py | 6 +- ...ged_environments_diagnostics_operations.py | 4 +- .../_managed_environments_operations.py | 25 +- ...anaged_environments_storages_operations.py | 13 +- .../operations/_namespaces_operations.py | 7 +- .../appcontainers/operations/_operations.py | 4 +- .../auth_configs_create_or_update.py | 6 +- .../generated_samples/auth_configs_delete.py | 5 +- .../generated_samples/auth_configs_get.py | 2 +- .../auth_configs_list_by_container.py | 2 +- .../available_workload_profiles_get.py | 2 +- .../generated_samples/billing_meters_get.py | 2 +- .../builders_create_or_update.py | 64 + .../generated_samples/builders_delete.py | 40 + .../generated_samples/builders_get.py | 41 + .../builders_list_by_resource_group.py | 41 + .../builders_list_by_subscription.py | 39 + .../generated_samples/builders_update.py | 42 + .../builds_create_or_update.py | 69 + .../generated_samples/builds_delete.py | 41 + .../generated_samples/builds_get.py | 42 + .../builds_list_by_builder_resource.py | 42 + .../certificate_create_or_update.py | 2 +- .../generated_samples/certificate_delete.py | 5 +- .../generated_samples/certificate_get.py | 2 +- .../certificates_check_name_availability.py | 2 +- ...ertificates_list_by_managed_environment.py | 2 +- .../generated_samples/certificates_patch.py | 2 +- ...vironments_certificate_create_or_update.py | 2 +- ...nnected_environments_certificate_delete.py | 5 +- .../connected_environments_certificate_get.py | 2 +- ...ts_certificates_check_name_availability.py | 2 +- ...tificates_list_by_connected_environment.py | 2 +- ...nnected_environments_certificates_patch.py | 2 +- ...connected_environments_create_or_update.py | 2 +- ...nments_dapr_components_create_or_update.py | 2 +- ...ted_environments_dapr_components_delete.py | 5 +- ...nected_environments_dapr_components_get.py | 2 +- ...ected_environments_dapr_components_list.py | 2 +- ...vironments_dapr_components_list_secrets.py | 2 +- .../connected_environments_delete.py | 5 +- .../connected_environments_get.py | 2 +- ...ted_environments_list_by_resource_group.py | 2 +- ...ected_environments_list_by_subscription.py | 2 +- .../connected_environments_patch.py | 2 +- ..._environments_storages_create_or_update.py | 2 +- .../connected_environments_storages_delete.py | 5 +- .../connected_environments_storages_get.py | 2 +- .../connected_environments_storages_list.py | 2 +- .../container_apps_check_name_availability.py | 2 +- .../container_apps_create_or_update.py | 13 +- .../container_apps_delete.py | 5 +- .../container_apps_diagnostics_get.py | 2 +- .../container_apps_diagnostics_list.py | 2 +- .../generated_samples/container_apps_get.py | 2 +- .../container_apps_get_auth_token.py | 2 +- .../container_apps_list_by_resource_group.py | 2 +- .../container_apps_list_by_subscription.py | 2 +- ...ner_apps_list_custom_host_name_analysis.py | 2 +- .../container_apps_list_secrets.py | 2 +- ...tainer_apps_managed_by_create_or_update.py | 2 +- .../generated_samples/container_apps_patch.py | 9 +- .../generated_samples/container_apps_start.py | 41 + .../generated_samples/container_apps_stop.py | 41 + ...container_apps_tcp_app_create_or_update.py | 2 +- ...create_or_update_secret_store_component.py | 2 +- ...apr_components_create_or_update_secrets.py | 2 +- .../dapr_components_delete.py | 5 +- ...r_components_get_secret_store_component.py | 2 +- .../dapr_components_get_secrets.py | 2 +- .../generated_samples/dapr_components_list.py | 2 +- .../dapr_components_list_secrets.py | 2 +- .../generated_samples/job_createor_update.py | 82 ++ .../job_createor_update_event_trigger.py | 80 ++ .../generated_samples/job_delete.py | 5 +- .../generated_samples/job_execution_get.py | 42 + .../generated_samples/job_executions_get.py | 2 +- .../generated_samples/job_get.py | 2 +- .../generated_samples/job_list_secrets.py | 2 +- .../generated_samples/job_patch.py | 80 ++ .../generated_samples/job_start.py | 2 +- .../generated_samples/job_stop_execution.py | 5 +- .../generated_samples/job_stop_multiple.py | 9 +- .../jobs_list_by_resource_group.py | 2 +- .../jobs_list_by_subscription.py | 2 +- .../managed_certificate_create_or_update.py | 2 +- .../managed_certificate_delete.py | 5 +- .../managed_certificate_get.py | 2 +- ...ertificates_list_by_managed_environment.py | 2 +- .../managed_certificates_patch.py | 2 +- .../managed_environment_diagnostics_get.py | 2 +- .../managed_environment_diagnostics_list.py | 2 +- .../managed_environments_create_or_update.py | 3 +- ...om_infrastructure_resource_group_create.py | 2 +- .../managed_environments_delete.py | 5 +- .../managed_environments_get.py | 2 +- .../managed_environments_get_auth_token.py | 2 +- ...ged_environments_list_by_resource_group.py | 2 +- ...naged_environments_list_by_subscription.py | 2 +- ...vironments_list_workload_profile_states.py | 2 +- .../managed_environments_patch.py | 2 +- ..._environments_storages_create_or_update.py | 2 +- .../managed_environments_storages_delete.py | 5 +- .../managed_environments_storages_get.py | 2 +- .../managed_environments_storages_list.py | 2 +- .../generated_samples/operations_list.py | 2 +- .../generated_samples/replicas_get.py | 2 +- .../generated_samples/replicas_list.py | 2 +- .../generated_samples/revisions_activate.py | 5 +- .../generated_samples/revisions_deactivate.py | 5 +- .../generated_samples/revisions_get.py | 2 +- .../generated_samples/revisions_list.py | 2 +- .../generated_samples/revisions_restart.py | 5 +- .../source_controls_create_or_update.py | 8 +- .../source_controls_delete.py | 5 +- .../generated_samples/source_controls_get.py | 2 +- .../source_controls_list_by_container.py | 2 +- ...tions_get_custom_domain_verification_id.py | 38 + 177 files changed, 6839 insertions(+), 626 deletions(-) create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_vendor.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_api_client_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_delete.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_get.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_delete.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_get.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json b/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json index 4059fd27c549..82b3022a974e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json +++ b/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json @@ -1,11 +1,11 @@ { - "commit": "3c639105c011765893db51cbb0dda056e34dc994", + "commit": "1192f37d712e94d76cea65fdd581170635682d02", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.6", "use": [ - "@autorest/python@6.4.8", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.6.0", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/app/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.8 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/app/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.6.0 --use=@autorest/modelerfour@4.26.2 --version=3.9.6 --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 75609b27bee5..e0c3e1b38e89 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py @@ -29,14 +29,14 @@ class ContainerAppsAPIClientConfiguration(Configuration): # pylint: disable=too :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-05-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: super(ContainerAppsAPIClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2022-11-01-preview") + api_version: str = kwargs.pop("api_version", "2023-05-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 d80a4905ab57..c47ff3834abb 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 @@ -18,11 +18,14 @@ from .operations import ( AvailableWorkloadProfilesOperations, BillingMetersOperations, + BuildersOperations, + BuildsOperations, CertificatesOperations, ConnectedEnvironmentsCertificatesOperations, ConnectedEnvironmentsDaprComponentsOperations, ConnectedEnvironmentsOperations, ConnectedEnvironmentsStoragesOperations, + ContainerAppsAPIClientOperationsMixin, ContainerAppsAuthConfigsOperations, ContainerAppsDiagnosticsOperations, ContainerAppsOperations, @@ -46,7 +49,9 @@ from azure.core.credentials import TokenCredential -class ContainerAppsAPIClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class ContainerAppsAPIClient( + ContainerAppsAPIClientOperationsMixin +): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """ContainerAppsAPIClient. :ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations @@ -57,6 +62,10 @@ class ContainerAppsAPIClient: # pylint: disable=client-accepts-api-version-keyw azure.mgmt.appcontainers.operations.AvailableWorkloadProfilesOperations :ivar billing_meters: BillingMetersOperations operations :vartype billing_meters: azure.mgmt.appcontainers.operations.BillingMetersOperations + :ivar builders: BuildersOperations operations + :vartype builders: azure.mgmt.appcontainers.operations.BuildersOperations + :ivar builds: BuildsOperations operations + :vartype builds: azure.mgmt.appcontainers.operations.BuildsOperations :ivar connected_environments: ConnectedEnvironmentsOperations operations :vartype connected_environments: azure.mgmt.appcontainers.operations.ConnectedEnvironmentsOperations @@ -73,10 +82,6 @@ class ContainerAppsAPIClient: # pylint: disable=client-accepts-api-version-keyw azure.mgmt.appcontainers.operations.ConnectedEnvironmentsStoragesOperations :ivar container_apps: ContainerAppsOperations operations :vartype container_apps: azure.mgmt.appcontainers.operations.ContainerAppsOperations - :ivar jobs: JobsOperations operations - :vartype jobs: azure.mgmt.appcontainers.operations.JobsOperations - :ivar jobs_executions: JobsExecutionsOperations operations - :vartype jobs_executions: azure.mgmt.appcontainers.operations.JobsExecutionsOperations :ivar container_apps_revisions: ContainerAppsRevisionsOperations operations :vartype container_apps_revisions: azure.mgmt.appcontainers.operations.ContainerAppsRevisionsOperations @@ -94,6 +99,10 @@ class ContainerAppsAPIClient: # pylint: disable=client-accepts-api-version-keyw azure.mgmt.appcontainers.operations.ManagedEnvironmentsDiagnosticsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appcontainers.operations.Operations + :ivar jobs: JobsOperations operations + :vartype jobs: azure.mgmt.appcontainers.operations.JobsOperations + :ivar jobs_executions: JobsExecutionsOperations operations + :vartype jobs_executions: azure.mgmt.appcontainers.operations.JobsExecutionsOperations :ivar managed_environments: ManagedEnvironmentsOperations operations :vartype managed_environments: azure.mgmt.appcontainers.operations.ManagedEnvironmentsOperations @@ -118,7 +127,7 @@ class ContainerAppsAPIClient: # pylint: disable=client-accepts-api-version-keyw :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 "2022-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-05-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 @@ -148,6 +157,8 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.billing_meters = BillingMetersOperations(self._client, self._config, self._serialize, self._deserialize) + self.builders = BuildersOperations(self._client, self._config, self._serialize, self._deserialize) + self.builds = BuildsOperations(self._client, self._config, self._serialize, self._deserialize) self.connected_environments = ConnectedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -161,8 +172,6 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.container_apps = ContainerAppsOperations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.jobs_executions = JobsExecutionsOperations(self._client, self._config, self._serialize, self._deserialize) self.container_apps_revisions = ContainerAppsRevisionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -179,6 +188,8 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs_executions = JobsExecutionsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_environments = ManagedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_vendor.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_vendor.py index bd0df84f5319..7c521a8b16d2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_vendor.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_vendor.py @@ -5,10 +5,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast +from abc import ABC +from typing import List, TYPE_CHECKING, cast from azure.core.pipeline.transport import HttpRequest +from ._configuration import ContainerAppsAPIClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from ._serialization import Deserializer, Serializer + def _convert_request(request, files=None): data = request.content if not files else None @@ -28,3 +37,12 @@ def _format_url_section(template, **kwargs): formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) + + +class ContainerAppsAPIClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: ContainerAppsAPIClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" 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 5819b888fe6e..e5754a47ce68 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py index ae13a88ed4be..47b6e0fa4198 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 @@ -29,14 +29,14 @@ class ContainerAppsAPIClientConfiguration(Configuration): # pylint: disable=too :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-05-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: super(ContainerAppsAPIClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2022-11-01-preview") + api_version: str = kwargs.pop("api_version", "2023-05-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 1e1e15ce58eb..f0674f723a16 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 @@ -18,11 +18,14 @@ from .operations import ( AvailableWorkloadProfilesOperations, BillingMetersOperations, + BuildersOperations, + BuildsOperations, CertificatesOperations, ConnectedEnvironmentsCertificatesOperations, ConnectedEnvironmentsDaprComponentsOperations, ConnectedEnvironmentsOperations, ConnectedEnvironmentsStoragesOperations, + ContainerAppsAPIClientOperationsMixin, ContainerAppsAuthConfigsOperations, ContainerAppsDiagnosticsOperations, ContainerAppsOperations, @@ -46,7 +49,9 @@ from azure.core.credentials_async import AsyncTokenCredential -class ContainerAppsAPIClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class ContainerAppsAPIClient( + ContainerAppsAPIClientOperationsMixin +): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """ContainerAppsAPIClient. :ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations @@ -57,6 +62,10 @@ class ContainerAppsAPIClient: # pylint: disable=client-accepts-api-version-keyw azure.mgmt.appcontainers.aio.operations.AvailableWorkloadProfilesOperations :ivar billing_meters: BillingMetersOperations operations :vartype billing_meters: azure.mgmt.appcontainers.aio.operations.BillingMetersOperations + :ivar builders: BuildersOperations operations + :vartype builders: azure.mgmt.appcontainers.aio.operations.BuildersOperations + :ivar builds: BuildsOperations operations + :vartype builds: azure.mgmt.appcontainers.aio.operations.BuildsOperations :ivar connected_environments: ConnectedEnvironmentsOperations operations :vartype connected_environments: azure.mgmt.appcontainers.aio.operations.ConnectedEnvironmentsOperations @@ -73,10 +82,6 @@ class ContainerAppsAPIClient: # pylint: disable=client-accepts-api-version-keyw azure.mgmt.appcontainers.aio.operations.ConnectedEnvironmentsStoragesOperations :ivar container_apps: ContainerAppsOperations operations :vartype container_apps: azure.mgmt.appcontainers.aio.operations.ContainerAppsOperations - :ivar jobs: JobsOperations operations - :vartype jobs: azure.mgmt.appcontainers.aio.operations.JobsOperations - :ivar jobs_executions: JobsExecutionsOperations operations - :vartype jobs_executions: azure.mgmt.appcontainers.aio.operations.JobsExecutionsOperations :ivar container_apps_revisions: ContainerAppsRevisionsOperations operations :vartype container_apps_revisions: azure.mgmt.appcontainers.aio.operations.ContainerAppsRevisionsOperations @@ -94,6 +99,10 @@ class ContainerAppsAPIClient: # pylint: disable=client-accepts-api-version-keyw azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsDiagnosticsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appcontainers.aio.operations.Operations + :ivar jobs: JobsOperations operations + :vartype jobs: azure.mgmt.appcontainers.aio.operations.JobsOperations + :ivar jobs_executions: JobsExecutionsOperations operations + :vartype jobs_executions: azure.mgmt.appcontainers.aio.operations.JobsExecutionsOperations :ivar managed_environments: ManagedEnvironmentsOperations operations :vartype managed_environments: azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsOperations @@ -118,7 +127,7 @@ class ContainerAppsAPIClient: # pylint: disable=client-accepts-api-version-keyw :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 "2022-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-05-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 @@ -148,6 +157,8 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.billing_meters = BillingMetersOperations(self._client, self._config, self._serialize, self._deserialize) + self.builders = BuildersOperations(self._client, self._config, self._serialize, self._deserialize) + self.builds = BuildsOperations(self._client, self._config, self._serialize, self._deserialize) self.connected_environments = ConnectedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -161,8 +172,6 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.container_apps = ContainerAppsOperations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.jobs_executions = JobsExecutionsOperations(self._client, self._config, self._serialize, self._deserialize) self.container_apps_revisions = ContainerAppsRevisionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -179,6 +188,8 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs_executions = JobsExecutionsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_environments = ManagedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_vendor.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_vendor.py new file mode 100644 index 000000000000..e2d7a96f702c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import ContainerAppsAPIClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from .._serialization import Deserializer, Serializer + + +class ContainerAppsAPIClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: ContainerAppsAPIClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" 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 5fc2fc5c9aa4..6cf094ec8dc4 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 @@ -9,19 +9,22 @@ from ._container_apps_auth_configs_operations import ContainerAppsAuthConfigsOperations from ._available_workload_profiles_operations import AvailableWorkloadProfilesOperations from ._billing_meters_operations import BillingMetersOperations +from ._builders_operations import BuildersOperations +from ._builds_operations import BuildsOperations from ._connected_environments_operations import ConnectedEnvironmentsOperations from ._connected_environments_certificates_operations import ConnectedEnvironmentsCertificatesOperations from ._connected_environments_dapr_components_operations import ConnectedEnvironmentsDaprComponentsOperations from ._connected_environments_storages_operations import ConnectedEnvironmentsStoragesOperations from ._container_apps_operations import ContainerAppsOperations -from ._jobs_operations import JobsOperations -from ._jobs_executions_operations import JobsExecutionsOperations 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 ._operations import Operations +from ._jobs_operations import JobsOperations +from ._jobs_executions_operations import JobsExecutionsOperations +from ._container_apps_api_client_operations import ContainerAppsAPIClientOperationsMixin from ._managed_environments_operations import ManagedEnvironmentsOperations from ._certificates_operations import CertificatesOperations from ._managed_certificates_operations import ManagedCertificatesOperations @@ -38,19 +41,22 @@ "ContainerAppsAuthConfigsOperations", "AvailableWorkloadProfilesOperations", "BillingMetersOperations", + "BuildersOperations", + "BuildsOperations", "ConnectedEnvironmentsOperations", "ConnectedEnvironmentsCertificatesOperations", "ConnectedEnvironmentsDaprComponentsOperations", "ConnectedEnvironmentsStoragesOperations", "ContainerAppsOperations", - "JobsOperations", - "JobsExecutionsOperations", "ContainerAppsRevisionsOperations", "ContainerAppsRevisionReplicasOperations", "ContainerAppsDiagnosticsOperations", "ManagedEnvironmentDiagnosticsOperations", "ManagedEnvironmentsDiagnosticsOperations", "Operations", + "JobsOperations", + "JobsExecutionsOperations", + "ContainerAppsAPIClientOperationsMixin", "ManagedEnvironmentsOperations", "CertificatesOperations", "ManagedCertificatesOperations", 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 f3ff0c482d92..785fcd1d359b 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 @@ -28,6 +28,7 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._available_workload_profiles_operations import build_get_request +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] 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 c45d389b528a..63da0d32f836 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 @@ -26,6 +26,7 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._billing_meters_operations import build_get_request +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] 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..381cb4fc9db1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py @@ -0,0 +1,882 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._builders_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) +from .._vendor import ContainerAppsAPIClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`builders` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.BuilderResource"]: + """List BuilderResource resources by subscription ID. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/builders"} + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BuilderResource"]: + """List BuilderResource resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> _models.BuilderResource: + """Get a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuilderResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuilderResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuilderResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO], + **kwargs: Any + ) -> _models.BuilderResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_envelope, (IOBase, bytes)): + _content = builder_envelope + else: + _json = self._serialize.body(builder_envelope, "BuilderResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BuilderResource", pipeline_response) + + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("BuilderResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: _models.BuilderResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Required. + :type builder_envelope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Is either a BuilderResource type or a IO + type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + builder_envelope=builder_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + async def _update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO], + **kwargs: Any + ) -> Optional[_models.BuilderResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BuilderResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_envelope, (IOBase, bytes)): + _content = builder_envelope + else: + _json = self._serialize.body(builder_envelope, "BuilderResourceUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BuilderResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: _models.BuilderResourceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Required. + :type builder_envelope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Is either a + BuilderResourceUpdate type or a IO type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + builder_envelope=builder_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, builder_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + builder_name=builder_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py new file mode 100644 index 000000000000..b4deab8c471e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py @@ -0,0 +1,593 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._builds_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_builder_resource_request, +) +from .._vendor import ContainerAppsAPIClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`builds` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_builder_resource( + self, resource_group_name: str, builder_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BuildResource"]: + """List BuildResource resources by BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildResource or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_builder_resource_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_builder_resource.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuildCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_builder_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> _models.BuildResource: + """Get a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO], + **kwargs: Any + ) -> _models.BuildResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(build_envelope, (IOBase, bytes)): + _content = build_envelope + else: + _json = self._serialize.body(build_envelope, "BuildResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BuildResource", pipeline_response) + + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("BuildResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: _models.BuildResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Required. + :type build_envelope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Is either a BuildResource type or + a IO type. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + build_envelope=build_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + } 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 7e3b0ca468b6..b83461a40b75 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -35,6 +36,7 @@ build_list_request, build_update_request, ) +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -338,7 +340,7 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(certificate_envelope, (IO, bytes)): + if isinstance(certificate_envelope, (IOBase, bytes)): _content = certificate_envelope else: if certificate_envelope is not None: @@ -566,7 +568,7 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(certificate_envelope, (IO, bytes)): + if isinstance(certificate_envelope, (IOBase, bytes)): _content = certificate_envelope else: _json = self._serialize.body(certificate_envelope, "CertificatePatch") 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 796ecd07b385..6b74364ff107 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -35,6 +36,7 @@ build_list_request, build_update_request, ) +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -338,7 +340,7 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(certificate_envelope, (IO, bytes)): + if isinstance(certificate_envelope, (IOBase, bytes)): _content = certificate_envelope else: if certificate_envelope is not None: @@ -566,7 +568,7 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(certificate_envelope, (IO, bytes)): + if isinstance(certificate_envelope, (IOBase, bytes)): _content = certificate_envelope else: _json = self._serialize.body(certificate_envelope, "CertificatePatch") 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 6679b2d33557..6382d6dd4053 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -35,6 +36,7 @@ build_list_request, build_list_secrets_request, ) +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -338,7 +340,7 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(dapr_component_envelope, (IO, bytes)): + if isinstance(dapr_component_envelope, (IOBase, bytes)): _content = dapr_component_envelope else: _json = self._serialize.body(dapr_component_envelope, "DaprComponent") 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 76d13e823e39..2195628f2b39 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,6 +40,7 @@ build_list_by_subscription_request, build_update_request, ) +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -331,7 +333,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(environment_envelope, (IO, bytes)): + if isinstance(environment_envelope, (IOBase, bytes)): _content = environment_envelope else: _json = self._serialize.body(environment_envelope, "ConnectedEnvironment") @@ -837,7 +839,7 @@ async def check_name_availability( content_type = content_type or "application/json" _json = None _content = None - if isinstance(check_name_availability_request, (IO, bytes)): + if isinstance(check_name_availability_request, (IOBase, bytes)): _content = check_name_availability_request else: _json = self._serialize.body(check_name_availability_request, "CheckNameAvailabilityRequest") 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 dfc4de3e32c1..c13a226de5a2 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -31,6 +32,7 @@ build_get_request, build_list_request, ) +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -307,7 +309,7 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_envelope, (IO, bytes)): + if isinstance(storage_envelope, (IOBase, bytes)): _content = storage_envelope else: _json = self._serialize.body(storage_envelope, "ConnectedEnvironmentStorage") diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_api_client_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_api_client_operations.py new file mode 100644 index 000000000000..6afdcbec68df --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_api_client_operations.py @@ -0,0 +1,163 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._container_apps_api_client_operations import ( + build_get_custom_domain_verification_id_request, + build_job_execution_request, +) +from .._vendor import ContainerAppsAPIClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContainerAppsAPIClientOperationsMixin(ContainerAppsAPIClientMixinABC): + @distributed_trace_async + async def job_execution( + self, resource_group_name: str, job_name: str, job_execution_name: str, **kwargs: Any + ) -> _models.JobExecution: + """Get details of a single job execution. + + Get details of a single job execution. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Job Name. Required. + :type job_name: str + :param job_execution_name: Job execution name. Required. + :type job_execution_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobExecution or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.JobExecution + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.JobExecution] = kwargs.pop("cls", None) + + request = build_job_execution_request( + resource_group_name=resource_group_name, + job_name=job_name, + job_execution_name=job_execution_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.job_execution.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("JobExecution", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + job_execution.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}" + } + + @distributed_trace_async + async def get_custom_domain_verification_id(self, **kwargs: Any) -> str: + """Get the verification id of a subscription used for verifying custom domains. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str or the result of cls(response) + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[str] = kwargs.pop("cls", None) + + request = build_get_custom_domain_verification_id_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_custom_domain_verification_id.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_custom_domain_verification_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/getCustomDomainVerificationId" + } diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py index 4e45cf48bbdf..6a5c2a251391 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -34,6 +35,7 @@ build_get_request, build_list_by_container_app_request, ) +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -337,7 +339,7 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(auth_config_envelope, (IO, bytes)): + if isinstance(auth_config_envelope, (IOBase, bytes)): _content = auth_config_envelope else: _json = self._serialize.body(auth_config_envelope, "AuthConfig") 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 d7e9897275f7..4e7510f48d1b 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 @@ -35,6 +35,7 @@ build_list_detectors_request, build_list_revisions_request, ) +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] 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 2efeac6f6113..01e585fbba9d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,8 +40,11 @@ build_list_by_subscription_request, build_list_custom_host_name_analysis_request, build_list_secrets_request, + build_start_request, + build_stop_request, build_update_request, ) +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -327,7 +331,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(container_app_envelope, (IO, bytes)): + if isinstance(container_app_envelope, (IOBase, bytes)): _content = container_app_envelope else: _json = self._serialize.body(container_app_envelope, "ContainerApp") @@ -684,7 +688,7 @@ async def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(container_app_envelope, (IO, bytes)): + if isinstance(container_app_envelope, (IOBase, bytes)): _content = container_app_envelope else: _json = self._serialize.body(container_app_envelope, "ContainerApp") @@ -1096,3 +1100,265 @@ async def get_auth_token( get_auth_token.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/getAuthtoken" } + + async def _start_initial( + self, resource_group_name: str, container_app_name: str, **kwargs: Any + ) -> Optional[_models.ContainerApp]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.ContainerApp]] = kwargs.pop("cls", None) + + request = build_start_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ContainerApp", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/start" + } + + @distributed_trace_async + async def begin_start( + self, resource_group_name: str, container_app_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ContainerApp]: + """Start a container app. + + Start a 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ContainerApp or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ContainerApp] + :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.ContainerApp] = 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._start_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ContainerApp", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/start" + } + + async def _stop_initial( + self, resource_group_name: str, container_app_name: str, **kwargs: Any + ) -> Optional[_models.ContainerApp]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.ContainerApp]] = kwargs.pop("cls", None) + + request = build_stop_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._stop_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ContainerApp", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/stop" + } + + @distributed_trace_async + async def begin_stop( + self, resource_group_name: str, container_app_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ContainerApp]: + """Stop a container app. + + Stop a 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ContainerApp or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ContainerApp] + :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.ContainerApp] = 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._stop_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ContainerApp", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/stop" + } 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 9f914ddbfb36..c3a87d5b9019 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 @@ -29,6 +29,7 @@ build_get_replica_request, build_list_replicas_request, ) +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] 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 ac0a56fdbad4..1dbcc9bba533 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 @@ -35,6 +35,7 @@ build_list_revisions_request, build_restart_revision_request, ) +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] 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 e49dd63bbf3b..f2d3a0e60e1d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -36,6 +37,7 @@ build_get_request, build_list_by_container_app_request, ) +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -250,7 +252,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(source_control_envelope, (IO, bytes)): + if isinstance(source_control_envelope, (IOBase, bytes)): _content = source_control_envelope else: _json = self._serialize.body(source_control_envelope, "SourceControl") 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 abfc0d275c5e..7949d0ab55bd 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -35,6 +36,7 @@ build_list_request, build_list_secrets_request, ) +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -338,7 +340,7 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(dapr_component_envelope, (IO, bytes)): + if isinstance(dapr_component_envelope, (IOBase, bytes)): _content = dapr_component_envelope else: _json = self._serialize.body(dapr_component_envelope, "DaprComponent") 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 2225d5c506df..ec6e8e3a64ad 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 @@ -28,6 +28,7 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._jobs_executions_operations import build_list_request +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +64,7 @@ def list( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param filter: The filter to apply on the operation. Default value is None. :type filter: str 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 52d368091b9a..1f2fc2500a24 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -42,6 +43,7 @@ build_stop_multiple_executions_request, build_update_request, ) +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -247,7 +249,7 @@ async def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _ :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Job or the result of cls(response) @@ -324,7 +326,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_envelope, (IO, bytes)): + if isinstance(job_envelope, (IOBase, bytes)): _content = job_envelope else: _json = self._serialize.body(job_envelope, "Job") @@ -388,7 +390,7 @@ async def begin_create_or_update( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param job_envelope: Properties used to create a container apps job. Required. :type job_envelope: ~azure.mgmt.appcontainers.models.Job @@ -425,7 +427,7 @@ async def begin_create_or_update( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param job_envelope: Properties used to create a container apps job. Required. :type job_envelope: IO @@ -456,7 +458,7 @@ async def begin_create_or_update( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param job_envelope: Properties used to create a container apps job. Is either a Job type or a IO type. Required. @@ -588,7 +590,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -672,7 +674,7 @@ async def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_envelope, (IO, bytes)): + if isinstance(job_envelope, (IOBase, bytes)): _content = job_envelope else: _json = self._serialize.body(job_envelope, "JobPatchProperties") @@ -738,7 +740,7 @@ async def begin_update( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param job_envelope: Properties used to create a container apps job. Required. :type job_envelope: ~azure.mgmt.appcontainers.models.JobPatchProperties @@ -775,7 +777,7 @@ async def begin_update( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param job_envelope: Properties used to create a container apps job. Required. :type job_envelope: IO @@ -810,7 +812,7 @@ async def begin_update( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param job_envelope: Properties used to create a container apps job. Is either a JobPatchProperties type or a IO type. Required. @@ -899,7 +901,7 @@ async def _start_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(template, (IO, bytes)): + if isinstance(template, (IOBase, bytes)): _content = template else: _json = self._serialize.body(template, "JobExecutionTemplate") @@ -965,7 +967,7 @@ async def begin_start( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param template: Properties used to start a job instance. Required. :type template: ~azure.mgmt.appcontainers.models.JobExecutionTemplate @@ -1003,7 +1005,7 @@ async def begin_start( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param template: Properties used to start a job instance. Required. :type template: IO @@ -1035,7 +1037,7 @@ async def begin_start( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param template: Properties used to start a job instance. Is either a JobExecutionTemplate type or a IO type. Required. @@ -1170,7 +1172,7 @@ async def begin_stop_execution( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param job_execution_name: Job execution name. Required. :type job_execution_name: str @@ -1233,11 +1235,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- } async def _stop_multiple_executions_initial( - self, - resource_group_name: str, - job_name: str, - job_execution_name: Union[_models.JobExecutionNamesCollection, IO], - **kwargs: Any + self, resource_group_name: str, job_name: str, **kwargs: Any ) -> Optional[_models.ContainerAppJobExecutions]: error_map = { 401: ClientAuthenticationError, @@ -1247,29 +1245,17 @@ async def _stop_multiple_executions_initial( } 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[Optional[_models.ContainerAppJobExecutions]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(job_execution_name, (IO, bytes)): - _content = job_execution_name - else: - _json = self._serialize.body(job_execution_name, "JobExecutionNamesCollection") - request = build_stop_multiple_executions_request( resource_group_name=resource_group_name, job_name=job_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, template_url=self._stop_multiple_executions_initial.metadata["url"], headers=_headers, params=_params, @@ -1306,91 +1292,9 @@ async def _stop_multiple_executions_initial( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/stop" } - @overload - async def begin_stop_multiple_executions( - self, - resource_group_name: str, - job_name: str, - job_execution_name: _models.JobExecutionNamesCollection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerAppJobExecutions]: - """Terminates execution of a running container apps job. - - Terminates execution of a running container apps 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 Container Apps Job. Required. - :type job_name: str - :param job_execution_name: List of all job executions that should be stopped. Required. - :type job_execution_name: ~azure.mgmt.appcontainers.models.JobExecutionNamesCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ContainerAppJobExecutions or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ContainerAppJobExecutions] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_stop_multiple_executions( - self, - resource_group_name: str, - job_name: str, - job_execution_name: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ContainerAppJobExecutions]: - """Terminates execution of a running container apps job. - - Terminates execution of a running container apps 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 Container Apps Job. Required. - :type job_name: str - :param job_execution_name: List of all job executions that should be stopped. Required. - :type job_execution_name: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ContainerAppJobExecutions or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ContainerAppJobExecutions] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async async def begin_stop_multiple_executions( - self, - resource_group_name: str, - job_name: str, - job_execution_name: Union[_models.JobExecutionNamesCollection, IO], - **kwargs: Any + self, resource_group_name: str, job_name: str, **kwargs: Any ) -> AsyncLROPoller[_models.ContainerAppJobExecutions]: """Terminates execution of a running container apps job. @@ -1399,14 +1303,8 @@ async def begin_stop_multiple_executions( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str - :param job_execution_name: List of all job executions that should be stopped. Is either a - JobExecutionNamesCollection type or a IO type. Required. - :type job_execution_name: ~azure.mgmt.appcontainers.models.JobExecutionNamesCollection or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1421,11 +1319,10 @@ async def begin_stop_multiple_executions( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ContainerAppJobExecutions] :raises ~azure.core.exceptions.HttpResponseError: """ - _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.ContainerAppJobExecutions] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1434,9 +1331,7 @@ async def begin_stop_multiple_executions( raw_result = await self._stop_multiple_executions_initial( resource_group_name=resource_group_name, job_name=job_name, - job_execution_name=job_execution_name, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -1482,7 +1377,7 @@ async def list_secrets( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobSecretsCollection or the result of cls(response) 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 c12f35c9f6bb..34dade0546d1 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -37,6 +38,7 @@ build_list_request, build_update_request, ) +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -158,7 +160,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(managed_certificate_envelope, (IO, bytes)): + if isinstance(managed_certificate_envelope, (IOBase, bytes)): _content = managed_certificate_envelope else: if managed_certificate_envelope is not None: @@ -568,7 +570,7 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(managed_certificate_envelope, (IO, bytes)): + if isinstance(managed_certificate_envelope, (IOBase, bytes)): _content = managed_certificate_envelope else: _json = self._serialize.body(managed_certificate_envelope, "ManagedCertificatePatch") 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 e94b8e36bc30..0c728b1b93c4 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 @@ -29,6 +29,7 @@ build_get_detector_request, build_list_detectors_request, ) +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] 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 2a96cef37577..f7e58e053d8b 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 @@ -26,6 +26,7 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._managed_environments_diagnostics_operations import build_get_root_request +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] 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 f2c755446b55..1989e65081df 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,6 +41,7 @@ build_list_workload_profile_states_request, build_update_request, ) +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -332,7 +334,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(environment_envelope, (IO, bytes)): + if isinstance(environment_envelope, (IOBase, bytes)): _content = environment_envelope else: _json = self._serialize.body(environment_envelope, "ManagedEnvironment") @@ -680,7 +682,7 @@ async def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(environment_envelope, (IO, bytes)): + if isinstance(environment_envelope, (IOBase, bytes)): _content = environment_envelope else: _json = self._serialize.body(environment_envelope, "ManagedEnvironment") 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 a175a7e4ef2b..dd51d8ccbccb 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -31,6 +32,7 @@ build_get_request, build_list_request, ) +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -307,7 +309,7 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_envelope, (IO, bytes)): + if isinstance(storage_envelope, (IOBase, bytes)): _content = storage_envelope else: _json = self._serialize.body(storage_envelope, "ManagedEnvironmentStorage") 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 c8fe99420e73..1a0b6ed2c2d0 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,6 +27,7 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._namespaces_operations import build_check_name_availability_request +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -158,7 +160,7 @@ async def check_name_availability( content_type = content_type or "application/json" _json = None _content = None - if isinstance(check_name_availability_request, (IO, bytes)): + if isinstance(check_name_availability_request, (IOBase, bytes)): _content = check_name_availability_request else: _json = self._serialize.body(check_name_availability_request, "CheckNameAvailabilityRequest") 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 99d2f1dfba6e..8b1098269102 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 @@ -28,6 +28,7 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request +from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] 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 8e6c5b0a8da7..2423ba33c186 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 @@ -31,6 +31,13 @@ from ._models_py3 import BillingMeter from ._models_py3 import BillingMeterCollection from ._models_py3 import BillingMeterProperties +from ._models_py3 import BlobStorageTokenStore +from ._models_py3 import BuildCollection +from ._models_py3 import BuildConfiguration +from ._models_py3 import BuildResource +from ._models_py3 import BuilderCollection +from ._models_py3 import BuilderResource +from ._models_py3 import BuilderResourceUpdate from ._models_py3 import Certificate from ._models_py3 import CertificateCollection from ._models_py3 import CertificatePatch @@ -54,6 +61,8 @@ from ._models_py3 import ContainerAppProbeHttpGetHttpHeadersItem from ._models_py3 import ContainerAppProbeTcpSocket from ._models_py3 import ContainerAppSecret +from ._models_py3 import ContainerRegistry +from ._models_py3 import ContainerRegistryWithCustomImage from ._models_py3 import ContainerResources from ._models_py3 import CookieExpiration from ._models_py3 import CorsPolicy @@ -87,8 +96,10 @@ from ._models_py3 import DiagnosticsDefinition from ._models_py3 import DiagnosticsProperties from ._models_py3 import DiagnosticsStatus +from ._models_py3 import EncryptionSettings from ._models_py3 import EnvironmentAuthToken from ._models_py3 import EnvironmentVar +from ._models_py3 import EnvironmentVariable from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse @@ -99,16 +110,19 @@ from ._models_py3 import GithubActionConfiguration from ._models_py3 import GlobalValidation from ._models_py3 import Google +from ._models_py3 import HttpGet from ._models_py3 import HttpScaleRule from ._models_py3 import HttpSettings from ._models_py3 import HttpSettingsRoutes from ._models_py3 import IdentityProviders from ._models_py3 import Ingress +from ._models_py3 import IngressPortMapping from ._models_py3 import IngressStickySessions from ._models_py3 import InitContainer from ._models_py3 import IpSecurityRestrictionRule from ._models_py3 import Job from ._models_py3 import JobConfiguration +from ._models_py3 import JobConfigurationEventTriggerConfig from ._models_py3 import JobConfigurationManualTriggerConfig from ._models_py3 import JobConfigurationScheduleTriggerConfig from ._models_py3 import JobExecution @@ -118,6 +132,8 @@ from ._models_py3 import JobExecutionTemplate from ._models_py3 import JobPatchProperties from ._models_py3 import JobPatchPropertiesProperties +from ._models_py3 import JobScale +from ._models_py3 import JobScaleRule from ._models_py3 import JobSecretsCollection from ._models_py3 import JobTemplate from ._models_py3 import JobsCollection @@ -132,11 +148,13 @@ from ._models_py3 import ManagedCertificatePatch from ._models_py3 import ManagedCertificateProperties from ._models_py3 import ManagedEnvironment +from ._models_py3 import ManagedEnvironmentPropertiesPeerAuthentication from ._models_py3 import ManagedEnvironmentStorage from ._models_py3 import ManagedEnvironmentStorageProperties from ._models_py3 import ManagedEnvironmentStoragesCollection from ._models_py3 import ManagedEnvironmentsCollection from ._models_py3 import ManagedServiceIdentity +from ._models_py3 import Mtls from ._models_py3 import Nonce from ._models_py3 import OpenIdConnectClientCredential from ._models_py3 import OpenIdConnectConfig @@ -144,6 +162,7 @@ from ._models_py3 import OpenIdConnectRegistration from ._models_py3 import OperationDetail from ._models_py3 import OperationDisplay +from ._models_py3 import PreBuildStep from ._models_py3 import ProxyResource from ._models_py3 import QueueScaleRule from ._models_py3 import RegistryCredentials @@ -160,11 +179,14 @@ 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 SourceControl from ._models_py3 import SourceControlCollection from ._models_py3 import SystemData from ._models_py3 import TcpScaleRule from ._models_py3 import Template +from ._models_py3 import TokenStore from ._models_py3 import TrackedResource from ._models_py3 import TrafficWeight from ._models_py3 import Twitter @@ -185,10 +207,13 @@ 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 BuildStatus from ._container_apps_api_client_enums import CertificateProvisioningState from ._container_apps_api_client_enums import CheckNameAvailabilityReason from ._container_apps_api_client_enums import ConnectedEnvironmentProvisioningState +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 CookieExpirationConvention from ._container_apps_api_client_enums import CreatedByType from ._container_apps_api_client_enums import DnsVerificationTestResult @@ -202,8 +227,10 @@ from ._container_apps_api_client_enums import LogLevel from ._container_apps_api_client_enums import ManagedCertificateDomainControlValidation from ._container_apps_api_client_enums import ManagedServiceIdentityType +from ._container_apps_api_client_enums import ProvisioningState 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 SourceControlOperationState from ._container_apps_api_client_enums import StorageType @@ -240,6 +267,13 @@ "BillingMeter", "BillingMeterCollection", "BillingMeterProperties", + "BlobStorageTokenStore", + "BuildCollection", + "BuildConfiguration", + "BuildResource", + "BuilderCollection", + "BuilderResource", + "BuilderResourceUpdate", "Certificate", "CertificateCollection", "CertificatePatch", @@ -263,6 +297,8 @@ "ContainerAppProbeHttpGetHttpHeadersItem", "ContainerAppProbeTcpSocket", "ContainerAppSecret", + "ContainerRegistry", + "ContainerRegistryWithCustomImage", "ContainerResources", "CookieExpiration", "CorsPolicy", @@ -296,8 +332,10 @@ "DiagnosticsDefinition", "DiagnosticsProperties", "DiagnosticsStatus", + "EncryptionSettings", "EnvironmentAuthToken", "EnvironmentVar", + "EnvironmentVariable", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", @@ -308,16 +346,19 @@ "GithubActionConfiguration", "GlobalValidation", "Google", + "HttpGet", "HttpScaleRule", "HttpSettings", "HttpSettingsRoutes", "IdentityProviders", "Ingress", + "IngressPortMapping", "IngressStickySessions", "InitContainer", "IpSecurityRestrictionRule", "Job", "JobConfiguration", + "JobConfigurationEventTriggerConfig", "JobConfigurationManualTriggerConfig", "JobConfigurationScheduleTriggerConfig", "JobExecution", @@ -327,6 +368,8 @@ "JobExecutionTemplate", "JobPatchProperties", "JobPatchPropertiesProperties", + "JobScale", + "JobScaleRule", "JobSecretsCollection", "JobTemplate", "JobsCollection", @@ -341,11 +384,13 @@ "ManagedCertificatePatch", "ManagedCertificateProperties", "ManagedEnvironment", + "ManagedEnvironmentPropertiesPeerAuthentication", "ManagedEnvironmentStorage", "ManagedEnvironmentStorageProperties", "ManagedEnvironmentStoragesCollection", "ManagedEnvironmentsCollection", "ManagedServiceIdentity", + "Mtls", "Nonce", "OpenIdConnectClientCredential", "OpenIdConnectConfig", @@ -353,6 +398,7 @@ "OpenIdConnectRegistration", "OperationDetail", "OperationDisplay", + "PreBuildStep", "ProxyResource", "QueueScaleRule", "RegistryCredentials", @@ -369,11 +415,14 @@ "Secret", "SecretVolumeItem", "SecretsCollection", + "Service", + "ServiceBind", "SourceControl", "SourceControlCollection", "SystemData", "TcpScaleRule", "Template", + "TokenStore", "TrackedResource", "TrafficWeight", "Twitter", @@ -393,10 +442,13 @@ "AppProtocol", "Applicability", "BindingType", + "BuildStatus", "CertificateProvisioningState", "CheckNameAvailabilityReason", "ConnectedEnvironmentProvisioningState", + "ContainerAppContainerRunningState", "ContainerAppProvisioningState", + "ContainerAppReplicaRunningState", "CookieExpirationConvention", "CreatedByType", "DnsVerificationTestResult", @@ -410,8 +462,10 @@ "LogLevel", "ManagedCertificateDomainControlValidation", "ManagedServiceIdentityType", + "ProvisioningState", "RevisionHealthState", "RevisionProvisioningState", + "RevisionRunningState", "Scheme", "SourceControlOperationState", "StorageType", 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 2edbcb242617..3c347ac22e7b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py @@ -71,6 +71,16 @@ class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SNI_ENABLED = "SniEnabled" +class BuildStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the build once it has been provisioned.""" + + NOT_STARTED = "NotStarted" + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + + class CertificateProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the certificate.""" @@ -101,6 +111,14 @@ class ConnectedEnvironmentProvisioningState(str, Enum, metaclass=CaseInsensitive SCHEDULED_FOR_DELETE = "ScheduledForDelete" +class ContainerAppContainerRunningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Current running state of the container.""" + + RUNNING = "Running" + TERMINATED = "Terminated" + WAITING = "Waiting" + + class ContainerAppProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the Container App.""" @@ -111,6 +129,14 @@ class ContainerAppProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta DELETING = "Deleting" +class ContainerAppReplicaRunningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Current running state of the replica.""" + + RUNNING = "Running" + NOT_RUNNING = "NotRunning" + UNKNOWN = "Unknown" + + class CookieExpirationConvention(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The convention used when determining the session cookie's expiration.""" @@ -236,6 +262,17 @@ class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Resource instance provisioning state.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + + class RevisionHealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Current health State of the revision.""" @@ -254,6 +291,17 @@ class RevisionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): DEPROVISIONED = "Deprovisioned" +class RevisionRunningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Current running state of the revision.""" + + RUNNING = "Running" + PROCESSING = "Processing" + STOPPED = "Stopped" + DEGRADED = "Degraded" + FAILED = "Failed" + UNKNOWN = "Unknown" + + class Scheme(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Scheme to use for connecting to the host. Defaults to HTTP.""" @@ -281,7 +329,7 @@ class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class TriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Trigger type of the job.""" - SCHEDULED = "Scheduled" + SCHEDULE = "Schedule" EVENT = "Event" MANUAL = "Manual" 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 a9be26f8ccf1..07cc7e692c11 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 @@ -150,9 +150,10 @@ def __init__( class AppLogsConfiguration(_serialization.Model): """Configuration of application logs. - :ivar destination: Logs destination. + :ivar destination: Logs destination, can be 'log-analytics', 'azure-monitor' or 'none'. :vartype destination: str - :ivar log_analytics_configuration: Log Analytics configuration. + :ivar log_analytics_configuration: Log Analytics configuration, must only be provided when + destination is configured as 'log-analytics'. :vartype log_analytics_configuration: ~azure.mgmt.appcontainers.models.LogAnalyticsConfiguration """ @@ -170,9 +171,10 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword destination: Logs destination. + :keyword destination: Logs destination, can be 'log-analytics', 'azure-monitor' or 'none'. :paramtype destination: str - :keyword log_analytics_configuration: Log Analytics configuration. + :keyword log_analytics_configuration: Log Analytics configuration, must only be provided when + destination is configured as 'log-analytics'. :paramtype log_analytics_configuration: ~azure.mgmt.appcontainers.models.LogAnalyticsConfiguration """ @@ -321,6 +323,9 @@ class AuthConfig(ProxyResource): :ivar http_settings: The configuration settings of the HTTP requests for authentication and authorization requests made against ContainerApp Service Authentication/Authorization. :vartype http_settings: ~azure.mgmt.appcontainers.models.HttpSettings + :ivar encryption_settings: The configuration settings of the secrets references of encryption + key and signing key for ContainerApp Service Authentication/Authorization. + :vartype encryption_settings: ~azure.mgmt.appcontainers.models.EncryptionSettings """ _validation = { @@ -340,6 +345,7 @@ class AuthConfig(ProxyResource): "identity_providers": {"key": "properties.identityProviders", "type": "IdentityProviders"}, "login": {"key": "properties.login", "type": "Login"}, "http_settings": {"key": "properties.httpSettings", "type": "HttpSettings"}, + "encryption_settings": {"key": "properties.encryptionSettings", "type": "EncryptionSettings"}, } def __init__( @@ -350,6 +356,7 @@ def __init__( identity_providers: Optional["_models.IdentityProviders"] = None, login: Optional["_models.Login"] = None, http_settings: Optional["_models.HttpSettings"] = None, + encryption_settings: Optional["_models.EncryptionSettings"] = None, **kwargs: Any ) -> None: """ @@ -368,6 +375,9 @@ def __init__( :keyword http_settings: The configuration settings of the HTTP requests for authentication and authorization requests made against ContainerApp Service Authentication/Authorization. :paramtype http_settings: ~azure.mgmt.appcontainers.models.HttpSettings + :keyword encryption_settings: The configuration settings of the secrets references of + encryption key and signing key for ContainerApp Service Authentication/Authorization. + :paramtype encryption_settings: ~azure.mgmt.appcontainers.models.EncryptionSettings """ super().__init__(**kwargs) self.platform = platform @@ -375,6 +385,7 @@ def __init__( self.identity_providers = identity_providers self.login = login self.http_settings = http_settings + self.encryption_settings = encryption_settings class AuthConfigCollection(_serialization.Model): @@ -878,6 +889,8 @@ class AzureCredentials(_serialization.Model): :vartype client_secret: str :ivar tenant_id: Tenant Id. :vartype tenant_id: str + :ivar kind: Kind of auth github does for deploying the template. + :vartype kind: str :ivar subscription_id: Subscription Id. :vartype subscription_id: str """ @@ -886,6 +899,7 @@ class AzureCredentials(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, "client_secret": {"key": "clientSecret", "type": "str"}, "tenant_id": {"key": "tenantId", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, "subscription_id": {"key": "subscriptionId", "type": "str"}, } @@ -895,6 +909,7 @@ def __init__( client_id: Optional[str] = None, client_secret: Optional[str] = None, tenant_id: Optional[str] = None, + kind: Optional[str] = None, subscription_id: Optional[str] = None, **kwargs: Any ) -> None: @@ -905,6 +920,8 @@ def __init__( :paramtype client_secret: str :keyword tenant_id: Tenant Id. :paramtype tenant_id: str + :keyword kind: Kind of auth github does for deploying the template. + :paramtype kind: str :keyword subscription_id: Subscription Id. :paramtype subscription_id: str """ @@ -912,6 +929,7 @@ def __init__( self.client_id = client_id self.client_secret = client_secret self.tenant_id = tenant_id + self.kind = kind self.subscription_id = subscription_id @@ -1203,6 +1221,155 @@ def __init__( self.display_name = display_name +class BlobStorageTokenStore(_serialization.Model): + """The configuration settings of the storage of the tokens if blob storage is used. + + All required parameters must be populated in order to send to Azure. + + :ivar sas_url_setting_name: The name of the app secrets containing the SAS URL of the blob + storage containing the tokens. Required. + :vartype sas_url_setting_name: str + """ + + _validation = { + "sas_url_setting_name": {"required": True}, + } + + _attribute_map = { + "sas_url_setting_name": {"key": "sasUrlSettingName", "type": "str"}, + } + + def __init__(self, *, sas_url_setting_name: str, **kwargs: Any) -> None: + """ + :keyword sas_url_setting_name: The name of the app secrets containing the SAS URL of the blob + storage containing the tokens. Required. + :paramtype sas_url_setting_name: str + """ + super().__init__(**kwargs) + self.sas_url_setting_name = sas_url_setting_name + + +class BuildCollection(_serialization.Model): + """The response of a BuildResource list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The BuildResource items on this page. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.BuildResource] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[BuildResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.BuildResource"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The BuildResource items on this page. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.BuildResource] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildConfiguration(_serialization.Model): + """Configuration of the build. + + :ivar base_os: Base OS used to build and run the app. + :vartype base_os: str + :ivar platform: Platform to be used to build and run the app. + :vartype platform: str + :ivar platform_version: Platform version to be used to build and run the app. + :vartype platform_version: str + :ivar environment_variables: List of environment variables to be passed to the build and + application runtime. + :vartype environment_variables: list[~azure.mgmt.appcontainers.models.EnvironmentVariable] + :ivar pre_build_steps: List of steps to perform before the build. + :vartype pre_build_steps: list[~azure.mgmt.appcontainers.models.PreBuildStep] + """ + + _attribute_map = { + "base_os": {"key": "baseOs", "type": "str"}, + "platform": {"key": "platform", "type": "str"}, + "platform_version": {"key": "platformVersion", "type": "str"}, + "environment_variables": {"key": "environmentVariables", "type": "[EnvironmentVariable]"}, + "pre_build_steps": {"key": "preBuildSteps", "type": "[PreBuildStep]"}, + } + + def __init__( + self, + *, + base_os: Optional[str] = None, + platform: Optional[str] = None, + platform_version: Optional[str] = None, + environment_variables: Optional[List["_models.EnvironmentVariable"]] = None, + pre_build_steps: Optional[List["_models.PreBuildStep"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword base_os: Base OS used to build and run the app. + :paramtype base_os: str + :keyword platform: Platform to be used to build and run the app. + :paramtype platform: str + :keyword platform_version: Platform version to be used to build and run the app. + :paramtype platform_version: str + :keyword environment_variables: List of environment variables to be passed to the build and + application runtime. + :paramtype environment_variables: list[~azure.mgmt.appcontainers.models.EnvironmentVariable] + :keyword pre_build_steps: List of steps to perform before the build. + :paramtype pre_build_steps: list[~azure.mgmt.appcontainers.models.PreBuildStep] + """ + super().__init__(**kwargs) + self.base_os = base_os + self.platform = platform + self.platform_version = platform_version + self.environment_variables = environment_variables + self.pre_build_steps = pre_build_steps + + +class BuilderCollection(_serialization.Model): + """The response of a BuilderResource list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The BuilderResource items on this page. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.BuilderResource] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[BuilderResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.BuilderResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The BuilderResource items on this page. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.BuilderResource] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + class TrackedResource(Resource): """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. @@ -1257,6 +1424,225 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location +class BuilderResource(TrackedResource): # pylint: disable=too-many-instance-attributes + """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 Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar 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.ProvisioningState + :ivar environment_id: Resource ID of the container apps environment that the builder is + associated with. + :vartype environment_id: str + :ivar build_compute_id: Resource ID of the compute that the builds will be performed on. + :vartype build_compute_id: str + :ivar patch_compute_id: Resource ID of the compute that the patching will be performed on. + :vartype patch_compute_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 = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "build_compute_id": {"readonly": True}, + "patch_compute_id": {"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"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "environment_id": {"key": "properties.environmentId", "type": "str"}, + "build_compute_id": {"key": "properties.buildComputeId", "type": "str"}, + "patch_compute_id": {"key": "properties.patchComputeId", "type": "str"}, + "container_registries": {"key": "properties.containerRegistries", "type": "[ContainerRegistry]"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + environment_id: Optional[str] = None, + container_registries: Optional[List["_models.ContainerRegistry"]] = 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: 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.identity = identity + self.provisioning_state = None + self.environment_id = environment_id + self.build_compute_id = None + self.patch_compute_id = None + self.container_registries = container_registries + + +class BuilderResourceUpdate(_serialization.Model): + """The type used for update operations of the BuilderResource. + + :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, + *, + identity: Optional["_models.ManagedServiceIdentity"] = None, + tags: Optional[Dict[str, str]] = None, + environment_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :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 BuildResource(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. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar provisioning_state: Build provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.ProvisioningState + :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 + """ + + _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}, + } + + _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"}, + } + + 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 + + class Certificate(TrackedResource): """Certificate used for Custom Domain bindings of Container Apps in a Managed Environment. @@ -1573,6 +1959,8 @@ class Configuration(_serialization.Model): :vartype dapr: ~azure.mgmt.appcontainers.models.Dapr :ivar max_inactive_revisions: Optional. Max inactive revisions a Container App can have. :vartype max_inactive_revisions: int + :ivar service: Container App to be a dev Container App Service. + :vartype service: ~azure.mgmt.appcontainers.models.Service """ _attribute_map = { @@ -1582,6 +1970,7 @@ class Configuration(_serialization.Model): "registries": {"key": "registries", "type": "[RegistryCredentials]"}, "dapr": {"key": "dapr", "type": "Dapr"}, "max_inactive_revisions": {"key": "maxInactiveRevisions", "type": "int"}, + "service": {"key": "service", "type": "Service"}, } def __init__( @@ -1593,6 +1982,7 @@ def __init__( registries: Optional[List["_models.RegistryCredentials"]] = None, dapr: Optional["_models.Dapr"] = None, max_inactive_revisions: Optional[int] = None, + service: Optional["_models.Service"] = None, **kwargs: Any ) -> None: """ @@ -1617,6 +2007,8 @@ def __init__( :paramtype dapr: ~azure.mgmt.appcontainers.models.Dapr :keyword max_inactive_revisions: Optional. Max inactive revisions a Container App can have. :paramtype max_inactive_revisions: int + :keyword service: Container App to be a dev Container App Service. + :paramtype service: ~azure.mgmt.appcontainers.models.Service """ super().__init__(**kwargs) self.secrets = secrets @@ -1625,6 +2017,7 @@ def __init__( self.registries = registries self.dapr = dapr self.max_inactive_revisions = max_inactive_revisions + self.service = service class ConnectedEnvironment(TrackedResource): # pylint: disable=too-many-instance-attributes @@ -2507,6 +2900,77 @@ def __init__(self, **kwargs: Any) -> None: self.key_vault_url = None +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 Azure. + + :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 Azure. + + :ivar server: Login server of the container registry that the final image should be uploaded + to. Builder resource needs to have this container registry defined along with an identity to + use to access it. Required. + :vartype server: str + :ivar image: Full name that the final image should be uploaded as, including both image name + and tag. + :vartype image: str + """ + + _validation = { + "server": {"required": True}, + } + + _attribute_map = { + "server": {"key": "server", "type": "str"}, + "image": {"key": "image", "type": "str"}, + } + + def __init__(self, *, server: str, image: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword server: Login server of the container registry that the final image should be uploaded + to. Builder resource needs to have this container registry defined along with an identity to + use to access it. Required. + :paramtype server: str + :keyword image: Full name that the final image should be uploaded as, including both image name + and tag. + :paramtype image: str + """ + super().__init__(**kwargs) + self.server = server + self.image = image + + class ContainerResources(_serialization.Model): """Container App container resource requirements. @@ -3972,6 +4436,43 @@ def __init__(self, **kwargs: Any) -> None: self.pes_id = None +class EncryptionSettings(_serialization.Model): + """The configuration settings of the secrets references of encryption key and signing key for + ContainerApp Service Authentication/Authorization. + + :ivar container_app_auth_encryption_secret_name: The secret name which is referenced for + EncryptionKey. + :vartype container_app_auth_encryption_secret_name: str + :ivar container_app_auth_signing_secret_name: The secret name which is referenced for + SigningKey. + :vartype container_app_auth_signing_secret_name: str + """ + + _attribute_map = { + "container_app_auth_encryption_secret_name": {"key": "containerAppAuthEncryptionSecretName", "type": "str"}, + "container_app_auth_signing_secret_name": {"key": "containerAppAuthSigningSecretName", "type": "str"}, + } + + def __init__( + self, + *, + container_app_auth_encryption_secret_name: Optional[str] = None, + container_app_auth_signing_secret_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword container_app_auth_encryption_secret_name: The secret name which is referenced for + EncryptionKey. + :paramtype container_app_auth_encryption_secret_name: str + :keyword container_app_auth_signing_secret_name: The secret name which is referenced for + SigningKey. + :paramtype container_app_auth_signing_secret_name: str + """ + super().__init__(**kwargs) + self.container_app_auth_encryption_secret_name = container_app_auth_encryption_secret_name + self.container_app_auth_signing_secret_name = container_app_auth_signing_secret_name + + class EnvironmentAuthToken(TrackedResource): """Environment Auth Token. @@ -4074,6 +4575,39 @@ def __init__( self.secret_ref = secret_ref +class EnvironmentVariable(_serialization.Model): + """Model representing an environment variable. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Environment variable name. Required. + :vartype name: str + :ivar value: Environment variable value. Required. + :vartype value: str + """ + + _validation = { + "name": {"required": True}, + "value": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, name: str, value: str, **kwargs: Any) -> None: + """ + :keyword name: Environment variable name. Required. + :paramtype name: str + :keyword value: Environment variable value. Required. + :paramtype value: str + """ + super().__init__(**kwargs) + self.name = name + self.value = value + + class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. @@ -4340,6 +4874,8 @@ class GithubActionConfiguration(_serialization.Model): :vartype azure_credentials: ~azure.mgmt.appcontainers.models.AzureCredentials :ivar context_path: Context path. :vartype context_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. :vartype image: str :ivar publish_type: Code or Image. @@ -4356,6 +4892,7 @@ class GithubActionConfiguration(_serialization.Model): "registry_info": {"key": "registryInfo", "type": "RegistryInfo"}, "azure_credentials": {"key": "azureCredentials", "type": "AzureCredentials"}, "context_path": {"key": "contextPath", "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"}, @@ -4369,6 +4906,7 @@ def __init__( registry_info: Optional["_models.RegistryInfo"] = None, azure_credentials: Optional["_models.AzureCredentials"] = None, context_path: Optional[str] = None, + github_personal_access_token: Optional[str] = None, image: Optional[str] = None, publish_type: Optional[str] = None, os: Optional[str] = None, @@ -4383,6 +4921,8 @@ def __init__( :paramtype azure_credentials: ~azure.mgmt.appcontainers.models.AzureCredentials :keyword context_path: Context path. :paramtype context_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. :paramtype image: str :keyword publish_type: Code or Image. @@ -4398,6 +4938,7 @@ def __init__( self.registry_info = registry_info self.azure_credentials = azure_credentials self.context_path = context_path + self.github_personal_access_token = github_personal_access_token self.image = image self.publish_type = publish_type self.os = os @@ -4493,23 +5034,63 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword enabled: :code:`false` if the Google provider should not be enabled - despite the set registration; otherwise, :code:`true`. - :paramtype enabled: bool - :keyword registration: The configuration settings of the app registration for the Google - provider. - :paramtype registration: ~azure.mgmt.appcontainers.models.ClientRegistration - :keyword login: The configuration settings of the login flow. - :paramtype login: ~azure.mgmt.appcontainers.models.LoginScopes - :keyword validation: The configuration settings of the Azure Active Directory token validation - flow. - :paramtype validation: ~azure.mgmt.appcontainers.models.AllowedAudiencesValidation + :keyword enabled: :code:`false` if the Google provider should not be enabled + despite the set registration; otherwise, :code:`true`. + :paramtype enabled: bool + :keyword registration: The configuration settings of the app registration for the Google + provider. + :paramtype registration: ~azure.mgmt.appcontainers.models.ClientRegistration + :keyword login: The configuration settings of the login flow. + :paramtype login: ~azure.mgmt.appcontainers.models.LoginScopes + :keyword validation: The configuration settings of the Azure Active Directory token validation + flow. + :paramtype validation: ~azure.mgmt.appcontainers.models.AllowedAudiencesValidation + """ + super().__init__(**kwargs) + self.enabled = enabled + self.registration = registration + self.login = login + self.validation = validation + + +class HttpGet(_serialization.Model): + """Model representing a http get request. + + All required parameters must be populated in order to send to Azure. + + :ivar url: URL to make HTTP GET request against. Required. + :vartype url: str + :ivar file_name: Name of the file that the request should be saved to. + :vartype file_name: str + :ivar headers: List of headers to send with the request. + :vartype headers: list[str] + """ + + _validation = { + "url": {"required": True}, + } + + _attribute_map = { + "url": {"key": "url", "type": "str"}, + "file_name": {"key": "fileName", "type": "str"}, + "headers": {"key": "headers", "type": "[str]"}, + } + + def __init__( + self, *, url: str, file_name: Optional[str] = None, headers: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :keyword url: URL to make HTTP GET request against. Required. + :paramtype url: str + :keyword file_name: Name of the file that the request should be saved to. + :paramtype file_name: str + :keyword headers: List of headers to send with the request. + :paramtype headers: list[str] """ super().__init__(**kwargs) - self.enabled = enabled - self.registration = registration - self.login = login - self.validation = validation + self.url = url + self.file_name = file_name + self.headers = headers class HttpScaleRule(_serialization.Model): @@ -4730,6 +5311,8 @@ class Ingress(_serialization.Model): # pylint: disable=too-many-instance-attrib ~azure.mgmt.appcontainers.models.IngressClientCertificateMode :ivar cors_policy: CORS policy for container app. :vartype cors_policy: ~azure.mgmt.appcontainers.models.CorsPolicy + :ivar additional_port_mappings: Settings to expose additional ports on container app. + :vartype additional_port_mappings: list[~azure.mgmt.appcontainers.models.IngressPortMapping] """ _validation = { @@ -4749,6 +5332,7 @@ class Ingress(_serialization.Model): # pylint: disable=too-many-instance-attrib "sticky_sessions": {"key": "stickySessions", "type": "IngressStickySessions"}, "client_certificate_mode": {"key": "clientCertificateMode", "type": "str"}, "cors_policy": {"key": "corsPolicy", "type": "CorsPolicy"}, + "additional_port_mappings": {"key": "additionalPortMappings", "type": "[IngressPortMapping]"}, } def __init__( @@ -4765,6 +5349,7 @@ def __init__( sticky_sessions: Optional["_models.IngressStickySessions"] = None, client_certificate_mode: Optional[Union[str, "_models.IngressClientCertificateMode"]] = None, cors_policy: Optional["_models.CorsPolicy"] = None, + additional_port_mappings: Optional[List["_models.IngressPortMapping"]] = None, **kwargs: Any ) -> None: """ @@ -4797,6 +5382,8 @@ def __init__( ~azure.mgmt.appcontainers.models.IngressClientCertificateMode :keyword cors_policy: CORS policy for container app. :paramtype cors_policy: ~azure.mgmt.appcontainers.models.CorsPolicy + :keyword additional_port_mappings: Settings to expose additional ports on container app. + :paramtype additional_port_mappings: list[~azure.mgmt.appcontainers.models.IngressPortMapping] """ super().__init__(**kwargs) self.fqdn = None @@ -4811,6 +5398,50 @@ def __init__( self.sticky_sessions = sticky_sessions self.client_certificate_mode = client_certificate_mode self.cors_policy = cors_policy + self.additional_port_mappings = additional_port_mappings + + +class IngressPortMapping(_serialization.Model): + """Port mappings of container app ingress. + + All required parameters must be populated in order to send to Azure. + + :ivar external: Specifies whether the app port is accessible outside of the environment. + Required. + :vartype external: bool + :ivar target_port: Specifies the port user's container listens on. Required. + :vartype target_port: int + :ivar exposed_port: Specifies the exposed port for the target port. If not specified, it + defaults to target port. + :vartype exposed_port: int + """ + + _validation = { + "external": {"required": True}, + "target_port": {"required": True}, + } + + _attribute_map = { + "external": {"key": "external", "type": "bool"}, + "target_port": {"key": "targetPort", "type": "int"}, + "exposed_port": {"key": "exposedPort", "type": "int"}, + } + + def __init__(self, *, external: bool, target_port: int, exposed_port: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword external: Specifies whether the app port is accessible outside of the environment. + Required. + :paramtype external: bool + :keyword target_port: Specifies the port user's container listens on. Required. + :paramtype target_port: int + :keyword exposed_port: Specifies the exposed port for the target port. If not specified, it + defaults to target port. + :paramtype exposed_port: int + """ + super().__init__(**kwargs) + self.external = external + self.target_port = target_port + self.exposed_port = exposed_port class IngressStickySessions(_serialization.Model): @@ -5077,7 +5708,7 @@ class JobConfiguration(_serialization.Model): :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: "Scheduled", "Event", and + :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. @@ -5092,6 +5723,9 @@ class JobConfiguration(_serialization.Model): 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] @@ -5109,6 +5743,7 @@ class JobConfiguration(_serialization.Model): "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]"}, } @@ -5121,13 +5756,14 @@ def __init__( 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, **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: "Scheduled", "Event", and + :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. @@ -5142,6 +5778,9 @@ def __init__( 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] @@ -5153,9 +5792,51 @@ def __init__( 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 +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. @@ -5238,7 +5919,7 @@ def __init__( class JobExecution(_serialization.Model): - """Container Apps Jobs execution. + """Container Apps Job execution. Variables are only populated by the server, and will be ignored when sending a request. @@ -5253,7 +5934,7 @@ class JobExecution(_serialization.Model): :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 start time. + :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 @@ -5293,7 +5974,7 @@ def __init__( :paramtype type: str :keyword start_time: Job execution start time. :paramtype start_time: ~datetime.datetime - :keyword end_time: Job execution start time. + :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 @@ -5552,6 +6233,104 @@ def __init__( 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] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "metadata": {"key": "metadata", "type": "object"}, + "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + metadata: Optional[JSON] = None, + auth: Optional[List["_models.ScaleRuleAuth"]] = 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] + """ + super().__init__(**kwargs) + self.name = name + self.type = type + self.metadata = metadata + self.auth = auth + + class JobsCollection(_serialization.Model): """Container Apps Jobs collection ARM resource. @@ -5707,7 +6486,8 @@ def __init__(self, **kwargs: Any) -> None: class LogAnalyticsConfiguration(_serialization.Model): - """Log analytics configuration. + """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 @@ -5738,6 +6518,8 @@ class Login(_serialization.Model): :ivar routes: The routes that specify the endpoints used for login and logout requests. :vartype routes: ~azure.mgmt.appcontainers.models.LoginRoutes + :ivar token_store: The configuration settings of the token store. + :vartype token_store: ~azure.mgmt.appcontainers.models.TokenStore :ivar preserve_url_fragments_for_logins: :code:`true` if the fragments from the request are preserved after the login request is made; otherwise, :code:`false`. :vartype preserve_url_fragments_for_logins: bool @@ -5754,6 +6536,7 @@ class Login(_serialization.Model): _attribute_map = { "routes": {"key": "routes", "type": "LoginRoutes"}, + "token_store": {"key": "tokenStore", "type": "TokenStore"}, "preserve_url_fragments_for_logins": {"key": "preserveUrlFragmentsForLogins", "type": "bool"}, "allowed_external_redirect_urls": {"key": "allowedExternalRedirectUrls", "type": "[str]"}, "cookie_expiration": {"key": "cookieExpiration", "type": "CookieExpiration"}, @@ -5764,6 +6547,7 @@ def __init__( self, *, routes: Optional["_models.LoginRoutes"] = None, + token_store: Optional["_models.TokenStore"] = None, preserve_url_fragments_for_logins: Optional[bool] = None, allowed_external_redirect_urls: Optional[List[str]] = None, cookie_expiration: Optional["_models.CookieExpiration"] = None, @@ -5773,6 +6557,8 @@ def __init__( """ :keyword routes: The routes that specify the endpoints used for login and logout requests. :paramtype routes: ~azure.mgmt.appcontainers.models.LoginRoutes + :keyword token_store: The configuration settings of the token store. + :paramtype token_store: ~azure.mgmt.appcontainers.models.TokenStore :keyword preserve_url_fragments_for_logins: :code:`true` if the fragments from the request are preserved after the login request is made; otherwise, :code:`false`. :paramtype preserve_url_fragments_for_logins: bool @@ -5788,6 +6574,7 @@ def __init__( """ super().__init__(**kwargs) self.routes = routes + self.token_store = token_store self.preserve_url_fragments_for_logins = preserve_url_fragments_for_logins self.allowed_external_redirect_urls = allowed_external_redirect_urls self.cookie_expiration = cookie_expiration @@ -6075,6 +6862,9 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- 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 """ _validation = { @@ -6116,6 +6906,10 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- "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", + }, } def __init__( @@ -6134,6 +6928,7 @@ def __init__( keda_configuration: Optional["_models.KedaConfiguration"] = None, dapr_configuration: Optional["_models.DaprConfiguration"] = None, infrastructure_resource_group: Optional[str] = None, + peer_authentication: Optional["_models.ManagedEnvironmentPropertiesPeerAuthentication"] = None, **kwargs: Any ) -> None: """ @@ -6170,6 +6965,9 @@ def __init__( 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 """ super().__init__(tags=tags, location=location, **kwargs) self.kind = kind @@ -6188,6 +6986,27 @@ def __init__( self.keda_configuration = keda_configuration self.dapr_configuration = dapr_configuration self.infrastructure_resource_group = infrastructure_resource_group + self.peer_authentication = peer_authentication + + +class ManagedEnvironmentPropertiesPeerAuthentication(_serialization.Model): + """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 ManagedEnvironmentsCollection(_serialization.Model): @@ -6379,6 +7198,26 @@ def __init__( self.user_assigned_identities = user_assigned_identities +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 Nonce(_serialization.Model): """The configuration settings of the nonce used in the login flow. @@ -6665,6 +7504,45 @@ def __init__( self.description = description +class PreBuildStep(_serialization.Model): + """Model representing a pre-build step. + + :ivar description: Description of the pre-build step. + :vartype description: str + :ivar scripts: List of custom commands to run. + :vartype scripts: list[str] + :ivar http_get: Http get request to send before the build. + :vartype http_get: ~azure.mgmt.appcontainers.models.HttpGet + """ + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "scripts": {"key": "scripts", "type": "[str]"}, + "http_get": {"key": "httpGet", "type": "HttpGet"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + scripts: Optional[List[str]] = None, + http_get: Optional["_models.HttpGet"] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: Description of the pre-build step. + :paramtype description: str + :keyword scripts: List of custom commands to run. + :paramtype scripts: list[str] + :keyword http_get: Http get request to send before the build. + :paramtype http_get: ~azure.mgmt.appcontainers.models.HttpGet + """ + super().__init__(**kwargs) + self.description = description + self.scripts = scripts + self.http_get = http_get + + class QueueScaleRule(_serialization.Model): """Container App container Azure Queue based scaling rule. @@ -6811,8 +7689,15 @@ class Replica(ProxyResource): :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData :ivar created_time: Timestamp describing when the pod was created by controller. :vartype created_time: ~datetime.datetime + :ivar running_state: Current running state of the replica. Known values are: "Running", + "NotRunning", and "Unknown". + :vartype running_state: str or ~azure.mgmt.appcontainers.models.ContainerAppReplicaRunningState + :ivar running_state_details: The details of replica current running state. + :vartype running_state_details: str :ivar containers: The containers collection under a replica. :vartype containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] + :ivar init_containers: The init containers collection under a replica. + :vartype init_containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] """ _validation = { @@ -6821,6 +7706,8 @@ class Replica(ProxyResource): "type": {"readonly": True}, "system_data": {"readonly": True}, "created_time": {"readonly": True}, + "running_state": {"readonly": True}, + "running_state_details": {"readonly": True}, } _attribute_map = { @@ -6829,17 +7716,31 @@ class Replica(ProxyResource): "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, "created_time": {"key": "properties.createdTime", "type": "iso-8601"}, + "running_state": {"key": "properties.runningState", "type": "str"}, + "running_state_details": {"key": "properties.runningStateDetails", "type": "str"}, "containers": {"key": "properties.containers", "type": "[ReplicaContainer]"}, + "init_containers": {"key": "properties.initContainers", "type": "[ReplicaContainer]"}, } - def __init__(self, *, containers: Optional[List["_models.ReplicaContainer"]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + containers: Optional[List["_models.ReplicaContainer"]] = None, + init_containers: Optional[List["_models.ReplicaContainer"]] = None, + **kwargs: Any + ) -> None: """ :keyword containers: The containers collection under a replica. :paramtype containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] + :keyword init_containers: The init containers collection under a replica. + :paramtype init_containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] """ super().__init__(**kwargs) self.created_time = None + self.running_state = None + self.running_state_details = None self.containers = containers + self.init_containers = init_containers class ReplicaCollection(_serialization.Model): @@ -6883,6 +7784,12 @@ class ReplicaContainer(_serialization.Model): :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. @@ -6890,6 +7797,8 @@ class ReplicaContainer(_serialization.Model): """ _validation = { + "running_state": {"readonly": True}, + "running_state_details": {"readonly": True}, "log_stream_endpoint": {"readonly": True}, "exec_endpoint": {"readonly": True}, } @@ -6900,6 +7809,8 @@ class ReplicaContainer(_serialization.Model): "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"}, } @@ -6932,6 +7843,8 @@ def __init__( 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 @@ -6978,6 +7891,9 @@ class Revision(ProxyResource): # pylint: disable=too-many-instance-attributes :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 = { @@ -6995,6 +7911,7 @@ class Revision(ProxyResource): # pylint: disable=too-many-instance-attributes "provisioning_error": {"readonly": True}, "health_state": {"readonly": True}, "provisioning_state": {"readonly": True}, + "running_state": {"readonly": True}, } _attribute_map = { @@ -7012,6 +7929,7 @@ class Revision(ProxyResource): # pylint: disable=too-many-instance-attributes "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: @@ -7027,6 +7945,7 @@ def __init__(self, **kwargs: Any) -> None: self.provisioning_error = None self.health_state = None self.provisioning_state = None + self.running_state = None class RevisionCollection(_serialization.Model): @@ -7156,9 +8075,9 @@ def __init__( class ScaleRuleAuth(_serialization.Model): - """Auth Secrets for Container App Scale Rule. + """Auth Secrets for Scale Rule. - :ivar secret_ref: Name of the Container App secret from which to pull the auth params. + :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 @@ -7173,7 +8092,7 @@ def __init__( self, *, secret_ref: Optional[str] = None, trigger_parameter: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword secret_ref: Name of the Container App secret from which to pull the auth params. + :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 @@ -7287,6 +8206,58 @@ def __init__(self, *, secret_ref: Optional[str] = None, path: Optional[str] = No self.path = path +class Service(_serialization.Model): + """Container App to be a dev service. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Dev ContainerApp service type. Required. + :vartype type: str + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, type: str, **kwargs: Any) -> None: + """ + :keyword type: Dev ContainerApp service type. Required. + :paramtype type: str + """ + super().__init__(**kwargs) + self.type = type + + +class ServiceBind(_serialization.Model): + """Configuration to bind a ContainerApp to a dev ContainerApp Service. + + :ivar service_id: Resource id of the target service. + :vartype service_id: str + :ivar name: Name of the service bind. + :vartype name: str + """ + + _attribute_map = { + "service_id": {"key": "serviceId", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + 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 + """ + super().__init__(**kwargs) + self.service_id = service_id + self.name = name + + class SourceControl(ProxyResource): """Container App SourceControl. @@ -7503,6 +8474,12 @@ class Template(_serialization.Model): :ivar revision_suffix: User friendly suffix that is appended to the revision name. :vartype revision_suffix: str + :ivar termination_grace_period_seconds: Optional duration in seconds the Container App Instance + needs to terminate gracefully. Value must be non-negative integer. The value zero indicates + stop immediately via the kill signal (no opportunity to shut down). If this value is nil, the + default grace period will be used instead. Set this value longer than the expected cleanup time + for your process. Defaults to 30 seconds. + :vartype termination_grace_period_seconds: int :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. @@ -7511,29 +8488,41 @@ class Template(_serialization.Model): :vartype scale: ~azure.mgmt.appcontainers.models.Scale :ivar volumes: List of volume definitions for the Container App. :vartype volumes: list[~azure.mgmt.appcontainers.models.Volume] + :ivar service_binds: List of container app services bound to the app. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.ServiceBind] """ _attribute_map = { "revision_suffix": {"key": "revisionSuffix", "type": "str"}, + "termination_grace_period_seconds": {"key": "terminationGracePeriodSeconds", "type": "int"}, "init_containers": {"key": "initContainers", "type": "[InitContainer]"}, "containers": {"key": "containers", "type": "[Container]"}, "scale": {"key": "scale", "type": "Scale"}, "volumes": {"key": "volumes", "type": "[Volume]"}, + "service_binds": {"key": "serviceBinds", "type": "[ServiceBind]"}, } def __init__( self, *, revision_suffix: Optional[str] = None, + termination_grace_period_seconds: Optional[int] = None, init_containers: Optional[List["_models.InitContainer"]] = None, containers: Optional[List["_models.Container"]] = None, scale: Optional["_models.Scale"] = None, volumes: Optional[List["_models.Volume"]] = None, + service_binds: Optional[List["_models.ServiceBind"]] = None, **kwargs: Any ) -> None: """ :keyword revision_suffix: User friendly suffix that is appended to the revision name. :paramtype revision_suffix: str + :keyword termination_grace_period_seconds: Optional duration in seconds the Container App + Instance needs to terminate gracefully. Value must be non-negative integer. The value zero + indicates stop immediately via the kill signal (no opportunity to shut down). If this value is + nil, the default grace period will be used instead. Set this value longer than the expected + cleanup time for your process. Defaults to 30 seconds. + :paramtype termination_grace_period_seconds: int :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. @@ -7542,13 +8531,66 @@ def __init__( :paramtype scale: ~azure.mgmt.appcontainers.models.Scale :keyword volumes: List of volume definitions for the Container App. :paramtype volumes: list[~azure.mgmt.appcontainers.models.Volume] + :keyword service_binds: List of container app services bound to the app. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.ServiceBind] """ super().__init__(**kwargs) self.revision_suffix = revision_suffix + self.termination_grace_period_seconds = termination_grace_period_seconds self.init_containers = init_containers self.containers = containers self.scale = scale self.volumes = volumes + self.service_binds = service_binds + + +class TokenStore(_serialization.Model): + """The configuration settings of the token store. + + :ivar enabled: :code:`true` to durably store platform-specific security tokens + that are obtained during login flows; otherwise, :code:`false`. + The default is :code:`false`. + :vartype enabled: bool + :ivar token_refresh_extension_hours: The number of hours after session token expiration that a + session token can be used to + call the token refresh API. The default is 72 hours. + :vartype token_refresh_extension_hours: float + :ivar azure_blob_storage: The configuration settings of the storage of the tokens if blob + storage is used. + :vartype azure_blob_storage: ~azure.mgmt.appcontainers.models.BlobStorageTokenStore + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "token_refresh_extension_hours": {"key": "tokenRefreshExtensionHours", "type": "float"}, + "azure_blob_storage": {"key": "azureBlobStorage", "type": "BlobStorageTokenStore"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + token_refresh_extension_hours: Optional[float] = None, + azure_blob_storage: Optional["_models.BlobStorageTokenStore"] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled: :code:`true` to durably store platform-specific security tokens + that are obtained during login flows; otherwise, :code:`false`. + The default is :code:`false`. + :paramtype enabled: bool + :keyword token_refresh_extension_hours: The number of hours after session token expiration that + a session token can be used to + call the token refresh API. The default is 72 hours. + :paramtype token_refresh_extension_hours: float + :keyword azure_blob_storage: The configuration settings of the storage of the tokens if blob + storage is used. + :paramtype azure_blob_storage: ~azure.mgmt.appcontainers.models.BlobStorageTokenStore + """ + super().__init__(**kwargs) + self.enabled = enabled + self.token_refresh_extension_hours = token_refresh_extension_hours + self.azure_blob_storage = azure_blob_storage class TrafficWeight(_serialization.Model): @@ -7776,6 +8818,9 @@ class Volume(_serialization.Model): :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. + :vartype mount_options: str """ _attribute_map = { @@ -7783,6 +8828,7 @@ class Volume(_serialization.Model): "storage_type": {"key": "storageType", "type": "str"}, "storage_name": {"key": "storageName", "type": "str"}, "secrets": {"key": "secrets", "type": "[SecretVolumeItem]"}, + "mount_options": {"key": "mountOptions", "type": "str"}, } def __init__( @@ -7792,6 +8838,7 @@ def __init__( storage_type: Optional[Union[str, "_models.StorageType"]] = None, storage_name: Optional[str] = None, secrets: Optional[List["_models.SecretVolumeItem"]] = None, + mount_options: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -7805,12 +8852,16 @@ def __init__( :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. + :paramtype mount_options: str """ super().__init__(**kwargs) self.name = name self.storage_type = storage_type self.storage_name = storage_name self.secrets = secrets + self.mount_options = mount_options class VolumeMount(_serialization.Model): @@ -7821,24 +8872,39 @@ class VolumeMount(_serialization.Model): :ivar mount_path: Path within the container at which the volume should be mounted.Must not contain ':'. :vartype mount_path: str + :ivar sub_path: Path within the volume from which the container's volume should be mounted. + Defaults to "" (volume's root). + :vartype sub_path: str """ _attribute_map = { "volume_name": {"key": "volumeName", "type": "str"}, "mount_path": {"key": "mountPath", "type": "str"}, + "sub_path": {"key": "subPath", "type": "str"}, } - def __init__(self, *, volume_name: Optional[str] = None, mount_path: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + volume_name: Optional[str] = None, + mount_path: Optional[str] = None, + sub_path: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword volume_name: This must match the Name of a Volume. :paramtype volume_name: str :keyword mount_path: Path within the container at which the volume should be mounted.Must not contain ':'. :paramtype mount_path: str + :keyword sub_path: Path within the volume from which the container's volume should be mounted. + Defaults to "" (volume's root). + :paramtype sub_path: str """ super().__init__(**kwargs) self.volume_name = volume_name self.mount_path = mount_path + self.sub_path = sub_path class WorkloadProfile(_serialization.Model): 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 5fc2fc5c9aa4..6cf094ec8dc4 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 @@ -9,19 +9,22 @@ from ._container_apps_auth_configs_operations import ContainerAppsAuthConfigsOperations from ._available_workload_profiles_operations import AvailableWorkloadProfilesOperations from ._billing_meters_operations import BillingMetersOperations +from ._builders_operations import BuildersOperations +from ._builds_operations import BuildsOperations from ._connected_environments_operations import ConnectedEnvironmentsOperations from ._connected_environments_certificates_operations import ConnectedEnvironmentsCertificatesOperations from ._connected_environments_dapr_components_operations import ConnectedEnvironmentsDaprComponentsOperations from ._connected_environments_storages_operations import ConnectedEnvironmentsStoragesOperations from ._container_apps_operations import ContainerAppsOperations -from ._jobs_operations import JobsOperations -from ._jobs_executions_operations import JobsExecutionsOperations 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 ._operations import Operations +from ._jobs_operations import JobsOperations +from ._jobs_executions_operations import JobsExecutionsOperations +from ._container_apps_api_client_operations import ContainerAppsAPIClientOperationsMixin from ._managed_environments_operations import ManagedEnvironmentsOperations from ._certificates_operations import CertificatesOperations from ._managed_certificates_operations import ManagedCertificatesOperations @@ -38,19 +41,22 @@ "ContainerAppsAuthConfigsOperations", "AvailableWorkloadProfilesOperations", "BillingMetersOperations", + "BuildersOperations", + "BuildsOperations", "ConnectedEnvironmentsOperations", "ConnectedEnvironmentsCertificatesOperations", "ConnectedEnvironmentsDaprComponentsOperations", "ConnectedEnvironmentsStoragesOperations", "ContainerAppsOperations", - "JobsOperations", - "JobsExecutionsOperations", "ContainerAppsRevisionsOperations", "ContainerAppsRevisionReplicasOperations", "ContainerAppsDiagnosticsOperations", "ManagedEnvironmentDiagnosticsOperations", "ManagedEnvironmentsDiagnosticsOperations", "Operations", + "JobsOperations", + "JobsExecutionsOperations", + "ContainerAppsAPIClientOperationsMixin", "ManagedEnvironmentsOperations", "CertificatesOperations", "ManagedCertificatesOperations", 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 11e2e26d1e44..fa5899717075 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,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL 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 dcd748db4c33..4f5242ae2a5f 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,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +38,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL 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..6b50436a7448 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py @@ -0,0 +1,1069 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-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", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-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", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-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", min_length=1), + "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 = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-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", min_length=1), + "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 = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-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", min_length=1), + "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 = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-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", min_length=1), + "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 = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class BuildersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`builders` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.BuilderResource"]: + """List BuilderResource resources by subscription ID. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/builders"} + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.BuilderResource"]: + """List BuilderResource resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders" + } + + @distributed_trace + def get(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> _models.BuilderResource: + """Get a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuilderResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuilderResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuilderResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO], + **kwargs: Any + ) -> _models.BuilderResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_envelope, (IOBase, bytes)): + _content = builder_envelope + else: + _json = self._serialize.body(builder_envelope, "BuilderResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BuilderResource", pipeline_response) + + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("BuilderResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: _models.BuilderResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Required. + :type builder_envelope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO], + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Is either a BuilderResource type or a IO + type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + builder_envelope=builder_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + def _update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO], + **kwargs: Any + ) -> Optional[_models.BuilderResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BuilderResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_envelope, (IOBase, bytes)): + _content = builder_envelope + else: + _json = self._serialize.body(builder_envelope, "BuilderResourceUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BuilderResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: _models.BuilderResourceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Required. + :type builder_envelope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO], + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Is either a + BuilderResourceUpdate type or a IO type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + builder_envelope=builder_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, builder_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + builder_name=builder_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}" + } diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py new file mode 100644 index 000000000000..d823bc3539c7 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py @@ -0,0 +1,738 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_builder_resource_request( + resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-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", min_length=1), + "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 = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, builder_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-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", min_length=1), + "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 = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, builder_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-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", min_length=1), + "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 = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, builder_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-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", min_length=1), + "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 = _format_url_section(_url, **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 list_by_builder_resource( + self, resource_group_name: str, builder_name: str, **kwargs: Any + ) -> Iterable["_models.BuildResource"]: + """List BuildResource resources by BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_builder_resource_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_builder_resource.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuildCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_builder_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds" + } + + @distributed_trace + def get(self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any) -> _models.BuildResource: + """Get a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO], + **kwargs: Any + ) -> _models.BuildResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(build_envelope, (IOBase, bytes)): + _content = build_envelope + else: + _json = self._serialize.body(build_envelope, "BuildResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BuildResource", pipeline_response) + + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("BuildResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: _models.BuildResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Required. + :type build_envelope: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO], + **kwargs: Any + ) -> LROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Is either a BuildResource type or + a IO type. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + build_envelope=build_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}" + } 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 ecf0b07ef59b..848fc9e4748b 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +43,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +110,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -146,7 +147,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +181,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -507,7 +508,7 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(certificate_envelope, (IO, bytes)): + if isinstance(certificate_envelope, (IOBase, bytes)): _content = certificate_envelope else: if certificate_envelope is not None: @@ -735,7 +736,7 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(certificate_envelope, (IO, bytes)): + if isinstance(certificate_envelope, (IOBase, bytes)): _content = certificate_envelope else: _json = self._serialize.body(certificate_envelope, "CertificatePatch") 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 bd975a1f8b4d..7b00c01ed65a 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +43,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -117,7 +118,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -158,7 +159,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -196,7 +197,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -525,7 +526,7 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(certificate_envelope, (IO, bytes)): + if isinstance(certificate_envelope, (IOBase, bytes)): _content = certificate_envelope else: if certificate_envelope is not None: @@ -753,7 +754,7 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(certificate_envelope, (IO, bytes)): + if isinstance(certificate_envelope, (IOBase, bytes)): _content = certificate_envelope else: _json = self._serialize.body(certificate_envelope, "CertificatePatch") 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 e7486c67d20c..22eaa8c867b7 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +43,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +110,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -146,7 +147,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +181,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -506,7 +507,7 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(dapr_component_envelope, (IO, bytes)): + if isinstance(dapr_component_envelope, (IOBase, bytes)): _content = dapr_component_envelope else: _json = self._serialize.body(dapr_component_envelope, "DaprComponent") 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 3dd7eb1df7ea..097371bd9139 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +43,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +67,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +99,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +132,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -167,7 +168,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -200,7 +201,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -233,7 +234,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -548,7 +549,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(environment_envelope, (IO, bytes)): + if isinstance(environment_envelope, (IOBase, bytes)): _content = environment_envelope else: _json = self._serialize.body(environment_envelope, "ConnectedEnvironment") @@ -1048,7 +1049,7 @@ def check_name_availability( content_type = content_type or "application/json" _json = None _content = None - if isinstance(check_name_availability_request, (IO, bytes)): + if isinstance(check_name_availability_request, (IOBase, bytes)): _content = check_name_availability_request else: _json = self._serialize.body(check_name_availability_request, "CheckNameAvailabilityRequest") 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 24aef4a0e09b..9eee99ae3a7e 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +41,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +74,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +108,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -144,7 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -443,7 +444,7 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_envelope, (IO, bytes)): + if isinstance(storage_envelope, (IOBase, bytes)): _content = storage_envelope else: _json = self._serialize.body(storage_envelope, "ConnectedEnvironmentStorage") 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 new file mode 100644 index 000000000000..0b48aa39e8f0 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py @@ -0,0 +1,224 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_job_execution_request( + resource_group_name: str, job_name: str, job_execution_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/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), + "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\._\(\)]+$"), + "jobExecutionName": _SERIALIZER.url( + "job_execution_name", job_execution_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _format_url_section(_url, **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_custom_domain_verification_id_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/getCustomDomainVerificationId" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ContainerAppsAPIClientOperationsMixin(ContainerAppsAPIClientMixinABC): + @distributed_trace + def job_execution( + self, resource_group_name: str, job_name: str, job_execution_name: str, **kwargs: Any + ) -> _models.JobExecution: + """Get details of a single job execution. + + Get details of a single job execution. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Job Name. Required. + :type job_name: str + :param job_execution_name: Job execution name. Required. + :type job_execution_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobExecution or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.JobExecution + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.JobExecution] = kwargs.pop("cls", None) + + request = build_job_execution_request( + resource_group_name=resource_group_name, + job_name=job_name, + job_execution_name=job_execution_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.job_execution.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("JobExecution", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + job_execution.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}" + } + + @distributed_trace + def get_custom_domain_verification_id(self, **kwargs: Any) -> str: + """Get the verification id of a subscription used for verifying custom domains. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str or the result of cls(response) + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[str] = kwargs.pop("cls", None) + + request = build_get_custom_domain_verification_id_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_custom_domain_verification_id.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_custom_domain_verification_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/getCustomDomainVerificationId" + } diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py index 02579714750a..0066c88bf27a 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +43,7 @@ def build_list_by_container_app_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +110,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -146,7 +147,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -472,7 +473,7 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(auth_config_envelope, (IO, bytes)): + if isinstance(auth_config_envelope, (IOBase, bytes)): _content = auth_config_envelope else: _json = self._serialize.body(auth_config_envelope, "AuthConfig") 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 0303e28aa0d4..ab99707763b2 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,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +42,7 @@ def build_list_detectors_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +75,7 @@ def build_get_detector_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +114,7 @@ def build_list_revisions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,7 +149,7 @@ def build_get_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,7 +183,7 @@ def build_get_root_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL 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 9e41e38dbe9e..cec550c7cb3c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +43,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +67,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +99,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +132,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -167,7 +168,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -200,7 +201,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -230,7 +231,7 @@ def build_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_custom_host_name_analysis_request( # pylint: disable=name-too-long +def build_list_custom_host_name_analysis_request( resource_group_name: str, container_app_name: str, subscription_id: str, @@ -241,7 +242,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", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -276,7 +277,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -309,7 +310,7 @@ def build_get_auth_token_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -336,6 +337,76 @@ def build_get_auth_token_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_start_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", "2023-05-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/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), + "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 = _format_url_section(_url, **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_stop_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", "2023-05-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/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), + "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 = _format_url_section(_url, **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 ContainerAppsOperations: """ .. warning:: @@ -617,7 +688,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(container_app_envelope, (IO, bytes)): + if isinstance(container_app_envelope, (IOBase, bytes)): _content = container_app_envelope else: _json = self._serialize.body(container_app_envelope, "ContainerApp") @@ -971,7 +1042,7 @@ def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(container_app_envelope, (IO, bytes)): + if isinstance(container_app_envelope, (IOBase, bytes)): _content = container_app_envelope else: _json = self._serialize.body(container_app_envelope, "ContainerApp") @@ -1383,3 +1454,265 @@ def get_auth_token( get_auth_token.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/getAuthtoken" } + + def _start_initial( + self, resource_group_name: str, container_app_name: str, **kwargs: Any + ) -> Optional[_models.ContainerApp]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.ContainerApp]] = kwargs.pop("cls", None) + + request = build_start_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ContainerApp", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/start" + } + + @distributed_trace + def begin_start( + self, resource_group_name: str, container_app_name: str, **kwargs: Any + ) -> LROPoller[_models.ContainerApp]: + """Start a container app. + + Start a 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ContainerApp or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ContainerApp] + :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.ContainerApp] = 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._start_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ContainerApp", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/start" + } + + def _stop_initial( + self, resource_group_name: str, container_app_name: str, **kwargs: Any + ) -> Optional[_models.ContainerApp]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.ContainerApp]] = kwargs.pop("cls", None) + + request = build_stop_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._stop_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ContainerApp", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/stop" + } + + @distributed_trace + def begin_stop( + self, resource_group_name: str, container_app_name: str, **kwargs: Any + ) -> LROPoller[_models.ContainerApp]: + """Stop a container app. + + Stop a 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ContainerApp or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ContainerApp] + :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.ContainerApp] = 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._stop_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ContainerApp", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/stop" + } 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 083d4b07acac..bb8bab7fb4b8 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,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +45,7 @@ def build_get_replica_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,7 +80,7 @@ def build_list_replicas_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL 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 9ae4e226a207..bb7cace52ee6 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,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +47,7 @@ def build_list_revisions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +82,7 @@ def build_get_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,7 +116,7 @@ def build_activate_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +150,7 @@ def build_deactivate_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +184,7 @@ def build_restart_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL 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 715633b761f0..64cbc0a6e2f1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +45,7 @@ def build_list_by_container_app_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +112,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -148,7 +149,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -385,7 +386,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(source_control_envelope, (IO, bytes)): + if isinstance(source_control_envelope, (IOBase, bytes)): _content = source_control_envelope else: _json = self._serialize.body(source_control_envelope, "SourceControl") 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 c14821467fb7..61fbd6cb8281 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +43,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +110,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -146,7 +147,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +181,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -504,7 +505,7 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(dapr_component_envelope, (IO, bytes)): + if isinstance(dapr_component_envelope, (IOBase, bytes)): _content = dapr_component_envelope else: _json = self._serialize.body(dapr_component_envelope, "DaprComponent") 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 fa1a89634dad..b700346f1bb1 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,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +42,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +101,7 @@ def list( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param filter: The filter to apply on the operation. Default value is None. :type filter: str 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 b35271391722..c8f28032131d 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +43,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +67,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +97,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", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +130,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", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -143,7 +144,7 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "jobName": _SERIALIZER.url("job_name", job_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[-\w\._\(\)]+$"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -163,7 +164,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", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -176,7 +177,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "jobName": _SERIALIZER.url("job_name", job_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[-\w\._\(\)]+$"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -194,7 +195,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", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -208,7 +209,7 @@ def build_update_request(resource_group_name: str, job_name: str, subscription_i "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "jobName": _SERIALIZER.url("job_name", job_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[-\w\._\(\)]+$"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -228,7 +229,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", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -264,7 +265,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", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -300,8 +301,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", "2022-11-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -323,8 +323,6 @@ def build_stop_multiple_executions_request( _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) @@ -336,7 +334,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", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -563,7 +561,7 @@ def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Job or the result of cls(response) @@ -640,7 +638,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_envelope, (IO, bytes)): + if isinstance(job_envelope, (IOBase, bytes)): _content = job_envelope else: _json = self._serialize.body(job_envelope, "Job") @@ -704,7 +702,7 @@ def begin_create_or_update( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param job_envelope: Properties used to create a container apps job. Required. :type job_envelope: ~azure.mgmt.appcontainers.models.Job @@ -741,7 +739,7 @@ def begin_create_or_update( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param job_envelope: Properties used to create a container apps job. Required. :type job_envelope: IO @@ -772,7 +770,7 @@ def begin_create_or_update( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param job_envelope: Properties used to create a container apps job. Is either a Job type or a IO type. Required. @@ -903,7 +901,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -987,7 +985,7 @@ def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_envelope, (IO, bytes)): + if isinstance(job_envelope, (IOBase, bytes)): _content = job_envelope else: _json = self._serialize.body(job_envelope, "JobPatchProperties") @@ -1053,7 +1051,7 @@ def begin_update( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param job_envelope: Properties used to create a container apps job. Required. :type job_envelope: ~azure.mgmt.appcontainers.models.JobPatchProperties @@ -1090,7 +1088,7 @@ def begin_update( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param job_envelope: Properties used to create a container apps job. Required. :type job_envelope: IO @@ -1125,7 +1123,7 @@ def begin_update( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param job_envelope: Properties used to create a container apps job. Is either a JobPatchProperties type or a IO type. Required. @@ -1214,7 +1212,7 @@ def _start_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(template, (IO, bytes)): + if isinstance(template, (IOBase, bytes)): _content = template else: _json = self._serialize.body(template, "JobExecutionTemplate") @@ -1280,7 +1278,7 @@ def begin_start( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param template: Properties used to start a job instance. Required. :type template: ~azure.mgmt.appcontainers.models.JobExecutionTemplate @@ -1318,7 +1316,7 @@ def begin_start( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param template: Properties used to start a job instance. Required. :type template: IO @@ -1350,7 +1348,7 @@ def begin_start( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param template: Properties used to start a job instance. Is either a JobExecutionTemplate type or a IO type. Required. @@ -1485,7 +1483,7 @@ def begin_stop_execution( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :param job_execution_name: Job execution name. Required. :type job_execution_name: str @@ -1548,11 +1546,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- } def _stop_multiple_executions_initial( - self, - resource_group_name: str, - job_name: str, - job_execution_name: Union[_models.JobExecutionNamesCollection, IO], - **kwargs: Any + self, resource_group_name: str, job_name: str, **kwargs: Any ) -> Optional[_models.ContainerAppJobExecutions]: error_map = { 401: ClientAuthenticationError, @@ -1562,29 +1556,17 @@ def _stop_multiple_executions_initial( } 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[Optional[_models.ContainerAppJobExecutions]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(job_execution_name, (IO, bytes)): - _content = job_execution_name - else: - _json = self._serialize.body(job_execution_name, "JobExecutionNamesCollection") - request = build_stop_multiple_executions_request( resource_group_name=resource_group_name, job_name=job_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, template_url=self._stop_multiple_executions_initial.metadata["url"], headers=_headers, params=_params, @@ -1621,91 +1603,9 @@ def _stop_multiple_executions_initial( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/stop" } - @overload - def begin_stop_multiple_executions( - self, - resource_group_name: str, - job_name: str, - job_execution_name: _models.JobExecutionNamesCollection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerAppJobExecutions]: - """Terminates execution of a running container apps job. - - Terminates execution of a running container apps 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 Container Apps Job. Required. - :type job_name: str - :param job_execution_name: List of all job executions that should be stopped. Required. - :type job_execution_name: ~azure.mgmt.appcontainers.models.JobExecutionNamesCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ContainerAppJobExecutions or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ContainerAppJobExecutions] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_stop_multiple_executions( - self, - resource_group_name: str, - job_name: str, - job_execution_name: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ContainerAppJobExecutions]: - """Terminates execution of a running container apps job. - - Terminates execution of a running container apps 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 Container Apps Job. Required. - :type job_name: str - :param job_execution_name: List of all job executions that should be stopped. Required. - :type job_execution_name: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ContainerAppJobExecutions or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ContainerAppJobExecutions] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace def begin_stop_multiple_executions( - self, - resource_group_name: str, - job_name: str, - job_execution_name: Union[_models.JobExecutionNamesCollection, IO], - **kwargs: Any + self, resource_group_name: str, job_name: str, **kwargs: Any ) -> LROPoller[_models.ContainerAppJobExecutions]: """Terminates execution of a running container apps job. @@ -1714,14 +1614,8 @@ def begin_stop_multiple_executions( :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str - :param job_execution_name: List of all job executions that should be stopped. Is either a - JobExecutionNamesCollection type or a IO type. Required. - :type job_execution_name: ~azure.mgmt.appcontainers.models.JobExecutionNamesCollection or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1736,11 +1630,10 @@ def begin_stop_multiple_executions( ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ContainerAppJobExecutions] :raises ~azure.core.exceptions.HttpResponseError: """ - _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.ContainerAppJobExecutions] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1749,9 +1642,7 @@ def begin_stop_multiple_executions( raw_result = self._stop_multiple_executions_initial( resource_group_name=resource_group_name, job_name=job_name, - job_execution_name=job_execution_name, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -1795,7 +1686,7 @@ def list_secrets(self, resource_group_name: str, job_name: str, **kwargs: Any) - :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 Container Apps Job. Required. + :param job_name: Job Name. Required. :type job_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobSecretsCollection or the result of cls(response) 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 95baed2e910c..1847a1628f76 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +45,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +79,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -115,7 +116,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,7 +150,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -186,7 +187,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -329,7 +330,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(managed_certificate_envelope, (IO, bytes)): + if isinstance(managed_certificate_envelope, (IOBase, bytes)): _content = managed_certificate_envelope else: if managed_certificate_envelope is not None: @@ -738,7 +739,7 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(managed_certificate_envelope, (IO, bytes)): + if isinstance(managed_certificate_envelope, (IOBase, bytes)): _content = managed_certificate_envelope else: _json = self._serialize.body(managed_certificate_envelope, "ManagedCertificatePatch") 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 94264a0240b9..86ec749e4441 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,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,7 @@ def build_list_detectors_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +73,7 @@ def build_get_detector_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL 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 a7c5bcbe547c..847d83678626 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,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,7 @@ def build_get_root_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL 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 250562ee320f..0a9ec5369c36 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +43,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +67,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +99,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +132,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -167,7 +168,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -200,7 +201,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -236,7 +237,7 @@ def build_get_auth_token_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -263,13 +264,13 @@ def build_get_auth_token_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_workload_profile_states_request( # pylint: disable=name-too-long +def build_list_workload_profile_states_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", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -579,7 +580,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(environment_envelope, (IO, bytes)): + if isinstance(environment_envelope, (IOBase, bytes)): _content = environment_envelope else: _json = self._serialize.body(environment_envelope, "ManagedEnvironment") @@ -925,7 +926,7 @@ def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(environment_envelope, (IO, bytes)): + if isinstance(environment_envelope, (IOBase, bytes)): _content = environment_envelope else: _json = self._serialize.body(environment_envelope, "ManagedEnvironment") 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 a57f8221fea2..5ef66971f6f0 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +41,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +74,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +108,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -144,7 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -443,7 +444,7 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(storage_envelope, (IO, bytes)): + if isinstance(storage_envelope, (IOBase, bytes)): _content = storage_envelope else: _json = self._serialize.body(storage_envelope, "ManagedEnvironmentStorage") 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 307e3a24ea7b..4034dc1fccad 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request, _format_url_section T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +41,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -197,7 +198,7 @@ def check_name_availability( content_type = content_type or "application/json" _json = None _content = None - if isinstance(check_name_availability_request, (IO, bytes)): + if isinstance(check_name_availability_request, (IOBase, bytes)): _content = check_name_availability_request else: _json = self._serialize.body(check_name_availability_request, "CheckNameAvailabilityRequest") 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 1c1b25cf0853..f8a7f11d01ca 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,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL 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 2fdfd27a32e4..5e4aa5e428be 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_create_or_update.py @@ -35,6 +35,10 @@ def main(): auth_config_name="current", auth_config_envelope={ "properties": { + "encryptionSettings": { + "containerAppAuthEncryptionSecretName": "testEncryptionSecretName", + "containerAppAuthSigningSecretName": "testSigningSecretName", + }, "globalValidation": {"unauthenticatedClientAction": "AllowAnonymous"}, "identityProviders": { "facebook": {"registration": {"appId": "123", "appSecretSettingName": "facebook-secret"}} @@ -46,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 73499cbfb34b..c1e69062a06b 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 @@ -29,14 +29,13 @@ def main(): subscription_id="651f8027-33e8-4ec4-97b4-f6e9f3dc8744", ) - response = client.container_apps_auth_configs.delete( + client.container_apps_auth_configs.delete( resource_group_name="workerapps-rg-xj", container_app_name="testcanadacentral", auth_config_name="current", ) - print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 68155c3309ed..6a03cd3b3263 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 e82fd4737f30..64e7476f46f5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_list_by_container.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_list_by_container.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AuthConfigs_ListByContainer.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 eaaa81fd402e..48fc71a10006 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/available_workload_profiles_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/available_workload_profiles_get.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/AvailableWorkloadProfiles_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 d0d3426a753a..3c655cf007dc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/billing_meters_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/billing_meters_get.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/BillingMeters_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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..30a5fecb7860 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builders_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builders.begin_create_or_update( + resource_group_name="rg", + builder_name="testBuilder", + builder_envelope={ + "identity": { + "type": "SystemAssigned,UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": {} + }, + }, + "location": "eastus", + "properties": { + "containerRegistries": [ + { + "containerRegistryServer": "test.azurecr.io", + "identityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", + }, + { + "containerRegistryServer": "test2.azurecr.io", + "identityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", + }, + ], + "environmentId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/managedEnvironments/testEnv", + }, + "tags": {"company": "Microsoft"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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..55ddadef50d7 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_delete.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builders_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.builders.begin_delete( + resource_group_name="rg", + builder_name="testBuilder", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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..0347bd5fbf2c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builders_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builders.get( + resource_group_name="rg", + builder_name="testBuilder", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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..1fa179d8f7c0 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builders_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builders.list_by_resource_group( + resource_group_name="rg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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..14f06a3f6800 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builders_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builders.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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..82a77ff2cff1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builders_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builders.begin_update( + resource_group_name="rg", + builder_name="testBuilder", + builder_envelope={"tags": {"mytag1": "myvalue1"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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..43a3dc9dd8f9 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py @@ -0,0 +1,69 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builds_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builds.begin_create_or_update( + resource_group_name="rg", + builder_name="testBuilder", + build_name="testBuild-123456789az", + build_envelope={ + "properties": { + "configuration": { + "baseOs": "DebianBullseye", + "environmentVariables": [{"name": "foo1", "value": "bar1"}, {"name": "foo2", "value": "bar2"}], + "platform": "dotnetcore", + "platformVersion": "7.0", + "preBuildSteps": [ + { + "description": "First pre build step.", + "httpGet": { + "fileName": "output.txt", + "headers": ["foo", "bar"], + "url": "https://microsoft.com", + }, + "scripts": ["echo 'hello'", "echo 'world'"], + }, + { + "description": "Second pre build step.", + "httpGet": {"fileName": "output.txt", "headers": ["foo"], "url": "https://microsoft.com"}, + "scripts": ["echo 'hello'", "echo 'again'"], + }, + ], + }, + "destinationContainerRegistry": {"image": "test.azurecr.io/repo:tag", "server": "test.azurecr.io"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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..07ccb636cc36 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builds_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.builds.begin_delete( + resource_group_name="rg", + builder_name="testBuilder", + build_name="testBuild", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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..4164f72a2b31 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builds_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builds.get( + resource_group_name="rg", + builder_name="testBuilder", + build_name="testBuild", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-02-preview/examples/Builds_Get.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..ca80ec87e04c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builds_list_by_builder_resource.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builds.list_by_builder_resource( + resource_group_name="rg", + builder_name="testBuilder", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 6856fa9f931c..2bbd9079be03 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-02-preview/examples/Certificate_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py index b73cd9dd3920..225783a1cc38 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py @@ -29,14 +29,13 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.certificates.delete( + client.certificates.delete( 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/2022-11-01-preview/examples/Certificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 db6a07c05054..0e45e5dba147 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 fc86e5e16994..d14e1e62216b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_check_name_availability.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_check_name_availability.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificates_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 49ef6bc42fce..4e448c0a3c3a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_list_by_managed_environment.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_list_by_managed_environment.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificates_ListByManagedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 73cab76b12d6..8287d85559ec 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Certificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 f171f42543a1..b79b8b8be702 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_create_or_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 49e5ca3bf982..b428ef68d7f9 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 @@ -29,14 +29,13 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.connected_environments_certificates.delete( + client.connected_environments_certificates.delete( resource_group_name="examplerg", connected_environment_name="testcontainerenv", certificate_name="certificate-firendly-name", ) - print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 4610afba1abc..e180754d25ab 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 0ca25b65856a..864d211ce252 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_check_name_availability.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_check_name_availability.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificates_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 a4f99a44e3f4..4bb68b9678a1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_list_by_connected_environment.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_list_by_connected_environment.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificates_ListByConnectedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 6ce10b0ce4c3..5519c8d40d92 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_patch.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsCertificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 422d52046e63..45ed924a2b6e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_create_or_update.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 96fe989716ea..bf525de75a2c 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 @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 0a903fa82e08..f38e4f800a6e 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 @@ -29,14 +29,13 @@ def main(): subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) - response = client.connected_environments_dapr_components.delete( + client.connected_environments_dapr_components.delete( resource_group_name="examplerg", connected_environment_name="myenvironment", component_name="reddog", ) - print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 eae2e4845f05..4c6747e17b7a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 d49b235eedd1..195242a4c594 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 fc344c736fe1..d3e0dbd18cb8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list_secrets.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 450b11d08949..69ec6cb1043e 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 @@ -29,13 +29,12 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.connected_environments.begin_delete( + client.connected_environments.begin_delete( resource_group_name="examplerg", connected_environment_name="examplekenv", ).result() - print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 27e4454edf2d..7de3a14087af 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 9cbafd29496f..41e484a7035c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 5aebc8fccbdc..318de5527965 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 422a452309e9..1aeaa3c62d07 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_patch.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironments_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 cfcb5a02397c..38305cfbd50e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_create_or_update.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 6b002285462a..0dc9927f6408 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 @@ -29,14 +29,13 @@ def main(): subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) - response = client.connected_environments_storages.delete( + client.connected_environments_storages.delete( resource_group_name="examplerg", connected_environment_name="env", storage_name="jlaw-demo1", ) - print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 670c8a3fc198..aa83952e4adf 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 66a403d4f0f3..292351e239c6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_list.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ConnectedEnvironmentsStorages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-02-preview/examples/ConnectedEnvironmentsStorages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py index 36050f16644c..a5d90949c625 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 c659765ab4e8..0e5bb4891980 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update.py @@ -46,6 +46,10 @@ def main(): "logLevel": "debug", }, "ingress": { + "additionalPortMappings": [ + {"external": True, "targetPort": 1234}, + {"exposedPort": 3456, "external": False, "targetPort": 2345}, + ], "clientCertificateMode": "accept", "corsPolicy": { "allowCredentials": True, @@ -87,6 +91,7 @@ def main(): "traffic": [{"label": "production", "revisionName": "testcontainerApp0-ab1234", "weight": 100}], }, "maxInactiveRevisions": 10, + "service": {"type": "redis"}, }, "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", "template": { @@ -127,6 +132,12 @@ def main(): } ], }, + "serviceBinds": [ + { + "name": "redisService", + "serviceId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/redisService", + } + ], }, "workloadProfileName": "My-GP-01", }, @@ -135,6 +146,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-02-preview/examples/ContainerApps_CreateOrUpdate.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 d7bf3d3591c7..bd88f9a4d6c6 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 @@ -29,13 +29,12 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.container_apps.begin_delete( + client.container_apps.begin_delete( resource_group_name="rg", container_app_name="testWorkerApp0", ).result() - print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 963d4099b31e..ed915577bea8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerAppsDiagnostics_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 5501553a879e..18e4130e54fa 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerAppsDiagnostics_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 05e98d9af08c..6d63bbef7954 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 e2a3e0cb9506..da72ae8afdd8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get_auth_token.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get_auth_token.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_GetAuthToken.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-02-preview/examples/ContainerApps_GetAuthToken.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py index 786e0f64690a..84aa5326ad4d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 ac9e505a4f6b..87f80f2c326c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 1f252b45b5e7..0547191773d0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_custom_host_name_analysis.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_custom_host_name_analysis.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListCustomHostNameAnalysis.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 52f325c6f9ee..941094c98e70 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_secrets.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 a6ee960e6641..68e467d32386 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_managed_by_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_managed_by_create_or_update.py @@ -73,6 +73,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_ManagedBy_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 e3ec24836ce4..7ca62cc59dc1 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 @@ -78,6 +78,7 @@ def main(): "traffic": [{"label": "production", "revisionName": "testcontainerApp0-ab1234", "weight": 100}], }, "maxInactiveRevisions": 10, + "service": {"type": "redis"}, }, "template": { "containers": [ @@ -115,6 +116,12 @@ def main(): } ], }, + "serviceBinds": [ + { + "name": "service", + "serviceId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/service", + } + ], }, }, "tags": {"tag1": "value1", "tag2": "value2"}, @@ -123,6 +130,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-02-preview/examples/ContainerApps_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py new file mode 100644 index 000000000000..ffcf6942ad64 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.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 container_apps_start.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_start( + resource_group_name="rg", + container_app_name="testWorkerApp0", + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 new file mode 100644 index 000000000000..dd01fdac81f8 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.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 container_apps_stop.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_stop( + resource_group_name="rg", + container_app_name="testWorkerApp0", + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 785238a57383..ff18298479a6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_tcp_app_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_tcp_app_create_or_update.py @@ -72,6 +72,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ContainerApps_TcpApp_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-02-preview/examples/ContainerApps_TcpApp_CreateOrUpdate.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 0d919dcb27f2..ded7ec106a5b 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 @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_CreateOrUpdate_SecretStoreComponent.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 0ae187bde673..b460c4aed614 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 @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_CreateOrUpdate_Secrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 e852846872be..4bd265a02ff9 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 @@ -29,14 +29,13 @@ def main(): subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) - response = client.dapr_components.delete( + client.dapr_components.delete( resource_group_name="examplerg", environment_name="myenvironment", component_name="reddog", ) - print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 e32d640601a2..5d4c74c7c70d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secret_store_component.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secret_store_component.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_Get_SecretStoreComponent.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 bede0270bd3d..f383d98f86b0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secrets.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_Get_Secrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 90fc4d76af7e..16d30a6beb9b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 abee031c340e..04a046363c98 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list_secrets.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/DaprComponents_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-02-preview/examples/DaprComponents_ListSecrets.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 new file mode 100644 index 000000000000..8aab3684379d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py @@ -0,0 +1,82 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +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.2, "memory": "100Mi"}, + } + ], + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-02-preview/examples/Job_CreateorUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py new file mode 100644 index 000000000000..84e8c121a435 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py @@ -0,0 +1,80 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python job_createor_update_event_trigger.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": { + "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": [ + { + "args": ["-c", "while true; do echo hello; sleep 10;done"], + "command": ["/bin/sh"], + "image": "repo/testcontainerAppsJob0:v4", + "name": "testinitcontainerAppsJob0", + "resources": {"cpu": 0.2, "memory": "100Mi"}, + } + ], + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-02-preview/examples/Job_CreateorUpdate_EventTrigger.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py index 1db54ecaa3a5..29874ada4f94 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py @@ -29,13 +29,12 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.jobs.begin_delete( + client.jobs.begin_delete( resource_group_name="rg", job_name="testWorkerContainerAppsJob0", ).result() - print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 new file mode 100644 index 000000000000..86a4f9c24246 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_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 job_execution_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.job_execution( + resource_group_name="rg", + job_name="testcontainerAppsJob0", + job_execution_name="jobExecution1", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 f7769f7018b5..ebfc6e23e50a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_executions_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_executions_get.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Executions_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 cf7b680c5a6e..d770becb383a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-02-preview/examples/Job_Get.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 de7e9d3dff56..24b37e254698 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-02-preview/examples/Job_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py new file mode 100644 index 000000000000..e09ae764df38 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py @@ -0,0 +1,80 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python job_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.jobs.begin_update( + resource_group_name="rg", + job_name="testcontainerAppsJob0", + job_envelope={ + "properties": { + "configuration": { + "manualTriggerConfig": {"parallelism": 4, "replicaCompletionCount": 1}, + "replicaRetryLimit": 10, + "replicaTimeout": 10, + "triggerType": "Manual", + }, + "template": { + "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.2, "memory": "100Mi"}, + } + ], + }, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-02-preview/examples/Job_Patch.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 6c04dd9f87a3..83be71299584 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py @@ -54,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Start.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 e132308deedb..bb54de30bd34 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 @@ -29,14 +29,13 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.jobs.begin_stop_execution( + client.jobs.begin_stop_execution( resource_group_name="rg", job_name="testcontainerAppsJob0", job_execution_name="jobExecution1", ).result() - print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Stop_Execution.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 bd26134cc901..74ded4205cf8 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,17 +32,10 @@ def main(): response = client.jobs.begin_stop_multiple_executions( resource_group_name="rg", job_name="testcontainerAppsJob0", - job_execution_name={ - "value": [ - {"name": "jobExecution-27944453"}, - {"name": "jobExecution-27944452"}, - {"name": "jobExecution-27944451"}, - ] - }, ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Stop_Multiple.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 8028e4e11e52..5ff15cd5fc95 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Jobs_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 6299518cd71e..f239e0d6c9e7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Jobs_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-02-preview/examples/Jobs_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py index 73da2b9fce78..2544c51ce8f8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 dbdcc95ab8d9..be31e48e650a 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 @@ -29,14 +29,13 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.managed_certificates.delete( + client.managed_certificates.delete( resource_group_name="examplerg", environment_name="testcontainerenv", managed_certificate_name="certificate-firendly-name", ) - print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 697f0c4125b8..3880d9fed348 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 d6c1d7ac38ab..d1198e88c800 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_list_by_managed_environment.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_list_by_managed_environment.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificates_ListByManagedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 186eac57bacd..1d916992205e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_patch.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedCertificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 3860290d1b5f..ee59c258b41e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentDiagnostics_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 825473fab1c2..f106959e09c3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_list.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentDiagnostics_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-02-preview/examples/ManagedEnvironmentDiagnostics_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 c396e7a4fd2a..051128fb1188 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 @@ -42,6 +42,7 @@ def main(): "dnsSuffix": "www.my-name.com", }, "daprAIConnectionString": "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://northcentralus-0.in.applicationinsights.azure.com/", + "peerAuthentication": {"mtls": {"enabled": True}}, "vnetConfiguration": { "infrastructureSubnetId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/VNetName/subnets/subnetName1" }, @@ -73,6 +74,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 fca0f8215ca0..33fab6a47df0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_custom_infrastructure_resource_group_create.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_custom_infrastructure_resource_group_create.py @@ -74,6 +74,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_CustomInfrastructureResourceGroup_Create.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 d0300efc6188..538d6d331bb1 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 @@ -29,13 +29,12 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.managed_environments.begin_delete( + client.managed_environments.begin_delete( resource_group_name="examplerg", environment_name="examplekenv", ).result() - print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 3635fe7070f1..7926cff83e97 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-02-preview/examples/ManagedEnvironments_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py index 194a5a004cdd..c6b00f85499c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_GetAuthToken.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 e9441bb41f6a..17b1196af39a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 b70ad83ded5f..60ebf6bae0bc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 166fce770544..398a6df501b8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_workload_profile_states.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_workload_profile_states.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_ListWorkloadProfileStates.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 9b5120a0c742..e3583583cb04 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_patch.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironments_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 bb1ac9b8e29f..79f62125c635 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-02-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py index 6c278a6e9587..cecb38b29ec6 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 @@ -29,14 +29,13 @@ def main(): subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) - response = client.managed_environments_storages.delete( + client.managed_environments_storages.delete( resource_group_name="examplerg", environment_name="managedEnv", storage_name="jlaw-demo1", ) - print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 1ac7c222c6e4..c61755cb08a8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-02-preview/examples/ManagedEnvironmentsStorages_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py index 3dc6150044fb..eddbe3c2b497 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/ManagedEnvironmentsStorages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 dbd5b745b386..3562342a758c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Operations_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 662f4e832eb9..c61bdb9fdf1a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Replicas_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 e4ce31844076..c7226208924e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Replicas_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 13d18f3e87d4..5c8e063af11b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py @@ -29,14 +29,13 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.container_apps_revisions.activate_revision( + client.container_apps_revisions.activate_revision( resource_group_name="rg", container_app_name="testcontainerApp0", revision_name="testcontainerApp0-pjxhsye", ) - print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Activate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 01bb6e5ae416..0a9e6928d392 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py @@ -29,14 +29,13 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.container_apps_revisions.deactivate_revision( + client.container_apps_revisions.deactivate_revision( resource_group_name="rg", container_app_name="testcontainerApp0", revision_name="testcontainerApp0-pjxhsye", ) - print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Deactivate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 23bada99296c..c02ed49bc085 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 7d3713f40773..6e8cbafd2271 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 5b69a8a05d5a..da6eccfeb4e9 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py @@ -29,14 +29,13 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.container_apps_revisions.restart_revision( + client.container_apps_revisions.restart_revision( resource_group_name="rg", container_app_name="testStaticSite0", revision_name="testcontainerApp0-pjxhsye", ) - print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Revisions_Restart.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-02-preview/examples/Revisions_Restart.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py index 32a00cfe8d00..61dab8c09cca 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 @@ -40,14 +40,16 @@ def main(): "azureCredentials": { "clientId": "", "clientSecret": "", + "kind": "feaderated", "tenantId": "", }, "contextPath": "./", + "githubPersonalAccessToken": "test", "image": "image/tag", "registryInfo": { "registryPassword": "", - "registryUrl": "xwang971reg.azurecr.io", - "registryUserName": "xwang971reg", + "registryUrl": "test-registry.azurecr.io", + "registryUserName": "test-registry", }, }, "repoUrl": "https://github.com/xwang971/ghatest", @@ -57,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 d8124cab5b61..5916936ed7f4 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 @@ -29,14 +29,13 @@ def main(): subscription_id="651f8027-33e8-4ec4-97b4-f6e9f3dc8744", ) - response = client.container_apps_source_controls.begin_delete( + client.container_apps_source_controls.begin_delete( resource_group_name="workerapps-rg-xj", container_app_name="testcanadacentral", source_control_name="current", ).result() - print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 f819d955b351..d4b90bc208c8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 85b4f542cc83..5a4898499932 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_list_by_container.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_list_by_container.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/SourceControls_ListByContainer.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-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 new file mode 100644 index 000000000000..bea4142621e6 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python subscriptions_get_custom_domain_verification_id.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="d27c3573-f76e-4b26-b871-0ccd2203d08c", + ) + + response = client.get_custom_domain_verification_id() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-05-02-preview/examples/Subscriptions_GetCustomDomainVerificationId.json +if __name__ == "__main__": + main()